]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - 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
1 package com.irtimaled.bbor.common;
2
3 import com.irtimaled.bbor.common.models.Colors;
4
5 import java.awt.*;
6 import java.util.HashMap;
7 import java.util.Map;
8
9 public class BoundingBoxType {
10     private static final Map<Integer, BoundingBoxType> structureTypeMap = new HashMap<>();
11
12     public static final BoundingBoxType WorldSpawn = register(Color.RED, "World_Spawn");
13     public static final BoundingBoxType SpawnChunks = register(Color.RED, "Spawn_Chunks");
14     public static final BoundingBoxType LazySpawnChunks = register(Color.RED, "Lazy_Chunks");
15     public static final BoundingBoxType MobSpawner = register(Color.GREEN, "Mob_Spawner");
16     public static final BoundingBoxType SlimeChunks = register(Colors.DARK_GREEN, "Slime_Chunks");
17     public static final BoundingBoxType AFKSphere = register(Color.RED, "AFK Sphere");
18     public static final BoundingBoxType BiomeBorder = register(Color.GREEN, "Biome Border");
19     public static final BoundingBoxType Custom = register(Color.WHITE, "Custom");
20     public static final BoundingBoxType Beacon = register(Color.WHITE, "Beacon");
21     public static final BoundingBoxType Conduit = register(Color.CYAN, "Conduit");
22
23     public static final BoundingBoxType JungleTemple = register(Colors.DARK_GREEN, "Jungle_Pyramid");
24     public static final BoundingBoxType DesertTemple = register(Color.ORANGE, "Desert_Pyramid");
25     public static final BoundingBoxType WitchHut = register(Color.BLUE, "Swamp_Hut");
26     public static final BoundingBoxType OceanMonument = register(Color.CYAN, "Monument");
27     public static final BoundingBoxType Shipwreck = register(Color.CYAN, "Shipwreck");
28     public static final BoundingBoxType OceanRuin = register(Color.CYAN, "Ocean_Ruin");
29     public static final BoundingBoxType BuriedTreasure = register(Color.CYAN, "Buried_Treasure");
30     public static final BoundingBoxType Stronghold = register(Color.YELLOW, "Stronghold");
31     public static final BoundingBoxType MineShaft = register(Color.LIGHT_GRAY, "Mineshaft");
32     public static final BoundingBoxType NetherFortress = register(Color.RED, "Fortress");
33     public static final BoundingBoxType EndCity = register(Color.MAGENTA, "EndCity");
34     public static final BoundingBoxType Mansion = register(Colors.BROWN, "Mansion");
35     public static final BoundingBoxType Igloo = register(Color.WHITE, "Igloo");
36     public static final BoundingBoxType PillagerOutpost = register(Color.DARK_GRAY, "Pillager_Outpost");
37     public static final BoundingBoxType Village = register(Colors.PURPLE, "Village");
38     public static final BoundingBoxType VillageSpheres = register(null, "Village Sphere");
39     public static final BoundingBoxType NetherFossil = register(Color.WHITE, "Nether_Fossil");
40     public static final BoundingBoxType BastionRemnant = register(Color.LIGHT_GRAY, "Bastion_Remnant");
41     public static final BoundingBoxType RuinedPortal = register(Colors.COOL_PURPLE, "Ruined_Portal");
42
43     private static BoundingBoxType register(Color color, String name) {
44         BoundingBoxType type = structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(color, name));
45         StructureProcessor.registerSupportedStructure(type);
46         return type;
47     }
48
49     public static BoundingBoxType getByNameHash(Integer nameHash) {
50         return structureTypeMap.get(nameHash);
51     }
52
53     private final Color color;
54     private final String name;
55
56     private BoundingBoxType(Color color, String name) {
57         this.color = color;
58         this.name = name;
59     }
60
61     public Color getColor() {
62         return color;
63     }
64
65     public String getName() {
66         return name;
67     }
68
69     @Override
70     public int hashCode() {
71         return name.hashCode();
72     }
73
74     @Override
75     public boolean equals(Object obj) {
76         if (this == obj) return true;
77         if (obj == null || getClass() != obj.getClass()) return false;
78         BoundingBoxType other = (BoundingBoxType) obj;
79         return this.name.equals(other.name);
80     }
81 }