3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +02:00

Fix entity equipment packet for 1.9+ clients (#1449)

Dieser Commit ist enthalten in:
Nassim 2019-09-10 18:09:11 +02:00 committet von Myles
Ursprung 8b6b3c77e4
Commit 3c436c0259

Datei anzeigen

@ -140,7 +140,15 @@ public class EntityPackets {
// 1 - Slot ID
map(Type.SHORT, new ValueTransformer<Short, Integer>(Type.VAR_INT) {
@Override
public Integer transform(PacketWrapper wrapper, Short slot) {
public Integer transform(PacketWrapper wrapper, Short slot) throws Exception {
int entityId = wrapper.get(Type.VAR_INT, 0);
int receiverId = wrapper.user().get(EntityTracker.class).getEntityID();
// Normally, 0 = hand and 1-4 = armor
// ... but if the sent id is equal to the receiver's id, 0-3 will instead mark the armor slots
// (In 1.9+, every client treats the received the same: 0=hand, 1=offhand, 2-5=armor)
if (entityId == receiverId) {
return slot.intValue() + 2;
}
return slot > 0 ? slot.intValue() + 1 : slot.intValue();
}
});