]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
Add support for spawnable blocks rendering
[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     public static final BoundingBoxType SpawnableBlocks = register(Color.RED, "Spawnable Blocks");
23
24     public static final BoundingBoxType JungleTemple = register(Colors.DARK_GREEN, "Jungle_Pyramid");
25     public static final BoundingBoxType DesertTemple = register(Color.ORANGE, "Desert_Pyramid");
26     public static final BoundingBoxType WitchHut = register(Color.BLUE, "Swamp_Hut");
27     public static final BoundingBoxType OceanMonument = register(Color.CYAN, "Monument");
28     public static final BoundingBoxType Shipwreck = register(Color.CYAN, "Shipwreck");
29     public static final BoundingBoxType OceanRuin = register(Color.CYAN, "Ocean_Ruin");
30     public static final BoundingBoxType BuriedTreasure = register(Color.CYAN, "Buried_Treasure");
31     public static final BoundingBoxType Stronghold = register(Color.YELLOW, "Stronghold");
32     public static final BoundingBoxType MineShaft = register(Color.LIGHT_GRAY, "Mineshaft");
33     public static final BoundingBoxType NetherFortress = register(Color.RED, "Fortress");
34     public static final BoundingBoxType EndCity = register(Color.MAGENTA, "EndCity");
35     public static final BoundingBoxType Mansion = register(Colors.BROWN, "Mansion");
36     public static final BoundingBoxType Igloo = register(Color.WHITE, "Igloo");
37     public static final BoundingBoxType PillagerOutpost = register(Color.DARK_GRAY, "Pillager_Outpost");
38     public static final BoundingBoxType Village = register(Colors.PURPLE, "Village");
39     public static final BoundingBoxType VillageSpheres = register(null, "Village Sphere");
40     public static final BoundingBoxType NetherFossil = register(Color.WHITE, "Nether_Fossil");
41     public static final BoundingBoxType BastionRemnant = register(Color.LIGHT_GRAY, "Bastion_Remnant");
42     public static final BoundingBoxType RuinedPortal = register(Colors.COOL_PURPLE, "Ruined_Portal");
43
44     private static BoundingBoxType register(Color color, String name) {
45         BoundingBoxType type = structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(color, name));
46         StructureProcessor.registerSupportedStructure(type);
47         return type;
48     }
49
50     public static BoundingBoxType getByNameHash(Integer nameHash) {
51         return structureTypeMap.get(nameHash);
52     }
53
54     private final Color color;
55     private final String name;
56
57     private BoundingBoxType(Color color, String name) {
58         this.color = color;
59         this.name = name;
60     }
61
62     public Color getColor() {
63         return color;
64     }
65
66     public String getName() {
67         return name;
68     }
69
70     @Override
71     public int hashCode() {
72         return name.hashCode();
73     }
74
75     @Override
76     public boolean equals(Object obj) {
77         if (this == obj) return true;
78         if (obj == null || getClass() != obj.getClass()) return false;
79         BoundingBoxType other = (BoundingBoxType) obj;
80         return this.name.equals(other.name);
81     }
82 }