public class DemoBlock extends BlockWithEntity { [...] @Override public void appendTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext context) { NbtCompound nbt = BlockItem.getBlockEntityNbt(stack); if (nbt == null) return; tooltip.add(Text.literal("Number: " + nbt.getInt("number")) } }