getBlockNbt

fun getBlockNbt(block: BlockEntity): CompoundTag

Get the NBT data of a block entity.

Return

CompoundTag representing the block entity's data

Parameters

block

the target BlockEntity


fun getBlockNbt(level: Level, pos: BlockPos): CompoundTag?

Get the NBT data of a block at a position if it has a block entity.

Return

CompoundTag or null if no block entity exists

Parameters

level

level to query

pos

position of the block