public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState block, BlockPos pos, EntityLivingBase living)
{
if(living instanceof EntityPlayer && !world.isRemote)
{
for(int x1 = -2; x1 < 3; x1++)
{
for(int y1 = -2; y1 < 3; y1++)
{
for(int z1 = -2; z1 < 3; z1++)
{
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
TileEntity te = new TileEntity() {};
BlockPos pos1 = new BlockPos(x + x1, y + y1, z + z1);
if(world.getBlockState(pos1).getBlockHardness(world, pos1) >= 0) {
world.getBlockState(pos1).getBlock().harvestBlock(world, (EntityPlayer)living, pos1, block, te,stack);
world.setBlockToAir(pos1);
}
int exp = world.getBlockState(pos).getBlock().getExpDrop(world.getBlockState(pos), world, pos1, 0);
if(exp > 0) {
EntityXPOrb expOrb = new EntityXPOrb(world, x, y, z, exp);
world.spawnEntity(expOrb);
}
}
}
}
}
return super.onBlockDestroyed(stack, world, block, pos, living);
}
}