Program: 58382
Project: 58382
Buggy source:
@SubscribeEvent(priority=EventPriority.HIGHEST) public void handleArrowLooseEvent(ArrowLooseEvent event){
  if (!(event.getBow().getItem() instanceof ItemBow)) {
    return;
  }
  ItemStack stack=event.getBow();
  IBowImproved bowImproved=null;
  EntityPlayer player=event.getEntityPlayer();
  ItemStack arrowStack=findAmmo(player);
  World world=event.getWorld();
  if (stack.getItem() instanceof IBowImproved) {
    bowImproved=(IBowImproved)stack.getItem();
  }
  boolean flag=player.capabilities.isCreativeMode || (arrowStack.getItem() instanceof ItemArrow && ((ItemArrow)arrowStack.getItem()).isInfinite(arrowStack,stack,player));
  if (!arrowStack.isEmpty() || flag) {
    if (arrowStack.isEmpty()) {
      arrowStack=new ItemStack(Items.ARROW);
    }
    float f=ItemBow.getArrowVelocity(event.getCharge());
    float speedMod=bowImproved != null ? 1.0F + bowImproved.getArrowSpeedMultiplier() : 1.0F;
    if ((double)f >= 0.1D) {
      if (!world.isRemote) {
        int encMultishot=MathHelper.clamp(EnchantmentHelper.getEnchantmentLevel(CoreEnchantments.multishot,stack),0,10);
        int encPunch=EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH,stack);
        int encPower=EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER,stack);
        boolean encFlame=EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME,stack) > 0;
        if (bowImproved != null) {
          bowImproved.onBowFired(player,stack);
        }
        for (int shot=0; shot <= encMultishot; shot++) {
          EntityArrow arrow=createArrow(world,arrowStack,player);
          arrow.setAim(player,player.rotationPitch,player.rotationYaw,0.0F,f * 3.0F * speedMod,1.0F + (1.5F - f) * shot);
          if (bowImproved != null) {
            arrow.setDamage(arrow.getDamage() * (1 + bowImproved.getArrowDamageMultiplier()));
          }
          if (f >= 1.0F) {
            arrow.setIsCritical(true);
          }
          if (encPower > 0) {
            arrow.setDamage(arrow.getDamage() + (double)encPower * 0.5D + 0.5D);
          }
          if (encPunch > 0) {
            arrow.setKnockbackStrength(encPunch);
          }
          if (encFlame) {
            arrow.setFire(100);
          }
          if (flag) {
            arrow.pickupStatus=PickupStatus.CREATIVE_ONLY;
          }
          world.spawnEntity(arrow);
        }
        stack.damageItem(1,player);
      }
      world.playSound(null,player.posX,player.posY,player.posZ,SoundEvents.ENTITY_ARROW_SHOOT,SoundCategory.PLAYERS,1.0F,1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
      if (!flag && !player.capabilities.isCreativeMode) {
        if (isQuiver(arrowStack)) {
          ((IQuiverItem)arrowStack.getItem()).onArrowFired(arrowStack,player);
        }
 else {
          arrowStack.shrink(1);
          if (arrowStack.isEmpty()) {
            player.inventory.deleteStack(arrowStack);
          }
        }
      }
      player.addStat(StatList.getObjectUseStats(stack.getItem()));
    }
    event.setCanceled(true);
  }
}

Fixed version (ground truth):
@SubscribeEvent(priority=EventPriority.HIGHEST) public void handleArrowLooseEvent(ArrowLooseEvent event){
  if (!(event.getBow().getItem() instanceof ItemBow)) {
    return;
  }
  ItemStack stack=event.getBow();
  IBowImproved bowImproved=null;
  EntityPlayer player=event.getEntityPlayer();
  ItemStack arrowStack=findAmmo(player);
  World world=event.getWorld();
  if (stack.getItem() instanceof IBowImproved) {
    bowImproved=(IBowImproved)stack.getItem();
  }
  boolean flag=player.capabilities.isCreativeMode || (arrowStack.getItem() instanceof ItemArrow && ((ItemArrow)arrowStack.getItem()).isInfinite(arrowStack,stack,player));
  if (!arrowStack.isEmpty() || flag) {
    if (arrowStack.isEmpty()) {
      arrowStack=new ItemStack(Items.ARROW);
    }
    float f=ItemBow.getArrowVelocity(event.getCharge());
    float speedMod=bowImproved != null ? 1.0F + bowImproved.getArrowSpeedMultiplier() : 1.0F;
    if ((double)f >= 0.1D) {
      if (!world.isRemote) {
        int encMultishot=MathHelper.clamp(EnchantmentHelper.getEnchantmentLevel(CoreEnchantments.multishot,stack),0,10);
        int encPunch=EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH,stack);
        int encPower=EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER,stack);
        boolean encFlame=EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME,stack) > 0;
        if (bowImproved != null) {
          bowImproved.onBowFired(player,stack);
        }
        for (int shot=0; shot <= encMultishot; shot++) {
          EntityArrow arrow=createArrow(world,arrowStack,player);
          arrow.setAim(player,player.rotationPitch,player.rotationYaw,0.0F,f * 3.0F * speedMod,1.0F + (1.5F - f) * shot);
          if (bowImproved != null) {
            arrow.setDamage(arrow.getDamage() * (1 + bowImproved.getArrowDamageMultiplier()));
          }
          if (f >= 1.0F) {
            arrow.setIsCritical(true);
          }
          if (encPower > 0) {
            arrow.setDamage(arrow.getDamage() + (double)encPower * 0.5D + 0.5D);
          }
          if (encPunch > 0) {
            arrow.setKnockbackStrength(encPunch);
          }
          if (encFlame) {
            arrow.setFire(100);
          }
          if (flag || shot > 0) {
            arrow.pickupStatus=PickupStatus.CREATIVE_ONLY;
          }
          world.spawnEntity(arrow);
        }
        stack.damageItem(1,player);
      }
      world.playSound(null,player.posX,player.posY,player.posZ,SoundEvents.ENTITY_ARROW_SHOOT,SoundCategory.PLAYERS,1.0F,1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
      if (!flag && !player.capabilities.isCreativeMode) {
        if (isQuiver(arrowStack)) {
          ((IQuiverItem)arrowStack.getItem()).onArrowFired(arrowStack,player);
        }
 else {
          arrowStack.shrink(1);
          if (arrowStack.isEmpty()) {
            player.inventory.deleteStack(arrowStack);
          }
        }
      }
      player.addStat(StatList.getObjectUseStats(stack.getItem()));
    }
    event.setCanceled(true);
  }
}