From 720391907eb215450c56aa3ff16f7f0388d90cbd Mon Sep 17 00:00:00 2001 From: mdxd44 Date: Fri, 29 Nov 2024 02:45:28 +0900 Subject: [PATCH] fix readItemStack 1.13-1.13.1 --- .../limboapi/injection/tablist/RewritingTabList.java | 1 + .../limboapi/protocol/packets/s2c/ChunkDataPacket.java | 2 +- .../elytrium/limboapi/protocol/util/LimboProtocolUtils.java | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingTabList.java b/plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingTabList.java index 5d68b7b3..1a4febc2 100644 --- a/plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingTabList.java +++ b/plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingTabList.java @@ -38,6 +38,7 @@ default TabListEntry rewriteEntry(TabListEntry entry) { .tabList(entry.getTabList()) .profile(new GameProfile(this.rewriteUuid(profileId), profile.getName(), profile.getProperties())) .chatSession(entry.getChatSession()) + .displayName(entry.getDisplayNameComponent().orElse(null)) .latency(entry.getLatency()) .gameMode(entry.getGameMode()) .listed(entry.isListed()) diff --git a/plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkDataPacket.java b/plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkDataPacket.java index a2812ded..843b49b4 100644 --- a/plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkDataPacket.java +++ b/plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkDataPacket.java @@ -383,7 +383,7 @@ private static void write17(ByteBuf out, ByteBuf data) { } } - // In <=1.12.2 are still block entities, while on higher versions it's just blockstates + // In <=1.12.2 flower pots are still block entities, while on higher versions it's just blockstates public static List getAdditionalFlowerPots(ChunkSnapshot chunk) { List flowerPots = null; VirtualBlockEntity flowerPot = null; diff --git a/plugin/src/main/java/net/elytrium/limboapi/protocol/util/LimboProtocolUtils.java b/plugin/src/main/java/net/elytrium/limboapi/protocol/util/LimboProtocolUtils.java index ecaf1ba0..32d15270 100644 --- a/plugin/src/main/java/net/elytrium/limboapi/protocol/util/LimboProtocolUtils.java +++ b/plugin/src/main/java/net/elytrium/limboapi/protocol/util/LimboProtocolUtils.java @@ -559,6 +559,11 @@ public static ItemStack readItemStack(ByteBuf buf, ProtocolVersion version, bool return buf.readBoolean() ? new ItemStack(ProtocolUtils.readVarInt(buf), buf.readByte(), LimboProtocolUtils.readCompoundTagOrNull(buf, version)) : LimboProtocolUtils.emptyItemStack(allowEmpty); + } else if (version.noLessThan(ProtocolVersion.MINECRAFT_1_13)) { + short material = buf.readShort(); + return material >= 0 + ? new ItemStack(material, buf.readByte(), LimboProtocolUtils.readCompoundTagOrNull(buf, version)) + : LimboProtocolUtils.emptyItemStack(allowEmpty); } else { short material = buf.readShort(); return material >= 0