public static List<ItemStack> breakBlock(World worldObj, EntityPlayer player, BlockPos pos, IBlockState state, int fortune, boolean doBreak, boolean silkTouch) { if (state.getBlockHardness(worldObj, pos) == -1) { return new LinkedList<>(); } NonNullList<ItemStack> ret = NonNullList.create(); if (silkTouch && state.getBlock().canSilkHarvest(worldObj, pos, state, player)) { ret.add(createStackedBlock(state)); } else { state.getBlock().getDrops(ret, worldObj, pos, state, fortune); } if (!doBreak) { return ret; } worldObj.playEvent(2001, pos, Block.getStateId(state)); worldObj.setBlockToAir(pos); List<EntityItem> result = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.getX() - 2, pos.getY() - 2, pos.getZ() - 2, pos.getX() + 3, pos.getY() + 3, pos.getZ() + 3)); for (EntityItem entity : result) { if (entity.isDead || entity.getItem().getCount() <= 0) { continue; } ret.add(entity.getItem()); entity.world.removeEntity(entity); } return ret; }