From b4f8024eef44b18963ac76b8b13fa2ed3f8a8ffd Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 7 Jul 2021 10:01:22 +0200 Subject: [PATCH] Fix 1.15->1.16 and 1.16.1->1.16.2 dropped items Fixes #2610 --- .../metadata/MetadataRewriter1_16_2To1_16_1.java | 8 ++++---- .../metadata/MetadataRewriter1_16To1_15_2.java | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/metadata/MetadataRewriter1_16_2To1_16_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/metadata/MetadataRewriter1_16_2To1_16_1.java index f18d6c342..8bf9a6226 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/metadata/MetadataRewriter1_16_2To1_16_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/metadata/MetadataRewriter1_16_2To1_16_1.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14; +import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_16; import com.viaversion.viaversion.api.type.types.Particle; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1; import com.viaversion.viaversion.rewriter.EntityRewriter; @@ -39,12 +39,12 @@ public class MetadataRewriter1_16_2To1_16_1 extends EntityRewriter metadatas, UserConnection connection) throws Exception { - if (metadata.metaType() == MetaType1_14.Slot) { + if (metadata.metaType() == MetaType1_16.ITEM) { protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue()); - } else if (metadata.metaType() == MetaType1_14.BlockID) { + } else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) { int data = (int) metadata.getValue(); metadata.setValue(protocol.getMappingData().getNewBlockStateId(data)); - } else if (metadata.metaType() == MetaType1_14.PARTICLE) { + } else if (metadata.metaType() == MetaType1_16.PARTICLE) { rewriteParticle((Particle) metadata.getValue()); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java index 31e994174..17340d892 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14; +import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_16; import com.viaversion.viaversion.api.type.types.Particle; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import com.viaversion.viaversion.rewriter.EntityRewriter; @@ -40,12 +40,13 @@ public class MetadataRewriter1_16To1_15_2 extends EntityRewriter metadatas, UserConnection connection) throws Exception { - if (metadata.metaType() == MetaType1_14.Slot) { + metadata.setMetaType(MetaType1_16.byId(metadata.metaType().typeId())); + if (metadata.metaType() == MetaType1_16.ITEM) { protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue()); - } else if (metadata.metaType() == MetaType1_14.BlockID) { + } else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) { int data = (int) metadata.getValue(); metadata.setValue(protocol.getMappingData().getNewBlockStateId(data)); - } else if (metadata.metaType() == MetaType1_14.PARTICLE) { + } else if (metadata.metaType() == MetaType1_16.PARTICLE) { rewriteParticle((Particle) metadata.getValue()); }