diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/template/ComponentRewriter1_99.java b/common/src/main/java/com/viaversion/viaversion/protocols/template/ComponentRewriter1_99.java index 39224c21a..241ae36bc 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/template/ComponentRewriter1_99.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/template/ComponentRewriter1_99.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacke import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.util.SerializerVersion; -public final class ComponentRewriter1_99 extends ComponentRewriter { +final class ComponentRewriter1_99 extends ComponentRewriter { public ComponentRewriter1_99(final Protocol1_99To_98 protocol) { super(protocol, ReadType.NBT); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/template/Protocol1_99To_98.java b/common/src/main/java/com/viaversion/viaversion/protocols/template/Protocol1_99To_98.java index bb9957f39..7bb633b18 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/template/Protocol1_99To_98.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/template/Protocol1_99To_98.java @@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider; import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider; -import com.viaversion.viaversion.api.rewriter.ComponentRewriter; import com.viaversion.viaversion.api.type.types.version.Types1_21_2; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5; @@ -34,6 +33,7 @@ import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundConfi import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21; import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21; import com.viaversion.viaversion.rewriter.AttributeRewriter; +import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.rewriter.ParticleRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter; @@ -55,7 +55,7 @@ final class Protocol1_99To_98 extends AbstractProtocol particleRewriter = new ParticleRewriter<>(this, /*Types1_OLD.PARTICLE,*/ Types1_21_2.PARTICLE); private final TagRewriter tagRewriter = new TagRewriter<>(this); - private final ComponentRewriter1_99 componentRewriter = new ComponentRewriter1_99(this); + private final ComponentRewriter componentRewriter = new ComponentRewriter1_99(this); public Protocol1_99To_98() { // Passing the class types into the super constructor is needed for automatic packet type id remapping, but can otherwise be omitted @@ -166,7 +166,7 @@ final class Protocol1_99To_98 extends AbstractProtocol getComponentRewriter() { return componentRewriter; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/Protocol1_21_2To1_21_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/Protocol1_21_2To1_21_4.java index 8ca875bde..2e447e815 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/Protocol1_21_2To1_21_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/Protocol1_21_2To1_21_4.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_21_2; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider; import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider; -import com.viaversion.viaversion.api.rewriter.ComponentRewriter; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.version.Types1_21_2; @@ -45,6 +44,7 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacke import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPacket1_21_2; import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPackets1_21_2; import com.viaversion.viaversion.rewriter.AttributeRewriter; +import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.rewriter.ParticleRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter; @@ -60,7 +60,7 @@ public final class Protocol1_21_2To1_21_4 extends AbstractProtocol particleRewriter = new ParticleRewriter1_21_4(this); private final TagRewriter tagRewriter = new TagRewriter<>(this); - private final ComponentRewriter1_21_4 componentRewriter = new ComponentRewriter1_21_4(this); + private final ComponentRewriter componentRewriter = new ComponentRewriter1_21_4(this); public Protocol1_21_2To1_21_4() { super(ClientboundPacket1_21_2.class, ClientboundPacket1_21_2.class, ServerboundPacket1_21_2.class, ServerboundPacket1_21_4.class); @@ -221,7 +221,7 @@ public final class Protocol1_21_2To1_21_4 extends AbstractProtocol getComponentRewriter() { return componentRewriter; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/rewriter/EntityPacketRewriter1_21_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/rewriter/EntityPacketRewriter1_21_4.java index 7b50a489b..65a1546a0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/rewriter/EntityPacketRewriter1_21_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21_2to1_21_4/rewriter/EntityPacketRewriter1_21_4.java @@ -43,7 +43,7 @@ public final class EntityPacketRewriter1_21_4 extends EntityRewriter { - final String type = event.value(); + filter().type(EntityTypes1_21_2.SALMON).index(17).handler((event, data) -> { + final String type = data.value(); final int typeId = switch (type) { case "small" -> 0; case "large" -> 2; default -> 1; // medium }; - event.setTypeAndValue(Types1_21_4.ENTITY_DATA_TYPES.varIntType, typeId); + data.setTypeAndValue(Types1_21_4.ENTITY_DATA_TYPES.varIntType, typeId); }); }