From ee16d7af285d0b81b0c7a72e4970ee41dbdd2c51 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 28 Oct 2024 12:09:04 +0100 Subject: [PATCH] Fix two area effect cloud item particle issues --- .../rewriter/EntityPacketRewriter1_13_2.java | 15 +++++++++++++-- .../rewriter/ParticleRewriter1_20_5.java | 11 ++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java index 752ba6b5a..c44f60fd3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java @@ -17,7 +17,10 @@ */ package com.viaversion.viaversion.protocols.v1_13_1to1_13_2.rewriter; +import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; @@ -30,8 +33,16 @@ public class EntityPacketRewriter1_13_2 { public static void register(Protocol1_13_1To1_13_2 protocol) { final PacketHandler dataTypeHandler = wrapper -> { - for (EntityData data : wrapper.get(Types1_13_2.ENTITY_DATA_LIST, 0)) { - data.setDataType(Types1_13_2.ENTITY_DATA_TYPES.byId(data.dataType().typeId())); + for (final EntityData data : wrapper.get(Types1_13_2.ENTITY_DATA_LIST, 0)) { + final EntityDataType dataType = Types1_13_2.ENTITY_DATA_TYPES.byId(data.dataType().typeId()); + if (dataType == Types1_13_2.ENTITY_DATA_TYPES.particleType) { + final Particle particle = data.value(); + if (particle.id() == 27) { + final Item item = particle.getArgument(0).getValue(); + particle.set(0, Types.ITEM1_13_2, item); + } + } + data.setDataType(dataType); } }; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ParticleRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ParticleRewriter1_20_5.java index 13a93a72a..55f15f669 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ParticleRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ParticleRewriter1_20_5.java @@ -18,7 +18,10 @@ package com.viaversion.viaversion.protocols.v1_20_3to1_20_5.rewriter; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.minecraft.Particle; +import com.viaversion.viaversion.api.minecraft.item.Item; +import com.viaversion.viaversion.api.minecraft.item.StructuredItem; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPacket1_20_3; @@ -34,8 +37,14 @@ public final class ParticleRewriter1_20_5 extends ParticleRewriter data = particle.getArgument(0); + if (data.getValue().isEmpty()) { + data.setValue(new StructuredItem(1, 1)); + } } } }