9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-29 11:59:17 +00:00
This commit is contained in:
Lumine1909
2025-07-12 21:12:54 -07:00
parent 4a574e272e
commit e5218f1b92

View File

@@ -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);
}
},