Program: 30829
Project: 30829
Buggy source:
@Override public boolean onActivate(EntityPlayer player,Vec3 pos){
  ItemStack is=player.inventory.getCurrentItem();
  TunnelType tt=AEApi.instance().registries().p2pTunnel().getTunnelTypeByItem(is);
  if (is != null && is.getItem() instanceof IMemoryCard) {
    IMemoryCard mc=(IMemoryCard)is.getItem();
    NBTTagCompound data=mc.getData(is);
    ItemStack newType=ItemStack.loadItemStackFromNBT(data);
    long freq=data.getLong("String_Node_Str");
    if (newType != null) {
      if (newType.getItem() instanceof IPartItem) {
        IPart testPart=((IPartItem)newType.getItem()).createPartFromItemStack(newType);
        if (testPart instanceof PartP2PTunnel) {
          getHost().removePart(side,true);
          ForgeDirection dir=getHost().addPart(newType,side,player);
          IPart newBus=getHost().getPart(dir);
          if (newBus instanceof PartP2PTunnel) {
            PartP2PTunnel newTunnel=(PartP2PTunnel)newBus;
            newTunnel.output=true;
            newTunnel.onChange();
            try {
              P2PCache p2p=newTunnel.proxy.getP2P();
              p2p.updateFreq(newTunnel,freq);
            }
 catch (            GridAccessException e) {
            }
          }
          mc.notifyUser(player,MemoryCardMessages.SETTINGS_LOADED);
          return true;
        }
      }
    }
    mc.notifyUser(player,MemoryCardMessages.INVALID_MACHINE);
  }
 else   if (tt != null) {
    ItemStack newType=null;
switch (tt) {
case BC_POWER:
      newType=AEApi.instance().parts().partP2PTunnelMJ.stack(1);
    break;
case FLUID:
  newType=AEApi.instance().parts().partP2PTunnelLiquids.stack(1);
break;
case IC2_POWER:
newType=AEApi.instance().parts().partP2PTunnelEU.stack(1);
break;
case ITEM:
newType=AEApi.instance().parts().partP2PTunnelItems.stack(1);
break;
case ME:
newType=AEApi.instance().parts().partP2PTunnelME.stack(1);
break;
case REDSTONE:
newType=AEApi.instance().parts().partP2PTunnelRedstone.stack(1);
break;
}
if (newType != null && !Platform.isSameItem(newType,this.is)) {
boolean oldOutput=output;
long myFreq=freq;
getHost().removePart(side,false);
ForgeDirection dir=getHost().addPart(newType,side,player);
IPart newBus=getHost().getPart(dir);
if (newBus instanceof PartP2PTunnel) {
PartP2PTunnel newTunnel=(PartP2PTunnel)newBus;
newTunnel.output=oldOutput;
newTunnel.onChange();
try {
P2PCache p2p=newTunnel.proxy.getP2P();
p2p.updateFreq(newTunnel,myFreq);
}
 catch (GridAccessException e) {
}
}
return true;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean onActivate(EntityPlayer player,Vec3 pos){
  ItemStack is=player.inventory.getCurrentItem();
  TunnelType tt=AEApi.instance().registries().p2pTunnel().getTunnelTypeByItem(is);
  if (is != null && is.getItem() instanceof IMemoryCard) {
    IMemoryCard mc=(IMemoryCard)is.getItem();
    NBTTagCompound data=mc.getData(is);
    ItemStack newType=ItemStack.loadItemStackFromNBT(data);
    long freq=data.getLong("String_Node_Str");
    if (newType != null) {
      if (newType.getItem() instanceof IPartItem) {
        IPart testPart=((IPartItem)newType.getItem()).createPartFromItemStack(newType);
        if (testPart instanceof PartP2PTunnel) {
          getHost().removePart(side,true);
          ForgeDirection dir=getHost().addPart(newType,side,player);
          IPart newBus=getHost().getPart(dir);
          if (newBus instanceof PartP2PTunnel) {
            PartP2PTunnel newTunnel=(PartP2PTunnel)newBus;
            newTunnel.output=true;
            try {
              P2PCache p2p=newTunnel.proxy.getP2P();
              p2p.updateFreq(newTunnel,freq);
            }
 catch (            GridAccessException e) {
            }
            newTunnel.onChange();
          }
          mc.notifyUser(player,MemoryCardMessages.SETTINGS_LOADED);
          return true;
        }
      }
    }
    mc.notifyUser(player,MemoryCardMessages.INVALID_MACHINE);
  }
 else   if (tt != null) {
    ItemStack newType=null;
switch (tt) {
case BC_POWER:
      newType=AEApi.instance().parts().partP2PTunnelMJ.stack(1);
    break;
case FLUID:
  newType=AEApi.instance().parts().partP2PTunnelLiquids.stack(1);
break;
case IC2_POWER:
newType=AEApi.instance().parts().partP2PTunnelEU.stack(1);
break;
case ITEM:
newType=AEApi.instance().parts().partP2PTunnelItems.stack(1);
break;
case ME:
newType=AEApi.instance().parts().partP2PTunnelME.stack(1);
break;
case REDSTONE:
newType=AEApi.instance().parts().partP2PTunnelRedstone.stack(1);
break;
}
if (newType != null && !Platform.isSameItem(newType,this.is)) {
boolean oldOutput=output;
long myFreq=freq;
getHost().removePart(side,false);
ForgeDirection dir=getHost().addPart(newType,side,player);
IPart newBus=getHost().getPart(dir);
if (newBus instanceof PartP2PTunnel) {
PartP2PTunnel newTunnel=(PartP2PTunnel)newBus;
newTunnel.output=oldOutput;
newTunnel.onChange();
try {
P2PCache p2p=newTunnel.proxy.getP2P();
p2p.updateFreq(newTunnel,myFreq);
}
 catch (GridAccessException e) {
}
}
tile.worldObj.notifyBlocksOfNeighborChange(tile.xCoord,tile.yCoord,tile.zCoord,0);
return true;
}
}
return false;
}