From a21ca9922b43b07b01ac49d44f1ec708e215b5e3 Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Fri, 17 May 2024 19:16:14 -0400 Subject: [PATCH] Update BlockRegistryPopulator --- .../populator/BlockRegistryPopulator.java | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) 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 9b7a1b30e..64b466f12 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 @@ -138,7 +138,7 @@ public final class BlockRegistryPopulator { List vanillaBlockStates; List blockStates; try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResourceOrThrow(String.format("bedrock/block_palette.%s.nbt", palette.key())); - NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { + NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { NbtMap blockPalette = (NbtMap) nbtInputStream.readTag(); vanillaBlockStates = new ArrayList<>(blockPalette.getList("blocks", NbtType.COMPOUND)); @@ -260,7 +260,7 @@ public final class BlockRegistryPopulator { bedrockDefinition = customBlockStateDefinitions.get(blockStateOverride); if (bedrockDefinition == null) { throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Custom block override: \n" + - blockStateOverride); + blockStateOverride); } } @@ -409,7 +409,6 @@ public final class BlockRegistryPopulator { Deque cleanIdentifiers = new ArrayDeque<>(); int javaRuntimeId = -1; - int cobwebBlockId = -1; int furnaceRuntimeId = -1; int furnaceLitRuntimeId = -1; int honeyBlockRuntimeId = -1; @@ -417,10 +416,6 @@ public final class BlockRegistryPopulator { int spawnerRuntimeId = -1; int uniqueJavaId = -1; int waterRuntimeId = -1; - int bubbleColumnUpwardRuntimeId = -1; - int bubbleColumnDragRuntimeId = -1; - int soulSandRuntimeId = -1; - int iceRuntimeId = -1; Iterator> blocksIterator = blocksJson.fields(); while (blocksIterator.hasNext()) { javaRuntimeId++; @@ -489,10 +484,7 @@ public final class BlockRegistryPopulator { // It's possible to only have this store differences in names, but the key set of all Java names is used in sending command suggestions BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern()); - if (javaId.contains("cobweb")) { - cobwebBlockId = uniqueJavaId; - - } else if (javaId.startsWith("minecraft:furnace[facing=north")) { + if (javaId.startsWith("minecraft:furnace[facing=north")) { if (javaId.contains("lit=true")) { furnaceLitRuntimeId = javaRuntimeId; } else { @@ -508,24 +500,9 @@ public final class BlockRegistryPopulator { honeyBlockRuntimeId = javaRuntimeId; } else if (javaId.equals("minecraft:slime_block")) { slimeBlockRuntimeId = javaRuntimeId; - } else if (javaId.startsWith("minecraft:bubble_column")) { - if (javaId.contains("drag=true")) { - bubbleColumnDragRuntimeId = javaRuntimeId; - } else { - bubbleColumnUpwardRuntimeId = javaRuntimeId; - } - } else if (javaId.equals("minecraft:soul_sand")) { - soulSandRuntimeId = javaRuntimeId; - } else if (javaId.equals("minecraft:ice")) { - iceRuntimeId = javaRuntimeId; } } - if (cobwebBlockId == -1) { - throw new AssertionError("Unable to find cobwebs in palette"); - } - BlockStateValues.JAVA_COBWEB_ID = cobwebBlockId; - if (furnaceRuntimeId == -1) { throw new AssertionError("Unable to find furnace in palette"); } @@ -570,15 +547,15 @@ public final class BlockRegistryPopulator { int stateRuntimeId = javaBlockState.javaId(); String pistonBehavior = javaBlockState.pistonBehavior(); BlockMapping blockMapping = BlockMapping.builder() - .canBreakWithHand(javaBlockState.canBreakWithHand()) - .pickItem(javaBlockState.pickItem()) - .isNonVanilla(true) - .javaIdentifier(javaId) - .javaBlockId(javaBlockState.stateGroupId()) - .hardness(javaBlockState.blockHardness()) - .pistonBehavior(pistonBehavior == null ? PistonBehavior.NORMAL : PistonBehavior.getByName(pistonBehavior)) - .isBlockEntity(javaBlockState.hasBlockEntity()) - .build(); + .canBreakWithHand(javaBlockState.canBreakWithHand()) + .pickItem(javaBlockState.pickItem()) + .isNonVanilla(true) + .javaIdentifier(javaId) + .javaBlockId(javaBlockState.stateGroupId()) + .hardness(javaBlockState.blockHardness()) + .pistonBehavior(pistonBehavior == null ? PistonBehavior.NORMAL : PistonBehavior.getByName(pistonBehavior)) + .isBlockEntity(javaBlockState.hasBlockEntity()) + .build(); Block.Builder builder = Block.builder() .destroyTime(javaBlockState.blockHardness());