From 177b0fbf33c741d4f0db519c8a403db145a9faee Mon Sep 17 00:00:00 2001 From: KennyTV Date: Thu, 6 Feb 2020 12:37:57 +0100 Subject: [PATCH] Fix particle mapping --- .../metadata/MetadataRewriter1_16To1_15_2.java | 11 +++++++++++ .../protocol1_16to1_15_2/packets/WorldPackets.java | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java index 8f9bacf06..d826ef753 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/metadata/MetadataRewriter1_16To1_15_2.java @@ -7,8 +7,10 @@ import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14; import us.myles.ViaVersion.api.rewriters.MetadataRewriter; +import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.InventoryPackets; +import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.WorldPackets; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16; import java.util.List; @@ -27,6 +29,15 @@ public class MetadataRewriter1_16To1_15_2 extends MetadataRewriter { int data = (int) metadata.getValue(); metadata.setValue(Protocol1_16To1_15_2.getNewBlockStateId(data)); } + + if (type == null) return; + + if (type.is(Entity1_16Types.EntityType.AREA_EFFECT_CLOUD)) { + if (metadata.getId() == 10) { + Particle particle = (Particle) metadata.getValue(); + particle.setId(WorldPackets.getNewParticleId(particle.getId())); + } + } } @Override diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java index 388db5b5c..4c7d6b7a2 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/WorldPackets.java @@ -52,6 +52,13 @@ public class WorldPackets { // Spawn Particle blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x24, 3, 23, 32, - Protocol1_16To1_15_2::getNewBlockStateId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM); + WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM); + } + + public static int getNewParticleId(int id) { + if (id >= 27) { + id += 1; // soul flame + } + return id; } }