diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java index c63234010..4e648f65e 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/metadata/MetadataRewriter1_13To1_12_2.java @@ -43,6 +43,14 @@ public class MetadataRewriter1_13To1_12_2 extends MetadataRewriter { } } + // Remap held block to match new format for remapping to flat block + if (type == Entity1_13Types.EntityType.ENDERMAN && metadata.getId() == 12) { + int stateId = (int) metadata.getValue(); + int id = stateId & 4095; + int data = stateId >> 12 & 15; + metadata.setValue((id << 4) | (data & 0xF)); + } + // 1.13 changed item to flat item (no data) if (metadata.getMetaType() == MetaType1_13.Slot) { metadata.setMetaType(MetaType1_13.Slot); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java index 2c5c19c2a..1769c6a8f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetaIndex.java @@ -68,8 +68,8 @@ public enum MetaIndex { // villager VILLAGER_PROFESSION(VILLAGER, 16, MetaType1_8.Int, 12, MetaType1_9.VarInt), // enderman - ENDERMAN_BLOCK(ENDERMAN, 16, MetaType1_8.Short, 11, MetaType1_9.BlockID), // special case - ENDERMAN_BLOCKDATA(ENDERMAN, 17, MetaType1_8.Byte, 11, MetaType1_9.BlockID), // special case + ENDERMAN_BLOCKSTATE(ENDERMAN, 16, MetaType1_8.Short, 11, MetaType1_9.BlockID), + ENDERMAN_BLOCKDATA(ENDERMAN, 17, MetaType1_8.Byte, MetaType1_9.Discontinued), //always 0 when sent, never read by the client ENDERMAN_ISSCREAMING(ENDERMAN, 18, MetaType1_8.Byte, 12, MetaType1_9.Boolean), // zombie ZOMBIE_ISCHILD(ZOMBIE, 12, MetaType1_8.Byte, 11, MetaType1_9.Boolean), diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetadataRewriter1_9To1_8.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetadataRewriter1_9To1_8.java index 94d4a5b09..4fab7b1cb 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetadataRewriter1_9To1_8.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/metadata/MetadataRewriter1_9To1_8.java @@ -39,19 +39,6 @@ public class MetadataRewriter1_9To1_8 extends MetadataRewriter { metadata.setId(metaIndex.getNewIndex()); metadata.setMetaType(metaIndex.getNewType()); - if (type == Entity1_10Types.EntityType.ENDERMAN && metaIndex.getNewType() == MetaType1_9.BlockID) { - if (metaIndex.getOldType() == MetaType1_8.Short) { - int id = (Short) metadata.getValue(); - Metadata meta = getMetaByIndex(17, metadatas); - int data = meta != null ? (Byte) meta.getValue() : 0; - int combined = (id << 4) | (data & 0xF); - metadata.setValue(combined); - } else { - metadatas.remove(metadata); - } - return; - } - Object value = metadata.getValue(); switch (metaIndex.getNewType()) { case Byte: @@ -124,6 +111,10 @@ public class MetadataRewriter1_9To1_8 extends MetadataRewriter { value = Protocol1_9To1_8.fixJson(value.toString()); metadata.setValue(value); break; + case BlockID: + // Convert from int, short, byte + metadata.setValue(((Number) value).intValue()); + break; default: metadatas.remove(metadata); throw new Exception("Unhandled MetaDataType: " + metaIndex.getNewType());