[Feature] Additional UI Config Options for Nether BiomeSource on the Customize World Screen (quiqueck/BetterNether#62)

This commit is contained in:
Frank 2022-11-16 10:26:31 +01:00
parent 42be3dd2c7
commit 1e968fafc7
4 changed files with 50 additions and 3 deletions

View file

@ -86,6 +86,9 @@ public class BCLNetherBiomeSourceConfig implements BiomeSourceConfig<BCLibNether
public String toString() { public String toString() {
return "BCLibNetherBiomeSourceConfig{" + return "BCLibNetherBiomeSourceConfig{" +
"mapVersion=" + mapVersion + "mapVersion=" + mapVersion +
", useVerticalBiomes=" + useVerticalBiomes +
", biomeSize=" + biomeSize +
", biomeSizeVertical=" + biomeSizeVertical +
'}'; '}';
} }

View file

@ -39,6 +39,8 @@ import org.jetbrains.annotations.Nullable;
public class WorldSetupScreen extends LayoutScreen { public class WorldSetupScreen extends LayoutScreen {
private final WorldCreationContext context; private final WorldCreationContext context;
private final CreateWorldScreen createWorldScreen; private final CreateWorldScreen createWorldScreen;
private Range<Integer> netherBiomeSize;
private Range<Integer> netherVerticalBiomeSize;
private Range<Integer> landBiomeSize; private Range<Integer> landBiomeSize;
private Range<Integer> voidBiomeSize; private Range<Integer> voidBiomeSize;
private Range<Integer> centerBiomeSize; private Range<Integer> centerBiomeSize;
@ -58,6 +60,7 @@ public class WorldSetupScreen extends LayoutScreen {
Checkbox endCustomTerrain; Checkbox endCustomTerrain;
Checkbox generateEndVoid; Checkbox generateEndVoid;
Checkbox netherLegacy; Checkbox netherLegacy;
Checkbox netherVertical;
public LayoutComponent<?, ?> netherPage(BCLNetherBiomeSourceConfig netherConfig) { public LayoutComponent<?, ?> netherPage(BCLNetherBiomeSourceConfig netherConfig) {
VerticalStack content = new VerticalStack(fill(), fit()).centerHorizontal(); VerticalStack content = new VerticalStack(fill(), fit()).centerHorizontal();
@ -75,9 +78,44 @@ public class WorldSetupScreen extends LayoutScreen {
netherConfig.mapVersion == BCLNetherBiomeSourceConfig.NetherBiomeMapType.SQUARE netherConfig.mapVersion == BCLNetherBiomeSourceConfig.NetherBiomeMapType.SQUARE
); );
netherVertical = content.indent(20).addCheckbox(
fit(), fit(),
Component.translatable("title.screen.bclib.worldgen.nether_vertical"),
netherConfig.useVerticalBiomes
);
content.addSpacer(12);
content.addText(fit(), fit(), Component.translatable("title.screen.bclib.worldgen.avg_biome_size"))
.centerHorizontal();
content.addHorizontalSeparator(8).alignTop();
netherBiomeSize = content.addRange(
fixed(200),
fit(),
Component.translatable("title.screen.bclib.worldgen.nether_biome_size"),
1,
512,
netherConfig.biomeSize / 16
);
netherVerticalBiomeSize = content.addRange(
fixed(200),
fit(),
Component.translatable("title.screen.bclib.worldgen.nether_vertical_biome_size"),
1,
32,
netherConfig.biomeSizeVertical / 16
);
bclibNether.onChange((cb, state) -> { bclibNether.onChange((cb, state) -> {
netherLegacy.setEnabled(state); netherLegacy.setEnabled(state);
netherVertical.setEnabled(state);
netherBiomeSize.setEnabled(state);
netherVerticalBiomeSize.setEnabled(state && netherVertical.isChecked());
});
netherVertical.onChange((cb, state) -> {
netherVerticalBiomeSize.setEnabled(state && bclibNether.isChecked());
}); });
content.addSpacer(8); content.addSpacer(8);
@ -231,9 +269,9 @@ public class WorldSetupScreen extends LayoutScreen {
netherLegacy.isChecked() netherLegacy.isChecked()
? BCLNetherBiomeSourceConfig.NetherBiomeMapType.SQUARE ? BCLNetherBiomeSourceConfig.NetherBiomeMapType.SQUARE
: BCLNetherBiomeSourceConfig.NetherBiomeMapType.HEX, : BCLNetherBiomeSourceConfig.NetherBiomeMapType.HEX,
BCLNetherBiomeSourceConfig.DEFAULT.biomeSize, netherBiomeSize.getValue() * 16,
BCLNetherBiomeSourceConfig.DEFAULT.biomeSizeVertical, netherVerticalBiomeSize.getValue() * 16,
BCLNetherBiomeSourceConfig.DEFAULT.useVerticalBiomes netherVertical.isChecked()
); );
ChunkGenerator netherGenerator = betterxDimensions.get(LevelStem.NETHER); ChunkGenerator netherGenerator = betterxDimensions.get(LevelStem.NETHER);

View file

@ -61,6 +61,9 @@
"title.screen.bclib.worldgen.end_void": "Kleine End-Inseln erzeugen", "title.screen.bclib.worldgen.end_void": "Kleine End-Inseln erzeugen",
"title.screen.bclib.worldgen.avg_biome_size": "Durchschnittl. Biome Größe (in Chunks)", "title.screen.bclib.worldgen.avg_biome_size": "Durchschnittl. Biome Größe (in Chunks)",
"title.screen.bclib.worldgen.other": "Sonstiges", "title.screen.bclib.worldgen.other": "Sonstiges",
"title.screen.bclib.worldgen.nether_biome_size": "Größe",
"title.screen.bclib.worldgen.nether_vertical_biome_size": "Biomhöhe",
"title.screen.bclib.worldgen.nether_vertical": "Biome auch vertikal verteilen",
"title.screen.bclib.worldgen.land_biome_size": "Land-Biome", "title.screen.bclib.worldgen.land_biome_size": "Land-Biome",
"title.screen.bclib.worldgen.void_biome_size": "Kleine Inseln", "title.screen.bclib.worldgen.void_biome_size": "Kleine Inseln",
"title.screen.bclib.worldgen.center_biome_size": "Zentralbiome", "title.screen.bclib.worldgen.center_biome_size": "Zentralbiome",

View file

@ -64,6 +64,9 @@
"title.screen.bclib.worldgen.custom_end_terrain": "Custom End Terrain Generator", "title.screen.bclib.worldgen.custom_end_terrain": "Custom End Terrain Generator",
"title.screen.bclib.worldgen.avg_biome_size": "Average Biome Size (in Chunks)", "title.screen.bclib.worldgen.avg_biome_size": "Average Biome Size (in Chunks)",
"title.screen.bclib.worldgen.other": "Other Settings", "title.screen.bclib.worldgen.other": "Other Settings",
"title.screen.bclib.worldgen.nether_biome_size": "Biome Size",
"title.screen.bclib.worldgen.nether_vertical_biome_size": "Biome Height",
"title.screen.bclib.worldgen.nether_vertical": "Generate vertical Biomes",
"title.screen.bclib.worldgen.land_biome_size": "Land Biomes", "title.screen.bclib.worldgen.land_biome_size": "Land Biomes",
"title.screen.bclib.worldgen.void_biome_size": "Small Island Biomes", "title.screen.bclib.worldgen.void_biome_size": "Small Island Biomes",
"title.screen.bclib.worldgen.center_biome_size": "Central Biomes", "title.screen.bclib.worldgen.center_biome_size": "Central Biomes",