diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/metadata/MetadataRewriter1_17To1_16_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/metadata/MetadataRewriter1_17To1_16_4.java index 24f0eab57..1c758dfbf 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/metadata/MetadataRewriter1_17To1_16_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/metadata/MetadataRewriter1_17To1_16_4.java @@ -8,7 +8,6 @@ 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_17; import us.myles.ViaVersion.api.rewriters.MetadataRewriter; -import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.types.Particle; import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4; import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets.InventoryPackets; @@ -32,16 +31,7 @@ public class MetadataRewriter1_17To1_16_4 extends MetadataRewriter { int data = (int) metadata.getValue(); metadata.setValue(protocol.getMappingData().getNewBlockStateId(data)); } else if (metadata.getMetaType() == MetaType1_17.PARTICLE) { - Particle particle = (Particle) metadata.getValue(); - if (particle.getId() == 14) { - // RGB is now encoded as doubles - for (int i = 0; i < 3; i++) { - Particle.ParticleData data = particle.getArguments().get(i); - data.setValue(((Number) data.getValue()).doubleValue()); - data.setType(Type.DOUBLE); - } - } - rewriteParticle(particle); + rewriteParticle((Particle) metadata.getValue()); } if (type == null) return; diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/packets/InventoryPackets.java index bc9056e8f..cec43895d 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_17to1_16_4/packets/InventoryPackets.java @@ -20,6 +20,7 @@ public class InventoryPackets { itemRewriter.registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM); itemRewriter.registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM); + itemRewriter.registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE); new RecipeRewriter1_16(protocol, InventoryPackets::toClient).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES); @@ -32,33 +33,6 @@ public class InventoryPackets { handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM))); } }); - - protocol.registerOutgoing(ClientboundPackets1_16_2.SPAWN_PARTICLE, new PacketRemapper() { - @Override - public void registerMap() { - map(Type.INT); // Particle id - map(Type.BOOLEAN); // Long distance - map(Type.DOUBLE); // X - map(Type.DOUBLE); // Y - map(Type.DOUBLE); // Z - map(Type.FLOAT); // Offset X - map(Type.FLOAT); // Offset Y - map(Type.FLOAT); // Offset Z - map(Type.FLOAT); // Particle data - map(Type.INT); // Particle count - handler(wrapper -> { - int id = wrapper.get(Type.INT, 0); - if (id == 14) { // Dust - // RGB now written as doubles - wrapper.write(Type.DOUBLE, wrapper.read(Type.FLOAT).doubleValue()); // R - wrapper.write(Type.DOUBLE, wrapper.read(Type.FLOAT).doubleValue()); // G - wrapper.write(Type.DOUBLE, wrapper.read(Type.FLOAT).doubleValue()); // B - wrapper.passthrough(Type.FLOAT); // Scale - } - }); - handler(itemRewriter.getSpawnParticleHandler(Type.FLAT_VAR_INT_ITEM)); - } - }); } public static void toClient(Item item) {