mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-25 18:07:45 +01:00
Read set slot inv id as unsigned byte for consistency
This commit is contained in:
parent
5cdaabeaec
commit
48f1300908
@ -31,7 +31,7 @@ public class InventoryPackets {
|
|||||||
protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class InventoryPackets extends ItemRewriter<Protocol1_13To1_12_2> {
|
|||||||
protocol.registerClientbound(ClientboundPackets1_12_1.SET_SLOT, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_12_1.SET_SLOT, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(Type.ITEM, Type.FLAT_ITEM); // 2 - Slot Value
|
map(Type.ITEM, Type.FLAT_ITEM); // 2 - Slot Value
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class InventoryPackets {
|
|||||||
protocol.registerClientbound(ClientboundPackets1_8.SET_SLOT, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_8.SET_SLOT, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(Type.ITEM); // 2 - Slot Value
|
map(Type.ITEM); // 2 - Slot Value
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -123,7 +123,7 @@ public class InventoryPackets {
|
|||||||
EntityTracker1_9 entityTracker = wrapper.user().getEntityTracker(Protocol1_9To1_8.class);
|
EntityTracker1_9 entityTracker = wrapper.user().getEntityTracker(Protocol1_9To1_8.class);
|
||||||
|
|
||||||
short slotID = wrapper.get(Type.SHORT, 0);
|
short slotID = wrapper.get(Type.SHORT, 0);
|
||||||
short windowId = wrapper.get(Type.BYTE, 0);
|
short windowId = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||||
|
|
||||||
// Store item in slot
|
// Store item in slot
|
||||||
inventoryTracker.setItemId(windowId, slotID, stack == null ? 0 : stack.identifier());
|
inventoryTracker.setItemId(windowId, slotID, stack == null ? 0 : stack.identifier());
|
||||||
|
@ -70,7 +70,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(type); // 2 - Slot Value
|
map(type); // 2 - Slot Value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user