1 package com.irtimaled.bbor.common;
3 import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
4 import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
6 import java.util.HashMap;
9 public class BoundingBoxType {
10 private static final Map<Integer, BoundingBoxType> structureTypeMap = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
12 public static final BoundingBoxType WorldSpawn = register("World_Spawn");
13 public static final BoundingBoxType SpawnChunks = register("Spawn_Chunks");
14 public static final BoundingBoxType LazySpawnChunks = register("Lazy_Chunks");
15 public static final BoundingBoxType MobSpawner = register("Mob_Spawner");
16 public static final BoundingBoxType SlimeChunks = register("Slime_Chunks");
17 public static final BoundingBoxType AFKSphere = register("AFK Sphere");
18 public static final BoundingBoxType BiomeBorder = register("Biome Border");
19 public static final BoundingBoxType Custom = register("Custom");
20 public static final BoundingBoxType Beacon = register("Beacon");
21 public static final BoundingBoxType Conduit = register("Conduit");
22 public static final BoundingBoxType SpawnableBlocks = register("Spawnable Blocks");
23 public static final BoundingBoxType FlowerForest = register("Flower Forest");
24 public static final BoundingBoxType BedrockCeiling = register("Bedrock Ceiling");
26 public static final Map<String, BoundingBoxType> structures = new HashMap<>();
28 public static BoundingBoxType register(String name) {
29 return structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(name));
32 public static void registerTypes() {
33 structureTypeMap.values().forEach(StructureProcessor::registerSupportedStructure);
36 public static BoundingBoxType getByNameHash(Integer nameHash) {
37 return structureTypeMap.get(nameHash);
40 private final String name;
42 private BoundingBoxType(String name) {
46 public String getName() {
51 public int hashCode() {
52 return name.hashCode();
56 public boolean equals(Object obj) {
57 if (this == obj) return true;
58 if (obj == null || getClass() != obj.getClass()) return false;
59 BoundingBoxType other = (BoundingBoxType) obj;
60 return this.name.equals(other.name);