Program: 8316
Project: 8316
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    MovingObjectPosition mop=this.getMovingObjectPositionFromPlayer(world,player,false);
    if (mop == null || !mop.typeOfHit.equals(MovingObjectType.BLOCK)) {
      int offset=this.getCharge(stack) + 3;
      CoordinateBox box=new CoordinateBox(player.posX - offset,player.posY - offset,player.posZ - offset,player.posX + offset,player.posY + offset,player.posZ + offset);
      List<ItemStack> drops=new ArrayList<ItemStack>();
      for (int x=(int)box.minX; x <= box.maxX; x++)       for (int y=(int)box.minY; y <= box.maxY; y++)       for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block block=world.getBlock(x,y,z);
        if (Utils.isOre(block) && block.getBlockHardness(world,x,y,z) != -1 && canHarvestBlock(block,stack)) {
          Utils.harvestVein(world,player,stack,new Coordinates(x,y,z),block,drops,0);
        }
      }
      if (!drops.isEmpty()) {
        world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
        PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
      }
      return stack;
    }
    Block block=world.getBlock(mop.blockX,mop.blockY,mop.blockZ);
    List<ItemStack> drops=new ArrayList<ItemStack>();
    if (Utils.isOre(block) || block.equals(Blocks.gravel)) {
      Utils.harvestVein(world,player,stack,new Coordinates(mop),block,drops,0);
    }
 else     if (block.getHarvestTool(0) == null || block.getHarvestTool(0).equals("String_Node_Str")) {
      CoordinateBox box=getRelativeBox(new Coordinates(mop),ForgeDirection.getOrientation(mop.sideHit),this.getCharge(stack) + 1);
      byte charge=this.getCharge(stack);
      for (int x=(int)box.minX; x <= box.maxX; x++)       for (int y=(int)box.minY; y <= box.maxY; y++)       for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block b=world.getBlock(x,y,z);
        if (b != Blocks.air && b.getBlockHardness(world,x,y,z) != -1 && canHarvestBlock(b,stack)) {
          drops.addAll(Utils.getBlockDrops(world,player,b,stack,x,y,z));
          world.setBlockToAir(x,y,z);
        }
      }
    }
    if (!drops.isEmpty()) {
      world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
      PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
    }
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote && this.getCharge(stack) != 0) {
    MovingObjectPosition mop=this.getMovingObjectPositionFromPlayer(world,player,false);
    if (mop == null || !mop.typeOfHit.equals(MovingObjectType.BLOCK)) {
      int offset=(this.getCharge(stack) - 1) + 3;
      CoordinateBox box=new CoordinateBox(player.posX - offset,player.posY - offset,player.posZ - offset,player.posX + offset,player.posY + offset,player.posZ + offset);
      List<ItemStack> drops=new ArrayList<ItemStack>();
      for (int x=(int)box.minX; x <= box.maxX; x++)       for (int y=(int)box.minY; y <= box.maxY; y++)       for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block block=world.getBlock(x,y,z);
        if (Utils.isOre(block) && block.getBlockHardness(world,x,y,z) != -1 && canHarvestBlock(block,stack)) {
          Utils.harvestVein(world,player,stack,new Coordinates(x,y,z),block,drops,0);
        }
      }
      if (!drops.isEmpty()) {
        world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
        PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
      }
      return stack;
    }
    Block block=world.getBlock(mop.blockX,mop.blockY,mop.blockZ);
    List<ItemStack> drops=new ArrayList<ItemStack>();
    if (Utils.isOre(block) || block.equals(Blocks.gravel)) {
      Utils.harvestVein(world,player,stack,new Coordinates(mop),block,drops,0);
    }
 else     if (block.getHarvestTool(0) == null || block.getHarvestTool(0).equals("String_Node_Str")) {
      CoordinateBox box=getRelativeBox(new Coordinates(mop),ForgeDirection.getOrientation(mop.sideHit),(this.getCharge(stack) - 1) + 1);
      byte charge=this.getCharge(stack);
      for (int x=(int)box.minX; x <= box.maxX; x++)       for (int y=(int)box.minY; y <= box.maxY; y++)       for (int z=(int)box.minZ; z <= box.maxZ; z++) {
        Block b=world.getBlock(x,y,z);
        if (b != Blocks.air && b.getBlockHardness(world,x,y,z) != -1 && canHarvestBlock(b,stack)) {
          drops.addAll(Utils.getBlockDrops(world,player,b,stack,x,y,z));
          world.setBlockToAir(x,y,z);
        }
      }
    }
    if (!drops.isEmpty()) {
      world.spawnEntityInWorld(new EntityLootBall(world,drops,player.posX,player.posY,player.posZ));
      PacketHandler.sendTo(new SwingItemPKT(),(EntityPlayerMP)player);
    }
  }
  return stack;
}