]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
Fully stop needing config on BoundingBoxType
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / common / BoundingBoxType.java
index 559df88849bf198a5a9478f09f014832c722df9a..ecb128717388ecb4a3af7f53ae743da7e8709662 100644 (file)
@@ -1,8 +1,6 @@
 package com.irtimaled.bbor.common;
 
 import com.irtimaled.bbor.common.models.Colors;
-import com.irtimaled.bbor.config.ConfigManager;
-import com.irtimaled.bbor.config.Setting;
 
 import java.awt.*;
 import java.util.HashMap;
@@ -11,38 +9,39 @@ import java.util.Map;
 public class BoundingBoxType {
     private static final Map<Integer, BoundingBoxType> structureTypeMap = new HashMap<>();
 
-    public static final BoundingBoxType JungleTemple = register(Colors.DARK_GREEN, "Jungle_Pyramid", ConfigManager.drawJungleTemples);
-    public static final BoundingBoxType DesertTemple = register(Color.ORANGE, "Desert_Pyramid", ConfigManager.drawDesertTemples);
-    public static final BoundingBoxType WitchHut = register(Color.BLUE, "Swamp_Hut", ConfigManager.drawWitchHuts);
-    public static final BoundingBoxType OceanMonument = register(Color.CYAN, "Monument", ConfigManager.drawOceanMonuments);
-    public static final BoundingBoxType Shipwreck = register(Color.CYAN, "Shipwreck", ConfigManager.drawShipwrecks);
-    public static final BoundingBoxType OceanRuin = register(Color.CYAN, "Ocean_Ruin", ConfigManager.drawOceanRuins);
-    public static final BoundingBoxType BuriedTreasure = register(Color.CYAN, "Buried_Treasure", ConfigManager.drawBuriedTreasure);
-    public static final BoundingBoxType Stronghold = register(Color.YELLOW, "Stronghold", ConfigManager.drawStrongholds);
-    public static final BoundingBoxType MineShaft = register(Color.LIGHT_GRAY, "Mineshaft", ConfigManager.drawMineShafts);
-    public static final BoundingBoxType NetherFortress = register(Color.RED, "Fortress", ConfigManager.drawNetherFortresses);
-    public static final BoundingBoxType EndCity = register(Color.MAGENTA, "EndCity", ConfigManager.drawEndCities);
-    public static final BoundingBoxType Mansion = register(Colors.BROWN, "Mansion", ConfigManager.drawMansions);
-    public static final BoundingBoxType Igloo = register(Color.WHITE, "Igloo", ConfigManager.drawIgloos);
-    public static final BoundingBoxType PillagerOutpost = register(Color.DARK_GRAY, "Pillager_Outpost", ConfigManager.drawPillagerOutposts);
-    public static final BoundingBoxType WorldSpawn = register(Color.RED, "World_Spawn", ConfigManager.drawWorldSpawn);
-    public static final BoundingBoxType SpawnChunks = register(Color.RED, "Spawn_Chunks", ConfigManager.drawWorldSpawn);
-    public static final BoundingBoxType LazySpawnChunks = register(Color.RED, "Lazy_Chunks", ConfigManager.drawLazySpawnChunks);
-    public static final BoundingBoxType MobSpawner = register(Color.GREEN, "Mob_Spawner", ConfigManager.drawMobSpawners);
-    public static final BoundingBoxType SlimeChunks = register(Colors.DARK_GREEN, "Slime_Chunks", ConfigManager.drawSlimeChunks);
-    public static final BoundingBoxType Village = register(Colors.PURPLE, "Village", ConfigManager.drawVillages);
-    public static final BoundingBoxType VillageSpheres = register(null, "Village Sphere", ConfigManager.drawVillageSpheres);
-    public static final BoundingBoxType AFKSphere = register(Color.RED, "AFK Sphere", ConfigManager.drawAFKSpheres);
-    public static final BoundingBoxType BiomeBorder = register(Color.GREEN, "Biome Border", ConfigManager.drawBiomeBorders);
-    public static final BoundingBoxType Beacon = register(Color.WHITE, "Beacon", ConfigManager.drawBeacons);
-    public static final BoundingBoxType NetherFossil = register(Color.WHITE, "Nether_Fossil", ConfigManager.drawNetherFossils);
-    public static final BoundingBoxType BastionRemnant = register(Color.LIGHT_GRAY, "Bastion_Remnant", ConfigManager.drawBastionRemnants);
-    public static final BoundingBoxType RuinedPortal = register(Colors.COOL_PURPLE, "Ruined_Portal", ConfigManager.drawRuinedPortals);
-    public static final BoundingBoxType Conduit = register(Color.CYAN, "Conduit", ConfigManager.drawConduits);
-    public static final BoundingBoxType Custom = register(Color.WHITE, "Custom", ConfigManager.drawCustomBoxes);
+    public static final BoundingBoxType WorldSpawn = register(Color.RED, "World_Spawn");
+    public static final BoundingBoxType SpawnChunks = register(Color.RED, "Spawn_Chunks");
+    public static final BoundingBoxType LazySpawnChunks = register(Color.RED, "Lazy_Chunks");
+    public static final BoundingBoxType MobSpawner = register(Color.GREEN, "Mob_Spawner");
+    public static final BoundingBoxType SlimeChunks = register(Colors.DARK_GREEN, "Slime_Chunks");
+    public static final BoundingBoxType AFKSphere = register(Color.RED, "AFK Sphere");
+    public static final BoundingBoxType BiomeBorder = register(Color.GREEN, "Biome Border");
+    public static final BoundingBoxType Custom = register(Color.WHITE, "Custom");
+    public static final BoundingBoxType Beacon = register(Color.WHITE, "Beacon");
+    public static final BoundingBoxType Conduit = register(Color.CYAN, "Conduit");
 
-    private static BoundingBoxType register(Color color, String name, Setting<Boolean> shouldRenderSetting) {
-        BoundingBoxType type = structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(color, name, shouldRenderSetting));
+    public static final BoundingBoxType JungleTemple = register(Colors.DARK_GREEN, "Jungle_Pyramid");
+    public static final BoundingBoxType DesertTemple = register(Color.ORANGE, "Desert_Pyramid");
+    public static final BoundingBoxType WitchHut = register(Color.BLUE, "Swamp_Hut");
+    public static final BoundingBoxType OceanMonument = register(Color.CYAN, "Monument");
+    public static final BoundingBoxType Shipwreck = register(Color.CYAN, "Shipwreck");
+    public static final BoundingBoxType OceanRuin = register(Color.CYAN, "Ocean_Ruin");
+    public static final BoundingBoxType BuriedTreasure = register(Color.CYAN, "Buried_Treasure");
+    public static final BoundingBoxType Stronghold = register(Color.YELLOW, "Stronghold");
+    public static final BoundingBoxType MineShaft = register(Color.LIGHT_GRAY, "Mineshaft");
+    public static final BoundingBoxType NetherFortress = register(Color.RED, "Fortress");
+    public static final BoundingBoxType EndCity = register(Color.MAGENTA, "EndCity");
+    public static final BoundingBoxType Mansion = register(Colors.BROWN, "Mansion");
+    public static final BoundingBoxType Igloo = register(Color.WHITE, "Igloo");
+    public static final BoundingBoxType PillagerOutpost = register(Color.DARK_GRAY, "Pillager_Outpost");
+    public static final BoundingBoxType Village = register(Colors.PURPLE, "Village");
+    public static final BoundingBoxType VillageSpheres = register(null, "Village Sphere");
+    public static final BoundingBoxType NetherFossil = register(Color.WHITE, "Nether_Fossil");
+    public static final BoundingBoxType BastionRemnant = register(Color.LIGHT_GRAY, "Bastion_Remnant");
+    public static final BoundingBoxType RuinedPortal = register(Colors.COOL_PURPLE, "Ruined_Portal");
+
+    private static BoundingBoxType register(Color color, String name) {
+        BoundingBoxType type = structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(color, name));
         StructureProcessor.registerSupportedStructure(type);
         return type;
     }
@@ -53,12 +52,10 @@ public class BoundingBoxType {
 
     private final Color color;
     private final String name;
-    public final Setting<Boolean> shouldRenderSetting;
 
-    private BoundingBoxType(Color color, String name, Setting<Boolean> shouldRenderSetting) {
+    private BoundingBoxType(Color color, String name) {
         this.color = color;
         this.name = name;
-        this.shouldRenderSetting = shouldRenderSetting;
     }
 
     public Color getColor() {
@@ -69,7 +66,16 @@ public class BoundingBoxType {
         return name;
     }
 
-    public Boolean shouldRender() {
-        return shouldRenderSetting.get();
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null || getClass() != obj.getClass()) return false;
+        BoundingBoxType other = (BoundingBoxType) obj;
+        return this.name.equals(other.name);
     }
 }