diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java index 856bc3f0..4ca0d38e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java @@ -23,6 +23,7 @@ import com.viaversion.viabackwards.api.rewriters.SoundRewriter; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.protocol.v1_21_2to1_21.rewriter.BlockItemPacketRewriter1_21_2; import com.viaversion.viabackwards.protocol.v1_21_2to1_21.rewriter.EntityPacketRewriter1_21_2; +import com.viaversion.viabackwards.protocol.v1_21_2to1_21.storage.InventoryStateIdStorage; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; @@ -108,6 +109,7 @@ public final class Protocol1_21_2To1_21 extends BackwardsProtocol { updateContainerId(wrapper); - wrapper.passthrough(Types.VAR_INT); // State id - Item[] items = wrapper.read(itemArrayType()); + + final int stateId = wrapper.passthrough(Types.VAR_INT); + wrapper.user().get(InventoryStateIdStorage.class).setStateId(stateId); + + final Item[] items = wrapper.read(itemArrayType()); wrapper.write(mappedItemArrayType(), items); for (int i = 0; i < items.length; i++) { items[i] = handleItemToClient(wrapper.user(), items[i]); @@ -101,7 +104,10 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem }); protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_SET_SLOT, wrapper -> { updateContainerId(wrapper); - wrapper.passthrough(Types.VAR_INT); // State id + + final int stateId = wrapper.passthrough(Types.VAR_INT); + wrapper.user().get(InventoryStateIdStorage.class).setStateId(stateId); + wrapper.passthrough(Types.SHORT); // Slot id passthroughClientboundItem(wrapper); });