From 43ebe3c3e35e84b97eea2b0a3292bfb4946ec330 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 7 Jul 2021 10:15:32 +0200 Subject: [PATCH] Fix 1.17->1.16 and 1.16.2->1.16.1 meta types --- .../packets/EntityPackets1_16.java | 2 ++ .../packets/EntityPackets1_16_2.java | 8 ++++---- .../packets/EntityPackets1_17.java | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java index 7e55440a..2f7bf5de 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/packets/EntityPackets1_16.java @@ -248,6 +248,8 @@ public class EntityPackets1_16 extends EntityRewriter { @Override protected void registerRewrites() { filter().handler((event, meta) -> { + meta.setMetaType(MetaType1_14.byId(meta.metaType().typeId())); + MetaType type = meta.metaType(); if (type == MetaType1_14.Slot) { meta.setValue(protocol.getItemRewriter().handleItemToClient((Item) meta.getValue())); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java index 2bccecca..28c906c7 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java @@ -23,10 +23,10 @@ import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; -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.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.version.Types1_14; +import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; @@ -50,7 +50,7 @@ public class EntityPackets1_16_2 extends EntityRewriter registerTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.PAINTING); registerTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.PLAYER); registerRemoveEntities(ClientboundPackets1_16_2.DESTROY_ENTITIES); - registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST); + registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_16.METADATA_LIST); protocol.registerClientbound(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() { @Override @@ -104,7 +104,7 @@ public class EntityPackets1_16_2 extends EntityRewriter @Override protected void registerRewrites() { - registerMetaTypeHandler(MetaType1_14.Slot, MetaType1_14.BlockID, MetaType1_14.PARTICLE, MetaType1_14.OptChat); + registerMetaTypeHandler(MetaType1_16.ITEM, MetaType1_16.BLOCK_STATE, MetaType1_16.PARTICLE, MetaType1_16.OPT_COMPONENT); mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class); mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName("Piglin Brute"); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java index bd54e603..3f3be4b5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java @@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -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.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.Particle; @@ -153,10 +153,10 @@ public final class EntityPackets1_17 extends EntityRewriter { - meta.setMetaType(MetaType1_14.byId(meta.metaType().typeId())); + meta.setMetaType(MetaType1_16.byId(meta.metaType().typeId())); MetaType type = meta.metaType(); - if (type == MetaType1_14.PARTICLE) { + if (type == MetaType1_16.PARTICLE) { Particle particle = (Particle) meta.getValue(); if (particle.getId() == 15) { // Dust / Dust Transition // Remove transition target color values 4-6 @@ -169,7 +169,7 @@ public final class EntityPackets1_17 extends EntityRewriter