Package appeng.util.inv

Examples of appeng.util.inv.WrapperInventoryRange


        InscriberRecipe out = getTask();
        if ( out != null )
        {
          ItemStack is = out.output.copy();
          InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( inv, 3, 1, true ), ForgeDirection.UNKNOWN );

          if ( ad.addItems( is ) == null )
          {
            processingTime = 0;
            if ( out.usePlates )
            {
              setInventorySlotContents( 0, null );
              setInventorySlotContents( 1, null );
            }
            setInventorySlotContents( 2, null );
          }
        }

        markDirty();

      }
      else if ( finalStep == 16 )
      {
        finalStep = 0;
        smash = false;
        markForUpdate();
      }
    }
    else
    {
      IEnergyGrid eg;
      try
      {
        eg = gridProxy.getEnergy();
        IEnergySource src = this;

        // Base 1, increase by 1 for each card
        int speedFactor = 1 + upgrades.getInstalledUpgrades( Upgrades.SPEED );
        int powerConsumption = 10 * speedFactor;
        double powerThreshold = powerConsumption - 0.01;
        double powerReq = extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );

        if ( powerReq <= powerThreshold )
        {
          src = eg;
          powerReq = eg.extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );
        }

        if ( powerReq > powerThreshold )
        {
          src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );

          if ( processingTime == 0 )
            processingTime = processingTime + speedFactor;
          else
            processingTime += TicksSinceLastCall * speedFactor;
        }
      }
      catch (GridAccessException e)
      {
        // :P
      }

      if ( processingTime > maxProcessingTime )
      {
        processingTime = maxProcessingTime;
        InscriberRecipe out = getTask();
        if ( out != null )
        {
          ItemStack is = out.output.copy();
          InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( inv, 3, 1, true ), ForgeDirection.UNKNOWN );
          if ( ad.simulateAdd( is ) == null )
          {
            smash = true;
            finalStep = 0;
            markForUpdate();
View Full Code Here


    return itemsToMove;
  }

  private boolean moveSlot(int x)
  {
    WrapperInventoryRange wir = new WrapperInventoryRange( this, outputSlots, true );
    ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( getStackInSlot( x ) );

    if ( result == null )
    {
      setInventorySlotContents( x, null );
View Full Code Here

    if ( Platform.isClient() )
      return false;

    if ( null == this.getStackInSlot( 6 ) ) // Add if there isn't one...
    {
      IInventory src = new WrapperInventoryRange( this, inputs, true );
      for (int x = 0; x < src.getSizeInventory(); x++)
      {
        ItemStack item = src.getStackInSlot( x );
        if ( item == null )
          continue;

        IGrinderEntry r = AEApi.instance().registries().grinder().getRecipeForInput( item );
        if ( r != null )
        {
          if ( item.stackSize >= r.getInput().stackSize )
          {
            item.stackSize -= r.getInput().stackSize;
            ItemStack ais = item.copy();
            ais.stackSize = r.getInput().stackSize;

            if ( item.stackSize <= 0 )
              item = null;

            src.setInventorySlotContents( x, item );
            this.setInventorySlotContents( 6, ais );
            return true;
          }
        }
      }
View Full Code Here

    {
      if ( r.getEnergyCost() > points )
        return;

      points = 0;
      InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );

      addItem( sia, r.getOutput() );

      float chance = (Platform.getRandomInt() % 2000) / 2000.0f;
      if ( chance <= r.getOptionalChance() )
View Full Code Here

TOP

Related Classes of appeng.util.inv.WrapperInventoryRange

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.