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.GuiScreen;
8 import net.minecraft.client.resources.I18n;
10 public class SettingsScreen extends ListScreen {
11 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).*";
12 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).*";
13 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).*";
15 public static void show() {
16 ClientInterop.displayScreen(new SettingsScreen(null));
19 SettingsScreen(GuiScreen lastScreen) {
24 protected void onDoneClicked() {
25 ConfigManager.saveConfig();
26 super.onDoneClicked();
30 protected void setup() {
31 String version = this.mc.getVersion();
32 ControlList controlList = this.getControlList();
33 if (this.mc.world != null) controlList.setTransparentBackground();
37 (x, width) -> new BoolButton(width, I18n.format("bbor.options.active"), this.mc.world != null) {
39 public void onPressed() {
40 ClientRenderer.toggleActive();
44 protected boolean getValue() {
45 return ClientRenderer.getActive();
48 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
49 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.options.fill"), ConfigManager.fill))
50 .section(I18n.format("bbor.features.spawnChunks"),
51 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
52 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
53 (x, width) -> new MaxYSettingSlider(width, 39, ConfigManager.worldSpawnMaxY))
54 .section(I18n.format("bbor.features.slimeChunks"),
55 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
56 (x, width) -> new MaxYSettingSlider(width, 39, ConfigManager.slimeChunkMaxY))
57 .section(I18n.format("bbor.features.biomeBorders"),
58 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
59 (x, width) -> new MaxYSettingSlider(width, 1, ConfigManager.biomeBordersMaxY),
60 (x, width) -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.biomeBordersRenderDistance)
61 .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
62 .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
63 .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
64 .section(I18n.format("bbor.features.mobSpawners"),
65 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
66 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
67 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
68 .section(I18n.format("bbor.sections.beaconsAndConduits"),
69 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.beacons"), BoundingBoxType.Beacon),
70 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.conduits"), BoundingBoxType.Conduit),
71 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
72 .section(I18n.format("bbor.features.spawnableBlocks"),
73 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnableBlocks"), BoundingBoxType.SpawnableBlocks),
74 (x, width) -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.y", ConfigManager.spawnableBlocksRenderHeight)
75 .addDisplayValue(1, "2")
76 .addDisplayValue(2, "4")
77 .addDisplayValue(3, "8"),
78 (x, width) -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.xz", ConfigManager.spawnableBlocksRenderWidth)
79 .addDisplayValue(1, "8")
80 .addDisplayValue(2, "16")
81 .addDisplayValue(3, "32"))
82 .section(I18n.format("bbor.features.spawningSpheres"),
83 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
84 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
85 .section(I18n.format("bbor.tabs.structures"),
86 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
87 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
88 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
89 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mansions"), BoundingBoxType.Mansion),
90 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
91 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.igloos"), BoundingBoxType.Igloo),
92 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
93 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
94 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
95 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
96 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
97 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.villages"), BoundingBoxType.Village),
98 (x, width) -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
99 (x, width) -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
100 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
101 (x, width) -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
102 (x, width) -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
103 (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity))
104 .section(I18n.format("bbor.tabs.villages"),
105 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres"), ConfigManager.drawVillageSpheres),
106 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.doorLines"), ConfigManager.drawVillageDoors),
107 (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.golemSpawn"), ConfigManager.drawIronGolemSpawnArea),
108 (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.dotSize", ConfigManager.villageSphereDotSize),
109 (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.density", ConfigManager.villageSphereDensity)
110 .addDisplayValue(1, I18n.format("bbor.features.villageSpheres.density.fewest"))
111 .addDisplayValue(2, I18n.format("bbor.features.villageSpheres.density.fewer"))
112 .addDisplayValue(3, I18n.format("bbor.features.villageSpheres.density.normal"))
113 .addDisplayValue(4, I18n.format("bbor.features.villageSpheres.density.more"))
114 .addDisplayValue(5, I18n.format("bbor.features.villageSpheres.density.most")));