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()));