From 1c935754c02d57a836430b3573856ee90d53e63c Mon Sep 17 00:00:00 2001 From: Petr Ilin Date: Tue, 26 Dec 2023 01:13:22 +0300 Subject: [PATCH] Fix Item Frame ID --- .../limbofilter/protocol/data/EntityMetadata.java | 15 +-------------- .../limbofilter/protocol/data/ItemFrame.java | 4 +++- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/elytrium/limbofilter/protocol/data/EntityMetadata.java b/src/main/java/net/elytrium/limbofilter/protocol/data/EntityMetadata.java index 5d8347d..16b24f6 100644 --- a/src/main/java/net/elytrium/limbofilter/protocol/data/EntityMetadata.java +++ b/src/main/java/net/elytrium/limbofilter/protocol/data/EntityMetadata.java @@ -20,11 +20,8 @@ import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufOutputStream; -import io.netty.handler.codec.EncoderException; import java.util.Map; import net.elytrium.limboapi.api.material.VirtualItem; -import net.kyori.adventure.nbt.BinaryTagTypes; import net.kyori.adventure.nbt.CompoundBinaryTag; public class EntityMetadata { @@ -88,17 +85,7 @@ public void encode(ByteBuf buf, ProtocolVersion protocolVersion) { buf.writeByte(0); } } else { - if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) { - ProtocolUtils.writeBinaryTag(buf, protocolVersion, this.nbt); - } else { - // TODO: remove then the ProtocolUtils::writeCompoundTag will support 1.20.2 - try (ByteBufOutputStream output = new ByteBufOutputStream(buf)) { - output.writeByte(BinaryTagTypes.COMPOUND.id()); - BinaryTagTypes.COMPOUND.write(this.nbt, output); - } catch (Throwable throwable) { - throw new EncoderException("Unable to encode NBT CompoundTag"); - } - } + ProtocolUtils.writeBinaryTag(buf, protocolVersion, this.nbt); } } } diff --git a/src/main/java/net/elytrium/limbofilter/protocol/data/ItemFrame.java b/src/main/java/net/elytrium/limbofilter/protocol/data/ItemFrame.java index 9f2600c..1bfc4c9 100644 --- a/src/main/java/net/elytrium/limbofilter/protocol/data/ItemFrame.java +++ b/src/main/java/net/elytrium/limbofilter/protocol/data/ItemFrame.java @@ -41,8 +41,10 @@ public static int getID(ProtocolVersion protocolVersion) { return 45; } else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_3) <= 0) { return 46; - } else { + } else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_20_2) <= 0) { return 56; + } else { + return 57; } }