Program: 63580
Project: 63580
Buggy source:
@Override public EnumActionResult onItemUse(ItemStack stack,EntityPlayer playerIn,World worldIn,final BlockPos pos,EnumHand hand,EnumFacing facing,float hitX,float hitY,float hitZ){
  if (worldIn.isRemote) {
    return EnumActionResult.PASS;
  }
  IButterfly flutter=ButterflyManager.butterflyRoot.getMember(stack);
  if (flutter == null) {
    return EnumActionResult.PASS;
  }
  TileEntity tileEntity=worldIn.getTileEntity(pos);
  IBlockState blockState=worldIn.getBlockState(pos);
  if (type == EnumFlutterType.COCOON) {
    int age=stack.getTagCompound().getInteger(NBT_AGE);
    int yShift;
    if (!BlockUtil.isReplaceableBlock(blockState,worldIn,pos)) {
      if (!worldIn.isAirBlock(pos.down())) {
        return EnumActionResult.PASS;
      }
      yShift=1;
    }
 else {
      yShift=0;
    }
    BlockPos posS=pos.add(0,-yShift,0);
    IButterflyNursery nursery=null;
    if (tileEntity instanceof IButterflyNursery) {
      nursery=(IButterflyNursery)tileEntity;
    }
 else {
      ITree treeLeave=GeneticsUtil.getPollen(worldIn,pos);
      if (treeLeave != null) {
        treeLeave.setLeaves(worldIn,playerIn.getGameProfile(),pos);
        nursery=(IButterflyNursery)tileEntity;
      }
    }
    if (nursery != null) {
      if (nursery.canNurse(flutter)) {
        nursery.setCaterpillar(flutter);
        if (ButterflyManager.butterflyRoot.plantCocoon(worldIn,nursery,playerIn.getGameProfile(),age)) {
          PacketFXSignal packet=new PacketFXSignal(PacketFXSignal.SoundFXType.BLOCK_PLACE,pos,worldIn.getBlockState(posS));
          Proxies.net.sendNetworkPacket(packet,worldIn);
          if (!playerIn.capabilities.isCreativeMode) {
            stack.stackSize--;
          }
          nursery.setCaterpillar(null);
          return EnumActionResult.SUCCESS;
        }
 else {
          nursery.setCaterpillar(null);
          return EnumActionResult.PASS;
        }
      }
    }
    return EnumActionResult.PASS;
  }
 else   if (type == EnumFlutterType.CATERPILLAR) {
    if (!(tileEntity instanceof IButterflyNursery)) {
      return EnumActionResult.PASS;
    }
    IButterflyNursery pollinatable=(IButterflyNursery)tileEntity;
    if (!pollinatable.canNurse(flutter)) {
      return EnumActionResult.PASS;
    }
    pollinatable.setCaterpillar(flutter);
    PacketFXSignal packet=new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK,PacketFXSignal.SoundFXType.BLOCK_BREAK,pos,blockState);
    Proxies.net.sendNetworkPacket(packet,worldIn);
    if (!playerIn.capabilities.isCreativeMode) {
      stack.stackSize--;
    }
    return EnumActionResult.SUCCESS;
  }
 else {
    return EnumActionResult.PASS;
  }
}

Fixed version (ground truth):
@Override public EnumActionResult onItemUse(ItemStack stack,EntityPlayer playerIn,World worldIn,final BlockPos pos,EnumHand hand,EnumFacing facing,float hitX,float hitY,float hitZ){
  if (worldIn.isRemote) {
    return EnumActionResult.PASS;
  }
  IButterfly flutter=ButterflyManager.butterflyRoot.getMember(stack);
  if (flutter == null) {
    return EnumActionResult.PASS;
  }
  TileEntity tileEntity=worldIn.getTileEntity(pos);
  IBlockState blockState=worldIn.getBlockState(pos);
  if (type == EnumFlutterType.COCOON) {
    int age=stack.getTagCompound().getInteger(NBT_AGE);
    int yShift;
    if (!BlockUtil.isReplaceableBlock(blockState,worldIn,pos)) {
      if (!worldIn.isAirBlock(pos.down())) {
        return EnumActionResult.PASS;
      }
      yShift=1;
    }
 else {
      yShift=0;
    }
    BlockPos posS=pos.add(0,-yShift,0);
    IButterflyNursery nursery=null;
    if (tileEntity instanceof IButterflyNursery) {
      nursery=(IButterflyNursery)tileEntity;
    }
 else {
      ITree treeLeave=GeneticsUtil.getPollen(worldIn,pos);
      if (treeLeave != null) {
        if (treeLeave.setLeaves(worldIn,playerIn.getGameProfile(),pos)) {
          nursery=(IButterflyNursery)worldIn.getTileEntity(pos);
        }
      }
    }
    if (nursery != null) {
      if (nursery.canNurse(flutter)) {
        nursery.setCaterpillar(flutter);
        if (ButterflyManager.butterflyRoot.plantCocoon(worldIn,nursery,playerIn.getGameProfile(),age)) {
          PacketFXSignal packet=new PacketFXSignal(PacketFXSignal.SoundFXType.BLOCK_PLACE,pos,worldIn.getBlockState(posS));
          Proxies.net.sendNetworkPacket(packet,worldIn);
          if (!playerIn.capabilities.isCreativeMode) {
            stack.stackSize--;
          }
          nursery.setCaterpillar(null);
          return EnumActionResult.SUCCESS;
        }
 else {
          nursery.setCaterpillar(null);
          return EnumActionResult.PASS;
        }
      }
    }
    return EnumActionResult.PASS;
  }
 else   if (type == EnumFlutterType.CATERPILLAR) {
    if (!(tileEntity instanceof IButterflyNursery)) {
      return EnumActionResult.PASS;
    }
    IButterflyNursery pollinatable=(IButterflyNursery)tileEntity;
    if (!pollinatable.canNurse(flutter)) {
      return EnumActionResult.PASS;
    }
    pollinatable.setCaterpillar(flutter);
    PacketFXSignal packet=new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK,PacketFXSignal.SoundFXType.BLOCK_BREAK,pos,blockState);
    Proxies.net.sendNetworkPacket(packet,worldIn);
    if (!playerIn.capabilities.isCreativeMode) {
      stack.stackSize--;
    }
    return EnumActionResult.SUCCESS;
  }
 else {
    return EnumActionResult.PASS;
  }
}