diff --git a/core/src/main/java/org/geysermc/geyser/level/block/GeyserCustomBlockData.java b/core/src/main/java/org/geysermc/geyser/level/block/GeyserCustomBlockData.java index a7085c3e8..de97d38d4 100644 --- a/core/src/main/java/org/geysermc/geyser/level/block/GeyserCustomBlockData.java +++ b/core/src/main/java/org/geysermc/geyser/level/block/GeyserCustomBlockData.java @@ -49,8 +49,7 @@ public class GeyserCustomBlockData implements CustomBlockData { Map> properties; List permutations; - @EqualsAndHashCode.Exclude // Otherwise this will a StackOverflowError in hashCode/equals - CustomBlockState defaultBlockState; + Map defaultProperties; private GeyserCustomBlockData(CustomBlockDataBuilder builder) { this.name = builder.name; @@ -60,10 +59,9 @@ public class GeyserCustomBlockData implements CustomBlockData { this.components = builder.components; - Object2ObjectMap defaultProperties; if (!builder.properties.isEmpty()) { this.properties = Object2ObjectMaps.unmodifiable(new Object2ObjectArrayMap<>(builder.properties)); - defaultProperties = new Object2ObjectOpenHashMap<>(this.properties.size()); + Object2ObjectMap defaultProperties = new Object2ObjectOpenHashMap<>(this.properties.size()); for (CustomBlockProperty property : properties.values()) { if (property.values().isEmpty() || property.values().size() > 16) { throw new IllegalStateException(property.name() + " must contain 1 to 16 values."); @@ -73,10 +71,10 @@ public class GeyserCustomBlockData implements CustomBlockData { } defaultProperties.put(property.name(), property.values().get(0)); } - this.defaultBlockState = new GeyserCustomBlockState(this, Object2ObjectMaps.unmodifiable(defaultProperties)); + this.defaultProperties = Object2ObjectMaps.unmodifiable(defaultProperties); } else { this.properties = Object2ObjectMaps.emptyMap(); - this.defaultBlockState = new GeyserCustomBlockState(this, Object2ObjectMaps.emptyMap()); + this.defaultProperties = Object2ObjectMaps.emptyMap(); } if (!builder.permutations.isEmpty()) { @@ -113,7 +111,7 @@ public class GeyserCustomBlockData implements CustomBlockData { @Override public @NonNull CustomBlockState defaultBlockState() { - return defaultBlockState; + return new GeyserCustomBlockState(this, defaultProperties); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index d88985df2..fadc21dae 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -111,13 +111,6 @@ public class BlockRegistryPopulator { } private static void generateCustomBlockStates(CustomBlockData customBlock, List blockStates, List customExtBlockStates, int stateVersion) { - if (customBlock.properties().isEmpty()) { - blockStates.add(NbtMap.builder() - .putString("name", customBlock.identifier()) - .putInt("version", stateVersion) - .putCompound("states", NbtMap.EMPTY) - .build()); - } int totalPermutations = 1; for (CustomBlockProperty property : customBlock.properties().values()) { totalPermutations *= property.values().size();