Fix ItemStack packet id limited by short

This commit is contained in:
miozune committed 2023-11-30 00:57:02 +09:00
1 parent 52d522f311
commit d6e2b946b1
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();