Send complete block nbt if no handler is present

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-10-26 17:44:01 +02:00
parent 3c072906b7
commit b7ad2fef5c

View File

@ -96,7 +96,7 @@ public class ChunkDataPacket implements ServerPacket {
final Block block = entry.getValue();
final String blockEntity = block.registry().blockEntity();
if (blockEntity == null) continue; // Only send block entities to client
final NBTCompound resultNbt = new NBTCompound();
NBTCompound resultNbt = new NBTCompound();
// Append handler tags
final BlockHandler handler = block.handler();
if (handler != null) {
@ -108,6 +108,11 @@ public class ChunkDataPacket implements ServerPacket {
tag.writeUnsafe(resultNbt, value);
}
}
} else {
// Complete nbt shall be sent if the block has no handler
// Necessary to support all vanilla blocks
final NBTCompound blockNbt = block.nbt();
if (blockNbt != null) resultNbt = blockNbt;
}
// Add block entity
final var blockPosition = ChunkUtils.getBlockPosition(index, chunkX, chunkZ);