Package appeng.api.implementations.items

Examples of appeng.api.implementations.items.IMemoryCard


      ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
      tnt.serverSideToolLogic( is, player, player.worldObj, x, y, z, side, hitX, hitY, hitZ );
    }
    else if ( is != null && AEApi.instance().items().itemMemoryCard.sameAsStack( is ) )
    {
      IMemoryCard mem = (IMemoryCard) is.getItem();
      mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
      is.setTagCompound( null );
    }
    else if ( is != null && AEApi.instance().items().itemColorApplicator.sameAsStack( is ) )
    {
      ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
      mem.cycleColors( is, mem.getColor( is ), 1 );
    }
  }
View Full Code Here


  {
    ItemStack memCardIS = player.inventory.getCurrentItem();

    if ( memCardIS != null && useStandardMemoryCard() && memCardIS.getItem() instanceof IMemoryCard )
    {
      IMemoryCard memoryCard = (IMemoryCard) memCardIS.getItem();

      ItemStack is = getItemStack( PartItemStack.Network );

      // Blocks and parts share the same soul!
      if ( AEApi.instance().parts().partInterface.sameAsStack( is ) )
        is = AEApi.instance().blocks().blockInterface.stack( 1 );

      String name = is.getUnlocalizedName();

      if ( player.isSneaking() )
      {
        NBTTagCompound data = downloadSettings( SettingsFrom.MEMORY_CARD );
        if ( data != null )
        {
          memoryCard.setMemoryCardContents( memCardIS, name, data );
          memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
        }
      }
      else
      {
        String storedName = memoryCard.getSettingsName( memCardIS );
        NBTTagCompound data = memoryCard.getData( memCardIS );
        if ( name.equals( storedName ) )
        {
          uploadSettings( SettingsFrom.MEMORY_CARD, data );
          memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
        }
        else
          memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
      }
      return true;
    }
    return false;
  }
View Full Code Here

  @Override
  public boolean onItemUse(ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hx, float hy, float hz)
  {
    if ( player.isSneaking() && !w.isRemote )
    {
      IMemoryCard mem = (IMemoryCard) is.getItem();
      mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
      is.setTagCompound( null );
      return true;
    }
    else
      return super.onItemUse( is, player, w, x, y, z, side, hx, hy, hz );
View Full Code Here

          return false;
        }

        if ( is.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus) )
        {
          IMemoryCard memoryCard = (IMemoryCard) is.getItem();
          if ( player.isSneaking() )
          {
            AEBaseTile t = getTileEntity( w, x, y, z );
            if ( t != null )
            {
              String name = getUnlocalizedName();
              NBTTagCompound data = t.downloadSettings( SettingsFrom.MEMORY_CARD );
              if ( data != null )
              {
                memoryCard.setMemoryCardContents( is, name, data );
                memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
                return true;
              }
            }
          }
          else
          {
            String name = memoryCard.getSettingsName( is );
            NBTTagCompound data = memoryCard.getData( is );
            if ( getUnlocalizedName().equals( name ) )
            {
              AEBaseTile t = getTileEntity( w, x, y, z );
              t.uploadSettings( SettingsFrom.MEMORY_CARD, data );
              memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
            }
            else
              memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
            return false;
          }
        }
      }
    }
View Full Code Here

    // 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;
View Full Code Here

  public boolean onPartShiftActivate(EntityPlayer player, Vec3 pos)
  {
    ItemStack is = player.inventory.getCurrentItem();
    if ( is != null && is.getItem() instanceof IMemoryCard )
    {
      IMemoryCard mc = (IMemoryCard) is.getItem();
      NBTTagCompound data = new NBTTagCompound();

      long newFreq = freq;
      boolean wasOutput = output;
      output = false;

      if ( wasOutput || freq == 0 )
        newFreq = System.currentTimeMillis();

      try
      {
        proxy.getP2P().updateFreq( this, newFreq );
      }
      catch (GridAccessException e)
      {
        // :P
      }

      onTunnelConfigChange();

      ItemStack p2pItem = getItemStack( PartItemStack.Wrench );
      String type = p2pItem.getUnlocalizedName();

      p2pItem.writeToNBT( data );
      data.setLong( "freq", freq );

      mc.setMemoryCardContents( is, type + ".name", data );
      mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
      return true;
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of appeng.api.implementations.items.IMemoryCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.