Handle set_player_inventory

This commit is contained in:
Nassim Jahnke 2024-12-04 15:23:56 +01:00
parent 5e9d213082
commit 17a73dff82
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 8 additions and 0 deletions

View File

@ -65,6 +65,7 @@ public final class BlockItemPacketRewriter1_21_4 extends StructuredItemRewriter<
protocol.cancelServerbound(ServerboundPackets1_21_4.PICK_ITEM_FROM_ENTITY);
protocol.registerClientbound(ClientboundPackets1_21_2.SET_CURSOR_ITEM, this::passthroughClientboundItem);
registerSetPlayerInventory(ClientboundPackets1_21_2.SET_PLAYER_INVENTORY);
registerCooldown1_21_2(ClientboundPackets1_21_2.COOLDOWN);
registerSetContent1_21_2(ClientboundPackets1_21_2.CONTAINER_SET_CONTENT);
registerSetSlot1_21_2(ClientboundPackets1_21_2.CONTAINER_SET_SLOT);

View File

@ -231,6 +231,13 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
});
}
public void registerSetPlayerInventory(C packetType) {
protocol.registerClientbound(packetType, wrapper -> {
wrapper.passthrough(Types.VAR_INT); // Slot
passthroughClientboundItem(wrapper);
});
}
public void registerCooldown(C packetType) {
protocol.registerClientbound(packetType, wrapper -> {
int itemId = wrapper.read(Types.VAR_INT);