1 package com.irtimaled.bbor.client.gui;
3 import com.irtimaled.bbor.client.ClientRenderer;
4 import com.irtimaled.bbor.client.config.ConfigManager;
5 import com.irtimaled.bbor.client.interop.ClientInterop;
6 import com.irtimaled.bbor.common.BoundingBoxType;
7 import net.minecraft.client.gui.screen.Screen;
8 import net.minecraft.client.resources.I18n;
9 import net.minecraft.util.SharedConstants;
11 public class SettingsScreen extends ListScreen {
12 private static final String pillagerOutpostVersionPattern = "(?:1\\.1[4-9]|1\\.[2-9][0-9]|18w(?:4[7-9]|5[0-9])|19w|2[0-9]w).*";
13 private static final String bastionRemnantVersionPattern = "(?:1\\.1[6-9]|1\\.[2-9][0-9]|20w(?:1[6-9]|[2-5][0-9])|2[1-9]w).*";
14 private static final String netherFossilVersionPattern = "(?:1\\.1[6-9]|1\\.[2-9][0-9]|20w(?:1[1-9]|[2-5][0-9])|2[1-9]w).*";
16 public static void show() {
17 ClientInterop.displayScreen(new SettingsScreen(null));
20 SettingsScreen(Screen lastScreen) {
25 protected void onDoneClicked() {
26 ConfigManager.saveConfig();
27 super.onDoneClicked();
31 protected ControlList buildList(int top, int bottom) {
32 String version = SharedConstants.getVersion().getName();
33 ControlList controlList = new ControlList(this.width, this.height, top, bottom);
34 if (this.minecraft.world != null) controlList.setTransparentBackground();
38 width -> new BoolButton(width, I18n.format("bbor.options.active"), this.minecraft.world != null) {
40 public void onPressed() {
41 ClientRenderer.toggleActive();
45 protected boolean getValue() {
46 return ClientRenderer.getActive();
49 width -> new BoolSettingButton(width, I18n.format("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
50 width -> new BoolSettingButton(width, I18n.format("bbor.options.fill"), ConfigManager.fill))
51 .section(I18n.format("bbor.features.spawnChunks"),
52 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
53 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
54 width -> new MaxYSettingSlider(width, 39, ConfigManager.worldSpawnMaxY))
55 .section(I18n.format("bbor.features.slimeChunks"),
56 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
57 width -> new MaxYSettingSlider(width, 39, ConfigManager.slimeChunkMaxY))
58 .section(I18n.format("bbor.features.biomeBorders"),
59 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
60 width -> new MaxYSettingSlider(width, 1, ConfigManager.biomeBordersMaxY),
61 width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.biomeBordersRenderDistance)
62 .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
63 .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
64 .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
65 .section(I18n.format("bbor.features.mobSpawners"),
66 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
67 width -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
68 width -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
69 .section(I18n.format("bbor.sections.beaconsAndConduits"),
70 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.beacons"), BoundingBoxType.Beacon),
71 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.conduits"), BoundingBoxType.Conduit),
72 width -> new BoolSettingButton(width, I18n.format("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
73 .section(I18n.format("bbor.features.spawnableBlocks"),
74 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnableBlocks"), BoundingBoxType.SpawnableBlocks),
75 width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.y", ConfigManager.spawnableBlocksRenderHeight)
76 .addDisplayValue(1, "2")
77 .addDisplayValue(2, "4")
78 .addDisplayValue(3, "8"),
79 width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.xz", ConfigManager.spawnableBlocksRenderWidth)
80 .addDisplayValue(1, "8")
81 .addDisplayValue(2, "16")
82 .addDisplayValue(3, "32"))
83 .section(I18n.format("bbor.features.spawningSpheres"),
84 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
85 width -> new BoolSettingButton(width, I18n.format("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
86 .section(I18n.format("bbor.tabs.structures"),
87 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
88 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
89 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
90 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mansions"), BoundingBoxType.Mansion),
91 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
92 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.igloos"), BoundingBoxType.Igloo),
93 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
94 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
95 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
96 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
97 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
98 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.villages"), BoundingBoxType.Village),
99 width -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
100 width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
101 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
102 width -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
103 width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
104 width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity));