Skip to content

Commit 00b74ef

Browse files
Update container id types
1 parent 8d5b348 commit 00b74ef

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

common/src/main/java/com/viaversion/viarewind/protocol/v1_8to1_7_6_10/rewriter/BlockItemPacketRewriter1_8.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ protected void registerPackets() {
8181
protocol.registerClientbound(ClientboundPackets1_8.CONTAINER_SET_SLOT, new PacketHandlers() {
8282
@Override
8383
public void register() {
84-
map(Types.UNSIGNED_BYTE); // Window id
84+
map(Types.BYTE); // Window id
8585
map(Types.SHORT); // Slot
8686

8787
handler(wrapper -> {
88-
final short windowType = wrapper.user().get(InventoryTracker.class).get(wrapper.get(Types.UNSIGNED_BYTE, 0));
88+
final short windowType = wrapper.user().get(InventoryTracker.class).get(wrapper.get(Types.BYTE, 0));
8989
final short slot = wrapper.get(Types.SHORT, 0);
9090
if (windowType == 4) { // Enchantment Table
9191
if (slot == 1) {
@@ -100,7 +100,7 @@ public void register() {
100100
handler(wrapper -> handleItemToClient(wrapper.user(), wrapper.get(RewindTypes.COMPRESSED_NBT_ITEM, 0)));
101101

102102
handler(wrapper -> {
103-
final short windowId = wrapper.get(Types.UNSIGNED_BYTE, 0);
103+
final byte windowId = wrapper.get(Types.BYTE, 0);
104104
if (windowId != 0) {
105105
return;
106106
}
@@ -232,10 +232,10 @@ public void register() {
232232
protocol.registerServerbound(ServerboundPackets1_7_2_5.CONTAINER_CLICK, new PacketHandlers() {
233233
@Override
234234
public void register() {
235-
map(Types.BYTE, Types.UNSIGNED_BYTE); // Window id
235+
map(Types.BYTE); // Window id
236236
map(Types.SHORT); // Slot
237237
handler(wrapper -> {
238-
final short windowId = wrapper.get(Types.UNSIGNED_BYTE, 0); // Window id
238+
final byte windowId = wrapper.get(Types.BYTE, 0); // Window id
239239
final short slot = wrapper.get(Types.SHORT, 0);
240240

241241
final short windowType = wrapper.user().get(InventoryTracker.class).get(windowId);

common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected void registerPackets() {
107107
});
108108

109109
protocol.registerClientbound(ClientboundPackets1_9.CONTAINER_SET_SLOT, wrapper -> {
110-
final byte windowId = wrapper.passthrough(Types.UNSIGNED_BYTE).byteValue();
110+
final byte windowId = wrapper.passthrough(Types.BYTE);
111111
final short slot = wrapper.passthrough(Types.SHORT);
112112
final Item item = wrapper.passthrough(Types.ITEM1_8);
113113

@@ -138,15 +138,15 @@ protected void registerPackets() {
138138
protocol.registerServerbound(ServerboundPackets1_8.CONTAINER_CLICK, new PacketHandlers() {
139139
@Override
140140
public void register() {
141-
map(Types.UNSIGNED_BYTE); // Window id
141+
map(Types.BYTE); // Window id
142142
map(Types.SHORT); // Slot
143143
map(Types.BYTE); // Button
144144
map(Types.SHORT); // Action number
145145
map(Types.BYTE, Types.VAR_INT); // Mode
146146
map(Types.ITEM1_8); // Clicked item
147147
handler(wrapper -> handleItemToServer(wrapper.user(), wrapper.get(Types.ITEM1_8, 0)));
148148
handler(wrapper -> {
149-
final short windowId = wrapper.get(Types.UNSIGNED_BYTE, 0);
149+
final byte windowId = wrapper.get(Types.BYTE, 0);
150150
final String windowType = wrapper.user().get(WindowTracker.class).get(windowId);
151151

152152
if (windowType != null && windowType.equalsIgnoreCase("minecraft:brewing_stand")) {

common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/storage/WindowTracker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static void updateBrewingStand(UserConnection user, Item blazePowder, sho
103103
Item[] items = user.get(WindowTracker.class).getBrewingItems(windowId);
104104
for (int i = 0; i < items.length; i++) {
105105
PacketWrapper setSlot = PacketWrapper.create(ClientboundPackets1_8.CONTAINER_SET_SLOT, user);
106-
setSlot.write(Types.UNSIGNED_BYTE, windowId);
106+
setSlot.write(Types.BYTE, (byte) windowId);
107107
setSlot.write(Types.SHORT, (short) i);
108108
setSlot.write(Types.ITEM1_8, items[i]);
109109
setSlot.scheduleSend(Protocol1_9To1_8.class);

0 commit comments

Comments
 (0)