make ocean palette optional

This commit is contained in:
dfsek 2021-12-31 23:46:44 -07:00
parent 039e45ef97
commit aa5ccd0196
2 changed files with 18 additions and 5 deletions

View File

@ -53,7 +53,7 @@ public class NoiseChunkGenerator3DAddon implements AddonInitializer {
.register(addon, ConfigurationLoadEvent.class)
.then(event -> {
if(event.is(Biome.class)) {
event.getLoadedObject(Biome.class).getContext().put(event.load(new BiomePaletteTemplate()).get());
event.getLoadedObject(Biome.class).getContext().put(event.load(new BiomePaletteTemplate(platform)).get());
event.getLoadedObject(Biome.class).getContext().put(event.load(new BiomeNoiseConfigTemplate()).get());
}
})

View File

@ -21,11 +21,15 @@ import java.util.TreeMap;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolderBuilder;
import com.dfsek.terra.addons.chunkgenerator.palette.SlantHolder;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.meta.Meta;
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
public class BiomePaletteTemplate implements ObjectTemplate<PaletteInfo> {
private final Platform platform;
@Value("slant")
@Default
@Description("The slant palettes to use in this biome.")
@ -41,12 +45,21 @@ public class BiomePaletteTemplate implements ObjectTemplate<PaletteInfo> {
private @Meta List<@Meta Map<@Meta Palette, @Meta Integer>> palettes;
@Value("ocean.level")
@Description("Sea level in this biome.")
private @Meta int seaLevel;
@Description("Sea level in this biome. Defaults to zero")
@Default
private @Meta int seaLevel = 0;
@Value("ocean.palette")
@Description("The palette to use for the ocean in this biome.")
private @Meta Palette oceanPalette;
@Description("The palette to use for the ocean in this biome. Defaults to a blank palette.")
@Default
private @Meta Palette oceanPalette = new Palette() {
@Override
public BlockState get(int layer, double x, double y, double z, long seed) {
return platform.getWorldHandle().air();
}
};
public BiomePaletteTemplate(Platform platform) { this.platform = platform; }
@Override
public PaletteInfo get() {