From a6feb7d5923adefe4c29773ade4af02be6792a7f Mon Sep 17 00:00:00 2001 From: BianXiao <137746769+mcbianxiao@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:25:25 +0800 Subject: [PATCH] Update ServuxStructuresPacket.java --- .../masa/servux/network/packet/ServuxStructuresPacket.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/servux/network/packet/ServuxStructuresPacket.java b/src/main/java/fi/dy/masa/servux/network/packet/ServuxStructuresPacket.java index 7afa1b03..27924fb2 100644 --- a/src/main/java/fi/dy/masa/servux/network/packet/ServuxStructuresPacket.java +++ b/src/main/java/fi/dy/masa/servux/network/packet/ServuxStructuresPacket.java @@ -104,13 +104,14 @@ public void toPacket(PacketByteBuf output) // Write Packet Buffer try { - output.writeBytes(this.buffer.readBytes(this.buffer.readableBytes())); + PacketByteBuf copiedBuffer = new PacketByteBuf(this.buffer.copy()); + output.writeBytes(copiedBuffer.readBytes(copiedBuffer.readableBytes())); } catch (Exception e) { Servux.logger.error("ServuxStructuresPacket#toPacket: error writing data to packet: [{}]", e.getLocalizedMessage()); - } - } + } + } else { // Write NBT