From 6f53c069ead745c7e469167de23436b8939d1955 Mon Sep 17 00:00:00 2001 From: RK_01 <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:43:48 +0200 Subject: [PATCH] Fix 1.12 -> 1.13 held enderman block translation (#3781) --- .../metadata/MetadataRewriter1_13To1_12_2.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java index 07b64f3d7..1edfe1cb0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java @@ -40,7 +40,12 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter Types1_13.META_TYPES.byId(typeId > 4 ? typeId + 1 : typeId)); filter().metaType(Types1_13.META_TYPES.itemType).handler(((event, meta) -> protocol.getItemRewriter().handleItemToClient(meta.value()))); - filter().metaType(Types1_13.META_TYPES.blockStateType).handler(((event, meta) -> meta.setValue(WorldPackets.toNewId(meta.value())))); + filter().metaType(Types1_13.META_TYPES.blockStateType).handler(((event, meta) -> { + int oldId = meta.value(); + int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15)); + int newId = WorldPackets.toNewId(combined); + meta.setValue(newId); + })); // Previously unused, now swimming filter().index(0).handler((event, meta) -> meta.setValue((byte) ((byte) meta.getValue() & ~0x10))); @@ -53,14 +58,6 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter { - // Remap held block to match new format for remapping to flat block - int stateId = meta.value(); - int id = stateId & 4095; - int data = stateId >> 12 & 15; - meta.setValue((id << 4) | (data & 0xF)); - }); - filter().type(EntityTypes1_13.EntityType.WOLF).index(17).handler((event, meta) -> { // Handle new colors meta.setValue(15 - (int) meta.getValue()); @@ -108,4 +105,4 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter