From 5e0aaac7c2df12b4b3dfcc63b809c0d16694b9e9 Mon Sep 17 00:00:00 2001 From: covers1624 Date: Tue, 7 Jan 2025 13:44:23 +1030 Subject: [PATCH] Potentially fix packet writing issues? --- .../java/codechicken/lib/packet/PacketCustomChannel.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/codechicken/lib/packet/PacketCustomChannel.java b/src/main/java/codechicken/lib/packet/PacketCustomChannel.java index dbc1d3ab..72f31efe 100644 --- a/src/main/java/codechicken/lib/packet/PacketCustomChannel.java +++ b/src/main/java/codechicken/lib/packet/PacketCustomChannel.java @@ -93,11 +93,7 @@ private void onRegisterPayloadHandlerEvent(RegisterPayloadHandlersEvent event) { CustomPacketPayload.Type type = new CustomPacketPayload.Type<>(channel); StreamCodec codec = StreamCodec.of( - (buf, p) -> { - p.data().markReaderIndex(); - buf.writeBytes(p.data()); - p.data().resetReaderIndex(); - }, + (buf, p) -> buf.writeBytes(p.data(), 0, p.data().writerIndex()), buf -> { RegistryAccess access = buf instanceof RegistryFriendlyByteBuf b ? b.registryAccess() : null; return new PacketCustom.Pkt(type, access, buf.readBytes(buf.readableBytes()));