From 02f9e8723363a65db1cdf54ae86c98274d402840 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 1 Dec 2021 17:50:09 +0100 Subject: [PATCH] Fix invisible chests for 1.18 clients on very old servers Fixes #2744 --- .../packets/WorldPackets.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java index 61cc88870..3a9c2f67b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java @@ -118,11 +118,24 @@ public final class WorldPackets { final NumberTag yTag = tag.get("y"); final NumberTag zTag = tag.get("z"); final StringTag idTag = tag.get("id"); - if (xTag == null || yTag == null || zTag == null || idTag == null) { + if (xTag == null || yTag == null || zTag == null) { continue; } - final String id = idTag.getValue(); + final String id; + if (idTag == null) { + // Thank you 1.8, very cool (might have to be moved somewhere else) + if (tag.get("Chest") instanceof StringTag) { + id = "minecraft:chest"; + } else if (tag.get("EnderChest") instanceof StringTag) { + id = "minecraft:ender_chest"; + } else { + continue; + } + } else { + id = idTag.getValue(); + } + final int typeId = protocol.getMappingData().blockEntityIds().getInt(id.replace("minecraft:", "")); if (typeId == -1) { Via.getPlatform().getLogger().warning("Unknown block entity: " + id);