Skip to content

Commit

Permalink
Fix Item Frame ID
Browse files Browse the repository at this point in the history
  • Loading branch information
hevav committed Dec 25, 2023
1 parent b2396be commit 1c93575
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 1c93575

Please sign in to comment.