// AELog.info( "ID:" + id.toString() + " : " + is.getItemDamage() );
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( "freq" );
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)
{
// :P
}
newTunnel.onTunnelNetworkChange();
}
mc.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
return true;
}
}
}
mc.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
}
else if ( tt != null ) // attunement
{
ItemStack newType = null;