]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
Add "Fast Render" option to configure culling behaviors
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / gui / SettingsScreen.java
index 92da9ec6bc8d04ff81c20a5e4e81a33f5b717ca5..a4b135ae57c7473c086773234b65d5f57ac543a6 100644 (file)
@@ -4,8 +4,10 @@ import com.irtimaled.bbor.client.ClientRenderer;
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.irtimaled.bbor.common.BoundingBoxType;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.resources.I18n;
+import net.minecraft.SharedConstants;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
+import net.minecraft.client.resource.language.I18n;
 
 public class SettingsScreen extends ListScreen {
     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).*";
@@ -16,7 +18,7 @@ public class SettingsScreen extends ListScreen {
         ClientInterop.displayScreen(new SettingsScreen(null));
     }
 
-    SettingsScreen(GuiScreen lastScreen) {
+    SettingsScreen(Screen lastScreen) {
         super(lastScreen);
     }
 
@@ -27,14 +29,19 @@ public class SettingsScreen extends ListScreen {
     }
 
     @Override
-    protected void setup() {
-        String version = this.mc.getVersion();
-        ControlList controlList = this.getControlList();
-        if (this.mc.world != null) controlList.setTransparentBackground();
+    protected ControlList buildList(int top, int bottom) {
+        String version = SharedConstants.getGameVersion().getName();
+        ControlList controlList = new ControlList(this.width, this.height, top, bottom);
+        if (this.client.world != null) controlList.setTransparentBackground();
 
         controlList
                 .section(null,
-                        (x, width) -> new BoolButton(width, I18n.format("bbor.options.active"), this.mc.world != null) {
+                        width -> new BoolButton(width, I18n.translate("bbor.options.active"), this.client.world != null) {
+                            @Override
+                            public void appendNarrations(NarrationMessageBuilder narrationMessageBuilder) {
+                                this.appendDefaultNarrations(narrationMessageBuilder);
+                            }
+
                             @Override
                             public void onPressed() {
                                 ClientRenderer.toggleActive();
@@ -45,66 +52,74 @@ public class SettingsScreen extends ListScreen {
                                 return ClientRenderer.getActive();
                             }
                         },
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.options.fill"), ConfigManager.fill))
-                .section(I18n.format("bbor.features.spawnChunks"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
-                        (x, width) -> new MaxYSettingSlider(width, 39, ConfigManager.worldSpawnMaxY))
-                .section(I18n.format("bbor.features.slimeChunks"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
-                        (x, width) -> new MaxYSettingSlider(width, 39, ConfigManager.slimeChunkMaxY))
-                .section(I18n.format("bbor.features.biomeBorders"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
-                        (x, width) -> new MaxYSettingSlider(width, 1, ConfigManager.biomeBordersMaxY),
-                        (x, width) -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.biomeBordersRenderDistance)
-                                .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
-                                .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
-                                .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
-                .section(I18n.format("bbor.features.mobSpawners"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
-                .section(I18n.format("bbor.sections.beaconsAndConduits"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.beacons"), BoundingBoxType.Beacon),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.conduits"), BoundingBoxType.Conduit),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
-                .section(I18n.format("bbor.features.spawningSpheres"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.spawningSpheres.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks),
-                        (x, width) -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.afkSpawnableBlocksRenderDistance)
-                                .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
-                                .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
-                                .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
-                .section(I18n.format("bbor.tabs.structures"),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mansions"), BoundingBoxType.Mansion),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.igloos"), BoundingBoxType.Igloo),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.villages"), BoundingBoxType.Village),
-                        (x, width) -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
-                        (x, width) -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
-                        (x, width) -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
-                        (x, width) -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity))
-                .section(I18n.format("bbor.tabs.villages"),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres"), ConfigManager.drawVillageSpheres),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.doorLines"), ConfigManager.drawVillageDoors),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.golemSpawn"), ConfigManager.drawIronGolemSpawnArea),
-                        (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.dotSize", ConfigManager.villageSphereDotSize),
-                        (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.density", ConfigManager.villageSphereDensity)
-                                .addDisplayValue(1, I18n.format("bbor.features.villageSpheres.density.fewest"))
-                                .addDisplayValue(2, I18n.format("bbor.features.villageSpheres.density.fewer"))
-                                .addDisplayValue(3, I18n.format("bbor.features.villageSpheres.density.normal"))
-                                .addDisplayValue(4, I18n.format("bbor.features.villageSpheres.density.more"))
-                                .addDisplayValue(5, I18n.format("bbor.features.villageSpheres.density.most")));
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.options.fill"), ConfigManager.fill),
+                        width -> new IntSettingSlider(width, 0, 2, "bbor.options.fastRender", ConfigManager.fastRender)
+                                .addDisplayValue(0, I18n.translate("bbor.options.fastRender.0"))
+                                .addDisplayValue(1, I18n.translate("bbor.options.fastRender.1"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.fastRender.2")))
+                .section(I18n.translate("bbor.features.spawnChunks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
+                        width -> new MaxYSettingSlider(width, 39, ConfigManager.worldSpawnMaxY))
+                .section(I18n.translate("bbor.features.slimeChunks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
+                        width -> new MaxYSettingSlider(width, 39, ConfigManager.slimeChunkMaxY))
+                .section(I18n.translate("bbor.features.biomeBorders"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
+                        width -> new MaxYSettingSlider(width, 1, ConfigManager.biomeBordersMaxY),
+                        width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.biomeBordersRenderDistance)
+                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
+                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
+                .section(I18n.translate("bbor.features.flowerForests"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
+                        width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.flowerForestsRenderDistance)
+                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
+                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
+                .section(I18n.translate("bbor.features.bedrockCeilingBlocks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.bedrockCeilingBlocks"), BoundingBoxType.BedrockCeiling))
+                .section(I18n.translate("bbor.features.mobSpawners"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
+                .section(I18n.translate("bbor.sections.beaconsAndConduits"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.beacons"), BoundingBoxType.Beacon),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.conduits"), BoundingBoxType.Conduit),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
+                .section(I18n.translate("bbor.features.spawnableBlocks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawnableBlocks"), BoundingBoxType.SpawnableBlocks),
+                        width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.y", ConfigManager.spawnableBlocksRenderHeight)
+                                .addDisplayValue(1, "2")
+                                .addDisplayValue(2, "4")
+                                .addDisplayValue(3, "8"),
+                        width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.xz", ConfigManager.spawnableBlocksRenderWidth)
+                                .addDisplayValue(1, "8")
+                                .addDisplayValue(2, "16")
+                                .addDisplayValue(3, "32"))
+                .section(I18n.translate("bbor.features.spawningSpheres"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
+                .section(I18n.translate("bbor.tabs.structures"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mansions"), BoundingBoxType.Mansion),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.igloos"), BoundingBoxType.Igloo),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.villages"), BoundingBoxType.Village),
+                        width -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
+                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
+                        width -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
+                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.endCities"), BoundingBoxType.EndCity));
+        return controlList;
     }
 }