Examples of IAEItemStack


Examples of appeng.api.storage.data.IAEItemStack

      {
        if ( parent.details.isValidItemForSlot( slot, fuzz.getItemStack(), world ) )
        {
          fuzz = fuzz.copy();
          fuzz.setStackSize( l );
          IAEItemStack available = inv.extractItems( fuzz, Actionable.MODULATE, src );

          if ( available != null )
          {
            if ( !exhausted )
            {
              IAEItemStack is = job.checkUse( available );
              if ( is != null )
              {
                thingsUsed.add( is.copy() );
                used.add( is );
              }
            }

            bytes += available.getStackSize();
            l -= available.getStackSize();

            if ( l == 0 )
              return available;
          }
        }
      }
    }
    else
    {
      IAEItemStack available = inv.extractItems( what, Actionable.MODULATE, src );

      if ( available != null )
      {
        if ( !exhausted )
        {
          IAEItemStack is = job.checkUse( available );
          if ( is != null )
          {
            thingsUsed.add( is.copy() );
            used.add( is );
          }
        }

        bytes += available.getStackSize();
        l -= available.getStackSize();

        if ( l == 0 )
          return available;
      }
    }

    if ( canEmit )
    {
      IAEItemStack wat = what.copy();
      wat.setStackSize( l );

      howManyEmitted = wat.getStackSize();
      bytes += wat.getStackSize();

      return wat;
    }

    exhausted = true;

    if ( nodes.size() == 1 )
    {
      CraftingTreeProcess pro = nodes.get( 0 );

      while (pro.possible && l > 0)
      {
        IAEItemStack madeWhat = pro.getAmountCrafted( what );

        pro.request( inv, pro.getTimes( l, madeWhat.getStackSize() ), src );

        madeWhat.setStackSize( l );
        IAEItemStack available = inv.extractItems( madeWhat, Actionable.MODULATE, src );

        if ( available != null )
        {
          bytes += available.getStackSize();
          l -= available.getStackSize();

          if ( l <= 0 )
            return available;
        }
        else
          pro.possible = false; // ;P
      }
    }
    else if ( nodes.size() > 1 )
    {
      for (CraftingTreeProcess pro : nodes)
      {
        try
        {
          while (pro.possible && l > 0)
          {
            MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
            pro.request( subInv, 1, src );

            what.setStackSize( l );
            IAEItemStack available = subInv.extractItems( what, Actionable.MODULATE, src );

            if ( available != null )
            {
              if ( !subInv.commit( src ) )
                throw new CraftBranchFailure( what, l );

              bytes += available.getStackSize();
              l -= available.getStackSize();

              if ( l <= 0 )
                return available;
            }
            else
              pro.possible = false; // ;P
          }
        }
        catch (CraftBranchFailure fail)
        {
          pro.possible = true;
        }
      }
    }

    if ( sim )
    {
      missing += l;
      bytes += l;
      IAEItemStack rv = what.copy();
      rv.setStackSize( l );
      return rv;
    }

    for (IAEItemStack o : thingsUsed)
    {
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

    IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();

    int slotsToUse = 18 + getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
    for (int x = 0; x < Config.getSizeInventory() && x < slotsToUse; x++)
    {
      IAEItemStack is = Config.getAEStackInSlot( x );
      if ( is != null )
        priorityList.add( is );
    }

    if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

    else
    {
      try
      {
        IMEInventory<IAEItemStack> cell = getHandler( StorageChannel.ITEMS );
        IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, mySrc );
        return returns == null || returns.getStackSize() != itemstack.stackSize;
      }
      catch (ChestNoHandler ignored)
      {
      }
    }
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

    blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );

    if ( worked )
    {
      IAEItemStack out = input.copy();
      out.decStackSize( maxStorage );
      if ( out.getStackSize() == 0 )
        return null;
      return out;
    }

    return input;
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

  public void setJob(MECraftingInventory storage, CraftingCPUCluster craftingCPUCluster, BaseActionSource src) throws CraftBranchFailure
  {
    for (IAEItemStack i : used)
    {
      IAEItemStack ex = storage.extractItems( i, Actionable.MODULATE, src );

      if ( ex == null || ex.getStackSize() != i.getStackSize() )
        throw new CraftBranchFailure( i, i.getStackSize() );

      craftingCPUCluster.addStorage( ex );
    }

    if ( howManyEmitted > 0 )
    {
      IAEItemStack i = what.copy();
      i.setStackSize( howManyEmitted );
      craftingCPUCluster.addEmitable( i );
    }

    for (CraftingTreeProcess pro : nodes)
      pro.setJob( storage, craftingCPUCluster, src );
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

  public void getPlan(IItemList<IAEItemStack> plan)
  {
    if ( missing > 0 )
    {
      IAEItemStack o = what.copy();
      o.setStackSize( missing );
      plan.add( o );
    }

    if ( howManyEmitted > 0 )
    {
      IAEItemStack i = what.copy();
      i.setCountRequestable( howManyEmitted );
      plan.addRequestable( i );
    }

    for (IAEItemStack i : used)
      plan.add( i.copy() );

    for (CraftingTreeProcess pro : nodes)
      pro.getPlan( plan );
  }
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

        ejectHeldItems();

        try
        {
          TargetPoint where = new TargetPoint( worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32 );
          IAEItemStack item = AEItemStack.create( output );
          NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( xCoord, yCoord, zCoord, (byte) speed, item ), where );
        }
        catch (IOException e)
        {
          // ;P
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

  public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
  {
    if ( request == null )
      return null;

    IAEItemStack list = localCache.findPrecise( request );
    if ( list == null || list.getStackSize() == 0 )
      return null;

    if ( list.getStackSize() >= request.getStackSize() )
    {
      if ( mode == Actionable.MODULATE )
      {
        list.decStackSize( request.getStackSize() );
        if ( logExtracted )
          extractedCache.add( request );
      }

      return request;
    }

    IAEItemStack ret = request.copy();
    ret.setStackSize( list.getStackSize() );

    if ( mode == Actionable.MODULATE )
    {
      list.reset();
      if ( logExtracted )
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

    if ( logInjections )
    {
      for (IAEItemStack inject : injectedCache)
      {
        IAEItemStack result = null;
        added.add( result = target.injectItems( inject, Actionable.MODULATE, src ) );

        if ( result != null )
        {
          failed = true;
          break;
        }
      }
    }

    if ( failed )
    {
      for (IAEItemStack is : added)
        target.extractItems( is, Actionable.MODULATE, src );

      return false;
    }

    if ( logExtracted )
    {
      for (IAEItemStack extra : extractedCache)
      {
        IAEItemStack result = null;
        pulled.add( result = target.extractItems( extra, Actionable.MODULATE, src ) );

        if ( result == null || result.getStackSize() != extra.getStackSize() )
        {
          failed = true;
          break;
        }
      }
View Full Code Here

Examples of appeng.api.storage.data.IAEItemStack

    missingCache.add( extra );
  }

  public void ignore(IAEItemStack what)
  {
    IAEItemStack list = localCache.findPrecise( what );
    if ( list != null )
      list.setStackSize( 0 );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.