From ddbbb14c72cb7a81edf065a3e6406ce943dd8feb Mon Sep 17 00:00:00 2001 From: Matsv Date: Thu, 19 Jul 2018 11:54:09 +0200 Subject: [PATCH] Correct changed directions for item frames Fixes #874 --- .../packets/EntityPackets.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java index 6ab4ca27a..98c6b5c47 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/EntityPackets.java @@ -40,12 +40,37 @@ public class EntityPackets { byte type = wrapper.get(Type.BYTE, 0); Entity1_13Types.EntityType entType = Entity1_13Types.getTypeFromId(type, true); - if (entType != null && entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) { - int oldId = wrapper.get(Type.INT, 0); - int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15)); - wrapper.set(Type.INT, 0, WorldPackets.toNewId(combined)); - } + if (entType != null) { + if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) { + int oldId = wrapper.get(Type.INT, 0); + int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15)); + wrapper.set(Type.INT, 0, WorldPackets.toNewId(combined)); + } + // Fix ItemFrame hitbox + if (entType.is(Entity1_13Types.EntityType.ITEM_FRAME)) { + int data = wrapper.get(Type.INT, 0); + + switch (data) { + // South + case 0: + data = 3; + break; + // West + case 1: + data = 4; + break; + // North is the same + // East + case 3: + data = 5; + break; + } + + wrapper.set(Type.INT, 0, data); + } + + } // Register Type ID wrapper.user().get(EntityTracker.class).addEntity(entityId, entType); }