Package appeng.api.storage.data

Examples of appeng.api.storage.data.IAEItemStack


    for (IAEItemStack io : outputs)
    {
      if ( io == null )
        continue;

      IAEItemStack g = tmpOutputs.get( io );
      if ( g == null )
        tmpOutputs.put( io, io.copy() );
      else
        g.add( io );
    }

    HashMap<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>();
    for (IAEItemStack io : inputs)
    {
      if ( io == null )
        continue;

      IAEItemStack g = tmpInputs.get( io );
      if ( g == null )
        tmpInputs.put( io, io.copy() );
      else
        g.add( io );
    }

    if ( tmpOutputs.isEmpty() || tmpInputs.isEmpty() )
      throw new RuntimeException( "No pattern here!" );
View Full Code Here


      if ( d != null )
      {
        for (int x = 0; x < availableSlots() && itemToSend > 0; x++)
        {
          IAEItemStack ais = config.getAEStackInSlot( x );
          if ( ais == null || itemToSend <= 0 || craftOnly() )
          {
            if ( isCraftingEnabled() )
              didSomething = cratingTracker.handleCrafting( x, itemToSend, ais, d, getTile().getWorldObj(), proxy.getGrid(), cg, mySrc )
                  || didSomething;
View Full Code Here

    if ( canFit > 0 )
    {
      ais = ais.copy();
      ais.setStackSize( canFit );
      IAEItemStack itemsToAdd = Platform.poweredExtraction( energy, inv, ais, mySrc );

      if ( itemsToAdd != null )
      {
        itemToSend -= itemsToAdd.getStackSize();

        ItemStack failed = d.addItems( itemsToAdd.getItemStack() );
        if ( failed != null )
        {
          ais.setStackSize( failed.stackSize );
          inv.injectItems( ais, Actionable.MODULATE, mySrc );
        }
View Full Code Here

    int toolPosX = 0;
    int toolPosY = 0;

    for (int z = viewStart; z < Math.min( viewEnd, repo.size() ); z++)
    {
      IAEItemStack refStack = repo.getReferenceItem( z );
      if ( refStack != null )
      {
        GL11.glPushMatrix();
        GL11.glScaled( 0.5, 0.5, 0.5 );

        String str = Long.toString( refStack.getStackSize() );
        if ( refStack.getStackSize() >= 10000 )
          str = Long.toString( refStack.getStackSize() / 1000 ) + "k";

        int w = fontRendererObj.getStringWidth( str );
        fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
            4210752 );

        GL11.glPopMatrix();
        int posX = x * sectionLength + xo + sectionLength - 18;
        int posY = y * 18 + yo;

        if ( tooltip == z - viewStart )
        {
          ToolTip = Platform.getItemDisplayName( repo.getItem( z ) );

          ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
          if ( refStack.getCountRequestable() > 0 )
            ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));

          toolPosX = x * sectionLength + xo + sectionLength - 8;
          toolPosY = y * 18 + yo;
        }

View Full Code Here

    if ( stack != null )
    {
      Slot s = getSlot( mouseX, mouseY );
      if ( s instanceof SlotME )
      {
        IAEItemStack myStack = null;

        try
        {
          SlotME theSlotField = (SlotME) s;
          myStack = theSlotField.getAEStack();
View Full Code Here

  protected void drawItemStackTooltip(ItemStack stack, int x, int y)
  {
    Slot s = getSlot( x, y );
    if ( s instanceof SlotME && stack != null )
    {
      IAEItemStack myStack = null;

      try
      {
        SlotME theSlotField = (SlotME) s;
        myStack = theSlotField.getAEStack();
      }
      catch (Throwable ignore)
      {
      }

      if ( myStack != null )
      {
        List currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );

        while (currentToolTip.size() > 1)
          currentToolTip.remove( 1 );

        currentToolTip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
        currentToolTip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) );

        drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
      }
    }
    // super.drawItemStackTooltip( stack, x, y );
View Full Code Here

      }
      else
      {
        if ( getLink( x ) == null )
        {
          IAEItemStack aisC = ais.copy();
          aisC.setStackSize( itemToCraft );
          setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
        }
      }
    }
    return false;
View Full Code Here

        if ( !proxy.isActive() )
          return false;

        IEnergySource energy = proxy.getEnergy();
        IMEMonitor<IAEItemStack> cell = proxy.getStorage().getItemInventory();
        IAEItemStack input = AEItemStack.create( item );

        if ( ModeB )
        {
          for (int x = 0; x < player.inventory.getSizeInventory(); x++)
          {
            ItemStack targetStack = player.inventory.getStackInSlot( x );
            if ( input.equals( targetStack ) )
            {
              IAEItemStack insertItem = input.copy();
              insertItem.setStackSize( targetStack.stackSize );
              IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, insertItem, new PlayerSource( player, this ) );
              player.inventory.setInventorySlotContents( x, failedToInsert == null ? null : failedToInsert.getItemStack() );
            }
          }
        }
        else
        {
          IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, input, new PlayerSource( player, this ) );
          player.inventory.setInventorySlotContents( player.inventory.currentItem, failedToInsert == null ? null : failedToInsert.getItemStack() );
        }
      }
      catch (GridAccessException e)
      {
        // :P
View Full Code Here

  }

  @Override
  protected void extractItem(EntityPlayer player)
  {
    IAEItemStack input = (IAEItemStack) getDisplayed();
    if ( input != null )
    {
      try
      {
        if ( !proxy.isActive() )
          return;

        IEnergySource energy = proxy.getEnergy();
        IMEMonitor<IAEItemStack> cell = proxy.getStorage().getItemInventory();

        ItemStack is = input.getItemStack();
        input.setStackSize( is.getMaxStackSize() );

        IAEItemStack retrieved = Platform.poweredExtraction( energy, cell, input, new PlayerSource( player, this ) );
        if ( retrieved != null )
        {
          ItemStack newItems = retrieved.getItemStack();
          InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
          newItems = adaptor.addItems( newItems );
          if ( newItems != null )
          {
            TileEntity te = tile;
View Full Code Here

      return;

    if ( (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) != (POWERED_FLAG | CHANNEL_FLAG) )
      return;

    IAEItemStack ais = (IAEItemStack) getDisplayed();
    if ( ais != null )
    {
      GL11.glPushMatrix();
      GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
View Full Code Here

TOP

Related Classes of appeng.api.storage.data.IAEItemStack

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.