Fix body set equipment in 1.20.5->.3 if value is not the last (#886)

This commit is contained in:
EnZaXD 2024-09-15 19:17:45 +02:00 committed by GitHub
parent 733bd9aa9b
commit 36baf6ed24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -26,7 +26,6 @@ import com.viaversion.viabackwards.protocol.v1_20_2to1_20.Protocol1_20_2To1_20;
import com.viaversion.viabackwards.protocol.v1_20_2to1_20.provider.AdvancementCriteriaProvider;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.ChunkPosition;
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;

View File

@ -77,9 +77,12 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
do {
slot = wrapper.read(Types.BYTE);
final Item item = protocol.getItemRewriter().handleItemToClient(wrapper.user(), wrapper.read(Types1_20_5.ITEM));
final int rawSlot = slot & 0x7F;
if (rawSlot == 6) {
final boolean lastSlot = (slot & 0xFFFFFF80) == 0;
slot = (byte) (lastSlot ? 4 : 4 | 0xFFFFFF80); // Map body slot index to chest slot index for horses, also wolves
if (slot == 6) {
slot = 4; // 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
wrapper.cancel();
@ -89,7 +92,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
wrapper.write(Types.BYTE, slot);
wrapper.write(Types.ITEM1_20_2, item);
} while (slot < 0);
} while ((slot & 0xFFFFFF80) != 0);
});
protocol.registerClientbound(ClientboundPackets1_20_5.HORSE_SCREEN_OPEN, wrapper -> {