From 8f6784e0e29957f1f5dea4a1cc63cf00b07a1ac9 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 18 Jan 2024 10:25:58 +0100 Subject: [PATCH] Respect previous buffer types in particle rewriting --- .../BlockItemPacketRewriter1_20_5.java | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java index 1ba1365f9..3e548a634 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java @@ -17,7 +17,9 @@ */ package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter; +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.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; @@ -28,7 +30,6 @@ import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.Serverb import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.ItemRewriter; import com.viaversion.viaversion.util.Key; -import io.netty.buffer.ByteBuf; public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { @@ -55,8 +56,6 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { final int particleId = wrapper.read(Type.VAR_INT); @@ -70,10 +69,17 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { - - private final Particle particle; - - private ParticleDataReader(Particle particle) { - super(Void.class); - this.particle = particle; - } - - @Override - public void write(final ByteBuf buffer, final Void value) { - throw new UnsupportedOperationException(); - } - - @Override - public Void read(final ByteBuf buffer) throws Exception { - // Extract the particle data to put into a particle - Types1_20_3.PARTICLE.readData(buffer, particle); - return null; - } - } } \ No newline at end of file