Reapply "Fix ItemStack packet id limited by short" (#23) (#37) (#41)

This commit is contained in:
boubou19 authored and GitHub committed 2025-12-07 16:17:57 +00:00
1 parent bb008a1265
commit 63f36ca383
1 file changed
+3 -3
@@ -351,9 +351,9 @@ public final class PacketCustom implements MCDataInput, MCDataOutput {
public PacketCustom writeItemStack(ItemStack stack, boolean large) {
if (stack == null) {
writeShort(-1);
writeInt(-1);
} else {
writeShort(Item.getIdFromItem(stack.getItem()));
writeInt(Item.getIdFromItem(stack.getItem()));
if (large) writeInt(stack.stackSize);
else writeByte(stack.stackSize);
writeShort(stack.getItemDamage());
@@ -448,7 +448,7 @@ public final class PacketCustom implements MCDataInput, MCDataOutput {
public ItemStack readItemStack(boolean large) {
ItemStack item = null;
short itemID = readShort();
int itemID = readInt();
if (itemID >= 0) {
int stackSize = large ? readInt() : readByte();