From cddf30b60fd886dd02541e73bd4530cc3a4f0853 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 25 Apr 2024 19:07:10 +0200 Subject: [PATCH] Read normal byte array type for cookie packet --- .../Protocol1_20_3To1_20_5.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java index 60342560..178581f7 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java @@ -37,7 +37,6 @@ import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider; import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.ByteArrayType; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets; import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets; @@ -64,7 +63,6 @@ import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap; public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class); - private static final ByteArrayType COOKIE_DATA_TYPE = new ByteArrayType(5120); private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this); private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this); private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); @@ -187,7 +185,11 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol 5120) { + throw new IllegalArgumentException("Cookie data too large"); + } + wrapper.user().get(CookieStorage.class).cookies().put(resourceLocation, data); } @@ -196,14 +198,10 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol