Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 08:10:09 +01:00
Fix CONTAINER_SET_SLOT translation (#9)
Dieser Commit ist enthalten in:
Ursprung
886be3161e
Commit
093acc519e
@ -108,8 +108,23 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_21.CONTAINER_SET_SLOT, wrapper -> {
|
||||
updateContainerId(wrapper);
|
||||
final int containerId = wrapper.get(Types.VAR_INT, 0);
|
||||
if (containerId == -1) { // cursor item
|
||||
wrapper.setPacketType(ClientboundPackets1_21_2.SET_CURSOR_ITEM);
|
||||
wrapper.resetReader();
|
||||
wrapper.read(Types.VAR_INT); // container id
|
||||
wrapper.read(Types.VAR_INT); // State id
|
||||
wrapper.read(Types.SHORT); // Slot id
|
||||
} else if (containerId == -2) { // cursor item
|
||||
wrapper.setPacketType(ClientboundPackets1_21_2.SET_PLAYER_INVENTORY);
|
||||
wrapper.resetReader();
|
||||
wrapper.read(Types.VAR_INT); // container id
|
||||
wrapper.read(Types.VAR_INT); // State id
|
||||
wrapper.write(Types.VAR_INT, (int) wrapper.read(Types.SHORT)); // Slot id
|
||||
} else {
|
||||
wrapper.passthrough(Types.VAR_INT); // State id
|
||||
wrapper.passthrough(Types.SHORT); // Slot id
|
||||
}
|
||||
passthroughClientboundItem(wrapper);
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_21.CONTAINER_CLOSE, this::updateContainerId);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren