more improvements to settings

This commit is contained in:
dags- 2020-06-29 22:55:44 +01:00
parent 95ffc7765f
commit a73058062c
9 changed files with 22 additions and 26 deletions

2
Engine

@ -1 +1 @@
Subproject commit 37a553e45da72353eb608459b195e8f503a3fcab Subproject commit d9dee330393aa0bce3bc69920734d80617c82be2

@ -1 +1 @@
Subproject commit cba0f3516ee9aa2d11b3bd4f0e72277c17c8f39b Subproject commit 0a3012574af66b128b492b26b8389762654a61a2

View File

@ -1,12 +1,9 @@
package com.terraforged.mod.biome.map.defaults; package com.terraforged.mod.biome.map.defaults;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.OceanBiome;
public interface DefaultBiome { public interface DefaultBiome {
Biome NONE = new OceanBiome().setRegistryName("terraforged", "none");
Biome getBiome(float temperature); Biome getBiome(float temperature);
default Biome getDefaultBiome(float temperature) { default Biome getDefaultBiome(float temperature) {

View File

@ -6,6 +6,8 @@ import net.minecraft.world.biome.Biomes;
public class DefaultBiomes { public class DefaultBiomes {
public static final Biome NONE = Biomes.THE_VOID;
public static Biome defaultBeach(float temperature) { public static Biome defaultBeach(float temperature) {
if (temperature < 0.25) { if (temperature < 0.25) {
return Biomes.SNOWY_BEACH; return Biomes.SNOWY_BEACH;
@ -61,10 +63,7 @@ public class DefaultBiomes {
if (temperature < 0.25) { if (temperature < 0.25) {
return Biomes.SNOWY_MOUNTAINS; return Biomes.SNOWY_MOUNTAINS;
} }
if (temperature > 0.75) { return DefaultBiomes.NONE;
return DefaultBiome.NONE;
}
return Biomes.MOUNTAINS;
} }
public static Biome defaultBiome(float temperature) { public static Biome defaultBiome(float temperature) {

View File

@ -3,7 +3,7 @@ package com.terraforged.mod.biome.modifier;
import com.terraforged.api.biome.modifier.BiomeModifier; import com.terraforged.api.biome.modifier.BiomeModifier;
import com.terraforged.core.cell.Cell; import com.terraforged.core.cell.Cell;
import com.terraforged.mod.biome.map.BiomeMap; 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 com.terraforged.mod.chunk.TerraContext;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@ -38,7 +38,7 @@ public class MountainModifier implements BiomeModifier {
@Override @Override
public Biome modify(Biome in, Cell cell, int x, int z) { public Biome modify(Biome in, Cell cell, int x, int z) {
Biome mountain = biomes.getMountain(cell); Biome mountain = biomes.getMountain(cell);
if (mountain != DefaultBiome.NONE) { if (mountain != DefaultBiomes.NONE) {
return mountain; return mountain;
} }
return in; return in;

View File

@ -9,6 +9,8 @@ import com.terraforged.fm.matcher.feature.FeatureMatcher;
import com.terraforged.fm.modifier.FeatureModifiers; import com.terraforged.fm.modifier.FeatureModifiers;
import com.terraforged.fm.predicate.DeepWater; import com.terraforged.fm.predicate.DeepWater;
import com.terraforged.fm.predicate.FeaturePredicate; 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.predicate.MinHeight;
import com.terraforged.fm.structure.StructureManager; import com.terraforged.fm.structure.StructureManager;
import com.terraforged.fm.transformer.FeatureTransformer; import com.terraforged.fm.transformer.FeatureTransformer;
@ -105,6 +107,7 @@ public class TerraSetupFactory {
// block ugly features // block ugly features
modifiers.getPredicates().add(Matchers.sedimentDisks(), FeaturePredicate.DENY); 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.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())); return FeatureManager.create(SetupHooks.setup(modifiers, context.copy()));
} }
@ -140,6 +143,7 @@ public class TerraSetupFactory {
StructureManager manager = new StructureManager(); StructureManager manager = new StructureManager();
manager.register(Structure.OCEAN_MONUMENT, DeepWater.INSTANCE); manager.register(Structure.OCEAN_MONUMENT, DeepWater.INSTANCE);
manager.register(Structure.OCEAN_RUIN, DeepWater.INSTANCE); manager.register(Structure.OCEAN_RUIN, DeepWater.INSTANCE);
manager.register(Structure.SHIPWRECK, new MinDepth(context.levels.waterLevel - 8));
return SetupHooks.setup(manager, context); return SetupHooks.setup(manager, context);
} }

View File

@ -177,19 +177,15 @@ public class PresetsPage extends BasePage {
right.scrollPane.addButton(new TerraButton(GuiKeys.PRESET_SET_DEFAULTS.get()) { 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 @Override
public void onClick(double x, double y) { public void onClick(double x, double y) {
super.onClick(x, y); super.onClick(x, y);
getSelected().ifPresent(preset -> { Optional<Preset> selected = getSelected();
TerraSettings settings = preset.getSettings(); if (selected.isPresent()) {
SettingsHelper.exportDefaults(settings); SettingsHelper.exportDefaults(selected.get().getSettings());
}); } else {
SettingsHelper.exportDefaults(instance.createCopy());
}
} }
}); });

View File

@ -76,7 +76,7 @@ public enum RenderMode {
return rgba(step(cell.moisture, 8) * 0.65F, saturation, brightness); return rgba(step(cell.moisture, 8) * 0.65F, saturation, brightness);
} }
}, },
BIOME_SHAPE { BIOME {
@Override @Override
public int getColor(Cell cell, float scale, float bias) { public int getColor(Cell cell, float scale, float bias) {
float saturation = 0.7F; float saturation = 0.7F;
@ -84,7 +84,7 @@ public enum RenderMode {
return rgba(cell.biome, saturation, brightness); return rgba(cell.biome, saturation, brightness);
} }
}, },
MACRO_NOISE_SHAPE { MACRO_NOISE {
@Override @Override
public int getColor(Cell cell, float scale, float bias) { public int getColor(Cell cell, float scale, float bias) {
float saturation = 0.7F; float saturation = 0.7F;
@ -92,12 +92,12 @@ public enum RenderMode {
return rgba(cell.macroNoise, saturation, brightness); return rgba(cell.macroNoise, saturation, brightness);
} }
}, },
REGION_SHAPE { TERRAIN_REGION {
@Override @Override
public int getColor(Cell cell, float scale, float bias) { public int getColor(Cell cell, float scale, float bias) {
float saturation = 0.7F; float saturation = 0.7F;
float brightness = 0.8F; float brightness = 0.8F;
return rgba(cell.region, saturation, brightness); return rgba(cell.terrain.getHue(), saturation, brightness);
} }
}, },
; ;

View File

@ -117,6 +117,6 @@ public class Preview extends Widget {
renderSettings.zoom = previewSettings.getZoom(ZOOM_SCALE); renderSettings.zoom = previewSettings.getZoom(ZOOM_SCALE);
renderSettings.renderMode = previewSettings.display; renderSettings.renderMode = previewSettings.display;
return new RenderWorld(generator, renderAPI, renderSettings, regions, size); return new RenderWorld(threadPool, generator, renderAPI, renderSettings, regions, size);
} }
} }