From 48f13009083f3d4aef877256180156c32603a906 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Fri, 18 Jun 2021 16:59:34 +0200 Subject: [PATCH] Read set slot inv id as unsigned byte for consistency --- .../protocol1_13_2to1_13_1/packets/InventoryPackets.java | 2 +- .../protocol1_13to1_12_2/packets/InventoryPackets.java | 2 +- .../protocols/protocol1_9to1_8/packets/InventoryPackets.java | 4 ++-- .../java/com/viaversion/viaversion/rewriter/ItemRewriter.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_2to1_13_1/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_2to1_13_1/packets/InventoryPackets.java index f9ca2746f..2a21704c5 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_2to1_13_1/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13_2to1_13_1/packets/InventoryPackets.java @@ -31,7 +31,7 @@ public class InventoryPackets { protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() { @Override public void registerMap() { - map(Type.BYTE); // 0 - Window ID + map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.SHORT); // 1 - Slot ID map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index dbc826b66..b07a7e0d1 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -61,7 +61,7 @@ public class InventoryPackets extends ItemRewriter { protocol.registerClientbound(ClientboundPackets1_12_1.SET_SLOT, new PacketRemapper() { @Override public void registerMap() { - map(Type.BYTE); // 0 - Window ID + map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.SHORT); // 1 - Slot ID map(Type.ITEM, Type.FLAT_ITEM); // 2 - Slot Value diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java index 35e9aefae..8256285a1 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/InventoryPackets.java @@ -106,7 +106,7 @@ public class InventoryPackets { protocol.registerClientbound(ClientboundPackets1_8.SET_SLOT, new PacketRemapper() { @Override public void registerMap() { - map(Type.BYTE); // 0 - Window ID + map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.SHORT); // 1 - Slot ID map(Type.ITEM); // 2 - Slot Value handler(new PacketHandler() { @@ -123,7 +123,7 @@ public class InventoryPackets { EntityTracker1_9 entityTracker = wrapper.user().getEntityTracker(Protocol1_9To1_8.class); short slotID = wrapper.get(Type.SHORT, 0); - short windowId = wrapper.get(Type.BYTE, 0); + short windowId = wrapper.get(Type.UNSIGNED_BYTE, 0); // Store item in slot inventoryTracker.setItemId(windowId, slotID, stack == null ? 0 : stack.identifier()); diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java index 315d90111..900c4b2e6 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java @@ -70,7 +70,7 @@ public abstract class ItemRewriter extends RewriterBase i protocol.registerClientbound(packetType, new PacketRemapper() { @Override public void registerMap() { - map(Type.BYTE); // 0 - Window ID + map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.SHORT); // 1 - Slot ID map(type); // 2 - Slot Value