Don't forget to rewrite item in set cursor and set player inventory

This commit is contained in:
Nassim Jahnke 2024-11-08 17:25:40 +01:00
parent 8cb285db69
commit 3a67be7fe5
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -82,8 +82,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem
wrapper.write(Types.UNSIGNED_BYTE, (short) -1); // Player inventory wrapper.write(Types.UNSIGNED_BYTE, (short) -1); // Player inventory
wrapper.write(Types.VAR_INT, wrapper.user().get(InventoryStateIdStorage.class).stateId()); // State id; re-use the last known one wrapper.write(Types.VAR_INT, wrapper.user().get(InventoryStateIdStorage.class).stateId()); // State id; re-use the last known one
wrapper.write(Types.SHORT, (short) -1); // Cursor wrapper.write(Types.SHORT, (short) -1); // Cursor
final Item item = wrapper.passthrough(Types1_21_2.ITEM); passthroughClientboundItem(wrapper);
handleItemToClient(wrapper.user(), item);
}); });
protocol.registerClientbound(ClientboundPackets1_21_2.OPEN_SCREEN, wrapper -> { protocol.registerClientbound(ClientboundPackets1_21_2.OPEN_SCREEN, wrapper -> {
@ -168,6 +167,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem
wrapper.write(Types.VAR_INT, 0); // 0 state id wrapper.write(Types.VAR_INT, 0); // 0 state id
final int slot = wrapper.read(Types.VAR_INT); final int slot = wrapper.read(Types.VAR_INT);
wrapper.write(Types.SHORT, (short) slot); wrapper.write(Types.SHORT, (short) slot);
passthroughClientboundItem(wrapper);
}); });
protocol.registerClientbound(ClientboundPackets1_21_2.EXPLODE, wrapper -> { protocol.registerClientbound(ClientboundPackets1_21_2.EXPLODE, wrapper -> {