From a73058062c96451e9fb130939968c891da8597c7 Mon Sep 17 00:00:00 2001 From: dags- Date: Mon, 29 Jun 2020 22:55:44 +0100 Subject: [PATCH] more improvements to settings --- Engine | 2 +- FeatureManager | 2 +- .../mod/biome/map/defaults/DefaultBiome.java | 3 --- .../mod/biome/map/defaults/DefaultBiomes.java | 7 +++---- .../mod/biome/modifier/MountainModifier.java | 4 ++-- .../terraforged/mod/chunk/TerraSetupFactory.java | 4 ++++ .../mod/client/gui/page/PresetsPage.java | 16 ++++++---------- .../mod/client/gui/preview/RenderMode.java | 8 ++++---- .../mod/client/gui/preview2/Preview.java | 2 +- 9 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Engine b/Engine index 37a553e..d9dee33 160000 --- a/Engine +++ b/Engine @@ -1 +1 @@ -Subproject commit 37a553e45da72353eb608459b195e8f503a3fcab +Subproject commit d9dee330393aa0bce3bc69920734d80617c82be2 diff --git a/FeatureManager b/FeatureManager index cba0f35..0a30125 160000 --- a/FeatureManager +++ b/FeatureManager @@ -1 +1 @@ -Subproject commit cba0f3516ee9aa2d11b3bd4f0e72277c17c8f39b +Subproject commit 0a3012574af66b128b492b26b8389762654a61a2 diff --git a/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiome.java b/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiome.java index 15105df..247f78c 100644 --- a/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiome.java +++ b/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiome.java @@ -1,12 +1,9 @@ package com.terraforged.mod.biome.map.defaults; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.OceanBiome; public interface DefaultBiome { - Biome NONE = new OceanBiome().setRegistryName("terraforged", "none"); - Biome getBiome(float temperature); default Biome getDefaultBiome(float temperature) { diff --git a/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiomes.java b/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiomes.java index 44a3d9d..fe0935e 100644 --- a/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiomes.java +++ b/src/main/java/com/terraforged/mod/biome/map/defaults/DefaultBiomes.java @@ -6,6 +6,8 @@ import net.minecraft.world.biome.Biomes; public class DefaultBiomes { + public static final Biome NONE = Biomes.THE_VOID; + public static Biome defaultBeach(float temperature) { if (temperature < 0.25) { return Biomes.SNOWY_BEACH; @@ -61,10 +63,7 @@ public class DefaultBiomes { if (temperature < 0.25) { return Biomes.SNOWY_MOUNTAINS; } - if (temperature > 0.75) { - return DefaultBiome.NONE; - } - return Biomes.MOUNTAINS; + return DefaultBiomes.NONE; } public static Biome defaultBiome(float temperature) { diff --git a/src/main/java/com/terraforged/mod/biome/modifier/MountainModifier.java b/src/main/java/com/terraforged/mod/biome/modifier/MountainModifier.java index f247764..136c78f 100644 --- a/src/main/java/com/terraforged/mod/biome/modifier/MountainModifier.java +++ b/src/main/java/com/terraforged/mod/biome/modifier/MountainModifier.java @@ -3,7 +3,7 @@ package com.terraforged.mod.biome.modifier; import com.terraforged.api.biome.modifier.BiomeModifier; import com.terraforged.core.cell.Cell; import com.terraforged.mod.biome.map.BiomeMap; -import com.terraforged.mod.biome.map.defaults.DefaultBiome; +import com.terraforged.mod.biome.map.defaults.DefaultBiomes; import com.terraforged.mod.chunk.TerraContext; import net.minecraft.world.biome.Biome; @@ -38,7 +38,7 @@ public class MountainModifier implements BiomeModifier { @Override public Biome modify(Biome in, Cell cell, int x, int z) { Biome mountain = biomes.getMountain(cell); - if (mountain != DefaultBiome.NONE) { + if (mountain != DefaultBiomes.NONE) { return mountain; } return in; diff --git a/src/main/java/com/terraforged/mod/chunk/TerraSetupFactory.java b/src/main/java/com/terraforged/mod/chunk/TerraSetupFactory.java index ea8af3e..c65ba2b 100644 --- a/src/main/java/com/terraforged/mod/chunk/TerraSetupFactory.java +++ b/src/main/java/com/terraforged/mod/chunk/TerraSetupFactory.java @@ -9,6 +9,8 @@ import com.terraforged.fm.matcher.feature.FeatureMatcher; import com.terraforged.fm.modifier.FeatureModifiers; import com.terraforged.fm.predicate.DeepWater; import com.terraforged.fm.predicate.FeaturePredicate; +import com.terraforged.fm.predicate.MaxHeight; +import com.terraforged.fm.predicate.MinDepth; import com.terraforged.fm.predicate.MinHeight; import com.terraforged.fm.structure.StructureManager; import com.terraforged.fm.transformer.FeatureTransformer; @@ -105,6 +107,7 @@ public class TerraSetupFactory { // block ugly features modifiers.getPredicates().add(Matchers.sedimentDisks(), FeaturePredicate.DENY); modifiers.getPredicates().add(FeatureMatcher.of(Feature.MINESHAFT), new MinHeight(context.levels.waterY + 20)); + modifiers.getPredicates().add(FeatureMatcher.of(Feature.WOODLAND_MANSION), new MaxHeight(context.levels.waterY + 64)); return FeatureManager.create(SetupHooks.setup(modifiers, context.copy())); } @@ -140,6 +143,7 @@ public class TerraSetupFactory { StructureManager manager = new StructureManager(); manager.register(Structure.OCEAN_MONUMENT, DeepWater.INSTANCE); manager.register(Structure.OCEAN_RUIN, DeepWater.INSTANCE); + manager.register(Structure.SHIPWRECK, new MinDepth(context.levels.waterLevel - 8)); return SetupHooks.setup(manager, context); } diff --git a/src/main/java/com/terraforged/mod/client/gui/page/PresetsPage.java b/src/main/java/com/terraforged/mod/client/gui/page/PresetsPage.java index 8a1c79a..7d510d1 100644 --- a/src/main/java/com/terraforged/mod/client/gui/page/PresetsPage.java +++ b/src/main/java/com/terraforged/mod/client/gui/page/PresetsPage.java @@ -177,19 +177,15 @@ public class PresetsPage extends BasePage { right.scrollPane.addButton(new TerraButton(GuiKeys.PRESET_SET_DEFAULTS.get()) { - @Override - public void render(int x, int z, float ticks) { - super.active = hasSelectedPreset(); - super.render(x, z, ticks); - } - @Override public void onClick(double x, double y) { super.onClick(x, y); - getSelected().ifPresent(preset -> { - TerraSettings settings = preset.getSettings(); - SettingsHelper.exportDefaults(settings); - }); + Optional selected = getSelected(); + if (selected.isPresent()) { + SettingsHelper.exportDefaults(selected.get().getSettings()); + } else { + SettingsHelper.exportDefaults(instance.createCopy()); + } } }); diff --git a/src/main/java/com/terraforged/mod/client/gui/preview/RenderMode.java b/src/main/java/com/terraforged/mod/client/gui/preview/RenderMode.java index 89f5110..d75ef42 100644 --- a/src/main/java/com/terraforged/mod/client/gui/preview/RenderMode.java +++ b/src/main/java/com/terraforged/mod/client/gui/preview/RenderMode.java @@ -76,7 +76,7 @@ public enum RenderMode { return rgba(step(cell.moisture, 8) * 0.65F, saturation, brightness); } }, - BIOME_SHAPE { + BIOME { @Override public int getColor(Cell cell, float scale, float bias) { float saturation = 0.7F; @@ -84,7 +84,7 @@ public enum RenderMode { return rgba(cell.biome, saturation, brightness); } }, - MACRO_NOISE_SHAPE { + MACRO_NOISE { @Override public int getColor(Cell cell, float scale, float bias) { float saturation = 0.7F; @@ -92,12 +92,12 @@ public enum RenderMode { return rgba(cell.macroNoise, saturation, brightness); } }, - REGION_SHAPE { + TERRAIN_REGION { @Override public int getColor(Cell cell, float scale, float bias) { float saturation = 0.7F; float brightness = 0.8F; - return rgba(cell.region, saturation, brightness); + return rgba(cell.terrain.getHue(), saturation, brightness); } }, ; diff --git a/src/main/java/com/terraforged/mod/client/gui/preview2/Preview.java b/src/main/java/com/terraforged/mod/client/gui/preview2/Preview.java index b632080..429702d 100644 --- a/src/main/java/com/terraforged/mod/client/gui/preview2/Preview.java +++ b/src/main/java/com/terraforged/mod/client/gui/preview2/Preview.java @@ -117,6 +117,6 @@ public class Preview extends Widget { renderSettings.zoom = previewSettings.getZoom(ZOOM_SCALE); renderSettings.renderMode = previewSettings.display; - return new RenderWorld(generator, renderAPI, renderSettings, regions, size); + return new RenderWorld(threadPool, generator, renderAPI, renderSettings, regions, size); } }