Program: 109857
Project: 109857
Buggy source:
@SubscribeEvent public void handlePineappleBreakEvent(HarvestDropsEvent event){
  World world=event.getWorld();
  Block block=event.getState().getBlock();
  int stage=event.getState().getValue(BlockPineapple.STAGE);
  boolean isFullyGrown=((BlockTallPlant.PlantHalf)event.getState().getValue(BlockPineapple.HALF)) == BlockTallPlant.PlantHalf.UPPER && stage >= BlockPineapple.TOTAL_GROW_TICKS;
  int x=event.getPos().getX();
  int y=event.getPos().getY();
  int z=event.getPos().getZ();
  EntityPlayer player=event.getHarvester();
  if (world.isRemote) {
    return;
  }
  if (block != BlockRegistry.pineapple) {
    return;
  }
  ItemStack handItemStack=getPlayerItem(world,player);
  Item inHand;
  if (handItemStack != null)   inHand=handItemStack.getItem();
 else   inHand=null;
  ItemStack drop=null;
  if (inHand != null && (inHand instanceof ItemSword || inHand.getItemUseAction(new ItemStack(inHand)) == EnumAction.BLOCK)) {
    drop=new ItemStack(ItemRegistry.pineappleCubes);
  }
 else {
    drop=new ItemStack(block,1,0);
  }
  int numDrops=isFullyGrown && drop.getItem() == ItemRegistry.pineappleCubes ? world.rand.nextInt(3) + 2 : 1;
  if (isFullyGrown) {
    world.setBlockState(event.getPos().down(),event.getState().withProperty(BlockPineapple.STAGE,Integer.valueOf(1)));
    world.setBlockToAir(event.getPos());
    for (int i=0; i < numDrops; i++) {
      dropBlockAsItem(world,x,y,z,drop);
    }
  }
 else   if (stage < BlockPineapple.TOTAL_GROW_TICKS) {
    IBlockState stateUp=world.getBlockState(event.getPos().up());
    if (stateUp.getBlock() instanceof BlockPineapple) {
      boolean aboveBlockFullyGrown=stateUp.getValue(BlockPineapple.STAGE) > BlockPineapple.TOTAL_GROW_TICKS;
      if (aboveBlockFullyGrown) {
        world.setBlockToAir(event.getPos().up());
        dropBlockAsItem(world,x,y + 1,z,drop);
      }
 else {
        world.setBlockToAir(event.getPos());
      }
    }
  }
 else {
    world.setBlockToAir(event.getPos());
    world.setBlockToAir(event.getPos().down());
  }
}

Fixed version (ground truth):
@SubscribeEvent public void handlePineappleBreakEvent(HarvestDropsEvent event){
  World world=event.getWorld();
  Block block=event.getState().getBlock();
  if (world.isRemote) {
    return;
  }
  if (block != BlockRegistry.pineapple) {
    return;
  }
  int stage=event.getState().getValue(BlockPineapple.STAGE);
  boolean isFullyGrown=((BlockTallPlant.PlantHalf)event.getState().getValue(BlockPineapple.HALF)) == BlockTallPlant.PlantHalf.UPPER && stage >= BlockPineapple.TOTAL_GROW_TICKS;
  int x=event.getPos().getX();
  int y=event.getPos().getY();
  int z=event.getPos().getZ();
  EntityPlayer player=event.getHarvester();
  ItemStack handItemStack=getPlayerItem(world,player);
  Item inHand;
  if (handItemStack != null)   inHand=handItemStack.getItem();
 else   inHand=null;
  ItemStack drop=null;
  if (inHand != null && (inHand instanceof ItemSword || inHand.getItemUseAction(new ItemStack(inHand)) == EnumAction.BLOCK)) {
    drop=new ItemStack(ItemRegistry.pineappleCubes);
  }
 else {
    drop=new ItemStack(block,1,0);
  }
  int numDrops=isFullyGrown && drop.getItem() == ItemRegistry.pineappleCubes ? world.rand.nextInt(3) + 2 : 1;
  if (isFullyGrown) {
    world.setBlockState(event.getPos().down(),event.getState().withProperty(BlockPineapple.STAGE,Integer.valueOf(1)));
    world.setBlockToAir(event.getPos());
    for (int i=0; i < numDrops; i++) {
      dropBlockAsItem(world,x,y,z,drop);
    }
  }
 else   if (stage < BlockPineapple.TOTAL_GROW_TICKS) {
    IBlockState stateUp=world.getBlockState(event.getPos().up());
    if (stateUp.getBlock() instanceof BlockPineapple) {
      boolean aboveBlockFullyGrown=stateUp.getValue(BlockPineapple.STAGE) > BlockPineapple.TOTAL_GROW_TICKS;
      if (aboveBlockFullyGrown) {
        world.setBlockToAir(event.getPos().up());
        dropBlockAsItem(world,x,y + 1,z,drop);
      }
 else {
        world.setBlockToAir(event.getPos());
      }
    }
  }
 else {
    world.setBlockToAir(event.getPos());
    world.setBlockToAir(event.getPos().down());
  }
}