if (world == null) {
return;
}
Block block = world.getBlock(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ);
if (block instanceof IShearable) {
IShearable target = (IShearable) block;
if (target.isShearable(this.shootingItem, world, hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ) && !world.isRemote) {
ArrayList<ItemStack> drops = target.onSheared(this.shootingItem, world, hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ,
EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, this.shootingItem));
Random rand = new Random();
for (ItemStack stack : drops) {
float f = 0.7F;
double d = rand.nextFloat() * f + (1.0F - f) * 0.5D;
double d1 = rand.nextFloat() * f + (1.0F - f) * 0.5D;
double d2 = rand.nextFloat() * f + (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, hitMOP.blockX + d, hitMOP.blockY + d1, hitMOP.blockZ + d2, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
if (this.shootingEntity instanceof EntityPlayer) {
((EntityPlayer) shootingEntity).addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1);
}
}
world.func_147480_a(hitMOP.blockX, hitMOP.blockY, hitMOP.blockZ, true); // Destroy block and drop item
} else { // Block hit was not IShearable
this.kill();
}
} else if (hitMOP.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && hitMOP.entityHit != this.shootingEntity) {
if (hitMOP.entityHit instanceof IShearable) {
IShearable target = (IShearable) hitMOP.entityHit;
Entity entity = hitMOP.entityHit;
if (target.isShearable(this.shootingItem, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) {
ArrayList<ItemStack> drops = target.onSheared(this.shootingItem, entity.worldObj,
(int) entity.posX, (int) entity.posY, (int) entity.posZ,
EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, this.shootingItem));
Random rand = new Random();
for (ItemStack drop : drops) {