Skip to content

Commit

Permalink
Potentially fix packet writing issues?
Browse files Browse the repository at this point in the history
  • Loading branch information
covers1624 committed Jan 7, 2025
1 parent 2ab1743 commit 5e0aaac
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ private void onRegisterPayloadHandlerEvent(RegisterPayloadHandlersEvent event) {

CustomPacketPayload.Type<PacketCustom.Pkt> type = new CustomPacketPayload.Type<>(channel);
StreamCodec<FriendlyByteBuf, PacketCustom.Pkt> 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()));
Expand Down

0 comments on commit 5e0aaac

Please sign in to comment.