Skip to content

Commit

Permalink
use original client values
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Sep 15, 2024
1 parent 5e4b5a5 commit 3665eef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ protected void registerPackets() {
do {
slot = wrapper.read(Types.BYTE);
Item item = handleItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_13_2));
int rawSlot = slot & Byte.MAX_VALUE;
int rawSlot = slot & 127;
equipmentData.add(new EquipmentData(rawSlot, item));
} while ((slot & Byte.MIN_VALUE) != 0);
} while ((slot & -128) != 0);

// Send first data in the current packet
EquipmentData firstData = equipmentData.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void register() {
do {
slot = wrapper.passthrough(Types.BYTE);
wrapper.write(Types.ITEM1_13_2, handleItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_20_2)));
} while ((slot & Byte.MIN_VALUE) != 0);
} while ((slot & -128) != 0);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public void registerPackets() {
do {
slot = wrapper.read(Types.BYTE);
final Item item = protocol.getItemRewriter().handleItemToClient(wrapper.user(), wrapper.read(Types1_20_5.ITEM));
final int rawSlot = slot & Byte.MAX_VALUE;
final int rawSlot = slot & 127;

if (rawSlot == 6) {
final boolean lastSlot = (slot & Byte.MIN_VALUE) == 0;
slot = (byte) (lastSlot ? 4 : 4 | Byte.MIN_VALUE); // Map body slot index to chest slot index for horses, also wolves
final boolean lastSlot = (slot & -128) == 0;
slot = (byte) (lastSlot ? 4 : 4 | -128); // Map body slot index to chest slot index for horses, also wolves

if (type != null && type.isOrHasParent(EntityTypes1_20_5.LLAMA)) {
// Cancel equipment and set correct entity data instead
Expand All @@ -92,7 +92,7 @@ public void registerPackets() {

wrapper.write(Types.BYTE, slot);
wrapper.write(Types.ITEM1_20_2, item);
} while ((slot & Byte.MIN_VALUE) != 0);
} while ((slot & -128) != 0);
});

protocol.registerClientbound(ClientboundPackets1_20_5.HORSE_SCREEN_OPEN, wrapper -> {
Expand Down

0 comments on commit 3665eef

Please sign in to comment.