diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java index 6c6f6867e..cef85579f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java @@ -174,10 +174,10 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { final byte containerId = wrapper.read(Types.VAR_INT).byteValue(); final byte buttonId = wrapper.read(Types.VAR_INT).byteValue(); @@ -1597,4 +1597,4 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { + final int entityId = wrapper.passthrough(Types.VAR_INT); // Entity id + final EntityType type = tracker(wrapper.user()).entityType(entityId); + + byte slot; + do { + slot = wrapper.read(Types.BYTE); + if (type != null && type.isOrHasParent(EntityTypes1_20_5.ABSTRACT_HORSE) && slot == 4) { + slot = 6; // Map chest slot index to body slot index for horses + } + wrapper.write(Types.BYTE, slot); + Item item = protocol.getItemRewriter().handleItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_20_2)); + wrapper.write(Types1_20_5.ITEM, item); + } while (slot < 0); + }); + protocol.registerClientbound(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, wrapper -> { final PacketWrapper knownPacksPacket = wrapper.create(ClientboundConfigurationPackets1_20_5.SELECT_KNOWN_PACKS); knownPacksPacket.write(Types.VAR_INT, 0); // No known packs, everything is sent here @@ -430,7 +447,23 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { + // Carpet color removed - now set via the set equipment packet + final int dataIndex = event.index(); + if (dataIndex == 20) { + event.cancel(); + final int color = data.value(); + + // Convert dyed color id to carpet item id + final PacketWrapper setEquipment = PacketWrapper.create(ClientboundPackets1_20_5.SET_EQUIPMENT, event.user()); + setEquipment.write(Types.VAR_INT, event.entityId()); + setEquipment.write(Types.BYTE, (byte) 6); + setEquipment.write(Types1_20_5.ITEM, new StructuredItem(color + 446, 1, new StructuredDataContainer())); + setEquipment.scheduleSend(Protocol1_20_3To1_20_5.class); + } else if (dataIndex > 20) { + event.setIndex(dataIndex - 1); + } + }); filter().type(EntityTypes1_20_5.AREA_EFFECT_CLOUD).handler((event, data) -> { // Color removed - Now put into the actual particle final int dataIndex = event.index(); @@ -510,4 +543,4 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter