diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java index 9faa1f27..f28d021e 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java @@ -81,7 +81,7 @@ public class ServuxEntityDataProtocol implements LeavesProtocol { public static void onBlockEntityRequest(ServerPlayer player, BlockPos pos) { Bukkit.getGlobalRegionScheduler().run(MinecraftInternalPlugin.INSTANCE, (task) -> { BlockEntity be = player.level().getBlockEntity(pos); - CompoundTag nbt = be != null ? be.saveWithoutMetadata(player.registryAccess()) : new CompoundTag(); + CompoundTag nbt = be != null ? be.saveWithFullMetadata(player.registryAccess()) : new CompoundTag(); EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_BLOCK_NBT_RESPONSE_SIMPLE); payload.pos = pos.immutable(); @@ -93,7 +93,7 @@ public class ServuxEntityDataProtocol implements LeavesProtocol { public static void onEntityRequest(ServerPlayer player, int entityId) { Bukkit.getGlobalRegionScheduler().run(MinecraftInternalPlugin.INSTANCE, (task) -> { Entity entity = player.level().getEntity(entityId); - CompoundTag nbt = TagUtil.saveEntity(entity); + CompoundTag nbt = TagUtil.saveEntityWithoutId(entity); EntityDataPayload payload = new EntityDataPayload(EntityDataPayloadType.PACKET_S2C_ENTITY_NBT_RESPONSE_SIMPLE); payload.entityId = entityId; @@ -180,7 +180,7 @@ public class ServuxEntityDataProtocol implements LeavesProtocol { buf.writeVarInt(payload.entityId); buf.writeNbt(payload.nbt); } - case PACKET_S2C_NBT_RESPONSE_DATA, PACKET_C2S_NBT_RESPONSE_DATA -> buf.writeBytes(payload.buffer.readBytes(payload.buffer.readableBytes())); + case PACKET_S2C_NBT_RESPONSE_DATA, PACKET_C2S_NBT_RESPONSE_DATA -> buf.writeBytes(payload.buffer.copy()); case PACKET_C2S_METADATA_REQUEST, PACKET_S2C_METADATA -> buf.writeNbt(payload.nbt); } },