From da2e802e2949d89d48a2433fdfcc6b7fb98c11a8 Mon Sep 17 00:00:00 2001 From: Matsv Date: Sat, 3 Jun 2017 12:22:47 +0200 Subject: [PATCH] Handle chested horse metadata correctly --- .../packets/EntityPackets.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets.java index 004914c3..043f97ee 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets.java @@ -468,13 +468,28 @@ public class EntityPackets extends EntityRewriter { HORSES */ + // Handle horse flags + registerMetaHandler().filter(EntityType.ABSTRACT_HORSE, true, 13).handle(e -> { + Metadata data = e.getData(); + byte b = (byte) data.getValue(); + Optional chest = e.getMetaByIndex(15); + if (chest.isPresent()) { + boolean hasChest = (boolean) chest.get().getValue(); + if (hasChest) + b |= 0x08; // Chested + + data.setValue(b); + } + return data; + }); + // Handle Horse (Correct owner) registerMetaHandler().filter(EntityType.ABSTRACT_HORSE, true, 14).handleIndexChange(16); // Handle horse armor registerMetaHandler().filter(EntityType.HORSE, 16).handleIndexChange(17); - // Handle chested horse - flag is still sent in horse flags + // Handle chested horse registerMetaHandler().filter(EntityType.CHESTED_HORSE, true, 15).removed(); // Get rid of Liama metadata TODO maybe for some special magic in the future? @@ -504,6 +519,7 @@ public class EntityPackets extends EntityRewriter { 1 - Wither Skeleton 2 - Stray */ + private Metadata getSkeletonTypeMeta(int type) { return new Metadata(12, MetaType1_9.VarInt, type); }