From 792f52e637708ca955f38566128560252af74c87 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 26 May 2024 13:02:38 +0200 Subject: [PATCH] Fix firework flight show item conversion Fixes #3877 --- .../viaversion/api/type/types/UnsignedByteType.java | 2 ++ .../v1_20_3to1_20_5/rewriter/ComponentRewriter1_20_5.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/UnsignedByteType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/UnsignedByteType.java index cecc60ead..4d3afe0d3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/UnsignedByteType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/UnsignedByteType.java @@ -27,6 +27,8 @@ import com.viaversion.viaversion.api.type.TypeConverter; import io.netty.buffer.ByteBuf; public class UnsignedByteType extends Type implements TypeConverter { + public static final int MAX_VALUE = 255; + public UnsignedByteType() { super("Unsigned Byte", Short.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ComponentRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ComponentRewriter1_20_5.java index 7bb888c7d..b800bbc7c 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ComponentRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/ComponentRewriter1_20_5.java @@ -26,7 +26,6 @@ import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; import com.google.common.base.Preconditions; -import com.google.common.primitives.UnsignedBytes; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.GameProfile; @@ -72,6 +71,7 @@ import com.viaversion.viaversion.api.minecraft.item.data.Unbreakable; import com.viaversion.viaversion.api.minecraft.item.data.WrittenBook; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; +import com.viaversion.viaversion.api.type.types.UnsignedByteType; import com.viaversion.viaversion.api.type.types.item.StructuredDataType; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_5; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.data.ArmorMaterials1_20_5; @@ -1050,7 +1050,7 @@ public class ComponentRewriter1_20_5 extends Co } protected ByteTag convertUnsignedByte(final byte value) { - if (value > UnsignedBytes.MAX_VALUE) { + if (value > UnsignedByteType.MAX_VALUE) { throw new IllegalArgumentException("Value out of range: " + value); } return new ByteTag(value);