diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java b/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java index 7d8da0bcf..ac066f88f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java @@ -57,8 +57,8 @@ final class BlockItemPacketRewriter1_99 extends StructuredItemRewriter. + */ +package com.viaversion.viaversion.protocols.template; + +import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21; +import com.viaversion.viaversion.rewriter.ComponentRewriter; +import com.viaversion.viaversion.util.SerializerVersion; + +public final class ComponentRewriter1_99 extends ComponentRewriter { + + public ComponentRewriter1_99(final Protocol1_99To_98 protocol) { + super(protocol, ReadType.NBT); + } + + @Override + protected void handleShowItem(final UserConnection connection, final CompoundTag itemTag, final CompoundTag componentsTag) { + super.handleShowItem(connection, itemTag, componentsTag); + if (componentsTag == null) { + return; + } + + // Remove or update data from componentsTag + } + + @Override + protected SerializerVersion inputSerializerVersion() { + return SerializerVersion.V1_20_5; + } +} 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 700eafa0b..d79a08a0c 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,6 +24,7 @@ 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.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5; @@ -50,6 +51,7 @@ final class Protocol1_99To_98 extends AbstractProtocol tagRewriter = new TagRewriter<>(this); + private final ComponentRewriter1_99 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 @@ -63,6 +65,19 @@ final class Protocol1_99To_98 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND); soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND_ENTITY); @@ -132,6 +147,11 @@ final class Protocol1_99To_98 extends AbstractProtocol createPacketTypesProvider() { return new SimplePacketTypesProvider<>( diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/ComponentRewriter1_21.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/ComponentRewriter1_21.java index 739e3d4d3..409895843 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/ComponentRewriter1_21.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_5to1_21/rewriter/ComponentRewriter1_21.java @@ -60,9 +60,4 @@ public final class ComponentRewriter1_21 extends ComponentRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND); soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND_ENTITY); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/ComponentRewriter1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/ComponentRewriter1_21_2.java index 2840e8745..b11a246b0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/ComponentRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/ComponentRewriter1_21_2.java @@ -62,8 +62,5 @@ public final class ComponentRewriter1_21_2 extends ComponentRewriter implements com.v } protected SerializerVersion outputSerializerVersion() { - return null; + return inputSerializerVersion(); // Only matters if the nbt serializer changed } private void convertLegacyContents(final CompoundTag hoverEvent) { diff --git a/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java b/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java index 1d1d8fa99..3380a2f78 100644 --- a/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java +++ b/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java @@ -115,4 +115,4 @@ public enum SerializerVersion { throw new RuntimeException(e); } } -} \ No newline at end of file +}