When placing a block down in Minecraft, the game crashes due to an error.
fun getNBTForPlacedBlock(world: Level, pos: BlockPos): CompoundTag? {
if (world is ServerLevel) {
val blockEntity: BlockEntity? = world.getBlockEntity(pos)
return blockEntity?.serializeNBT()
}
return null
}
The above code is supposed to grab and return the NBT data of a blockEntity as a compoundTag.
However .getBlockEntity() does not exist. Forge logs keep throwing an exception where it lists this method as not existing.