@Override public boolean onBlockActivated( World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { TileSource tileSource = (TileSource) worldIn.getTileEntity(pos); HashMap<Block, List<BlockLocation>> densityMap = tileSource.getMap(); densityMap.forEach( (block, blockLocations) -> { playerIn.addChatComponentMessage( new TextComponentString(block.getUnlocalizedName() + ":" + blockLocations.size())); }); } return super.onBlockActivated( worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); }