Examples of InventoryAdaptor


Examples of appeng.util.InventoryAdaptor

      for (ForgeDirection s : possibleDirections)
      {
        TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );

        InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
        if ( ad != null )
        {
          if ( ad.simulateRemove( 1, null, null ) == null )
          {
            allAreBusy = false;
            break;
          }
        }
View Full Code Here

Examples of appeng.util.InventoryAdaptor

            return true;
          continue;
        }
      }

      InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
      if ( ad != null )
      {
        if ( isBlocking() )
        {
          if ( ad.simulateRemove( 1, null, null ) != null )
            continue;
        }

        if ( acceptsItems( ad, table ) )
        {
          for (int x = 0; x < table.getSizeInventory(); x++)
          {
            ItemStack is = table.getStackInSlot( x );
            if ( is != null )
            {
              addToSendList( ad.addItems( is ) );
            }
          }
          pushItemsOut( possibleDirections );
          return true;
        }
View Full Code Here

Examples of appeng.util.InventoryAdaptor

      {
        TileEntity te = w.getTileEntity( tile.xCoord + s.offsetX, tile.yCoord + s.offsetY, tile.zCoord + s.offsetZ );
        if ( te == null )
          continue;

        InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
        if ( ad != null )
        {
          ItemStack Result = ad.addItems( whatToSend );

          if ( Result == null )
            whatToSend = null;
          else
            whatToSend.stackSize -= whatToSend.stackSize - Result.stackSize;
View Full Code Here

Examples of appeng.util.InventoryAdaptor

  {
    int slot = craftingTracker.getSlot( link );

    if ( acquired != null && slot >= 0 && slot <= requireWork.length )
    {
      InventoryAdaptor adaptor = getAdaptor( slot );

      if ( mode == Actionable.SIMULATE )
        return AEItemStack.create( adaptor.simulateAdd( acquired.getItemStack() ) );
      else
      {
        IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.getItemStack() ) );
        updatePlan( slot );
        return is;
      }
    }
View Full Code Here

Examples of appeng.util.InventoryAdaptor

    if ( !proxy.isActive() )
      return TickRateModulation.IDLE;

    worked = false;

    InventoryAdaptor myAdaptor = getHandler();
    FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );

    if ( myAdaptor != null )
    {
      try
View Full Code Here

Examples of appeng.util.InventoryAdaptor

      break;
    }

    try
    {
      InventoryAdaptor d = getHandler();
      IMEMonitor<IAEItemStack> inv = proxy.getStorage().getItemInventory();
      IEnergyGrid energy = proxy.getEnergy();
      ICraftingGrid cg = proxy.getCrafting();
      FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
View Full Code Here

Examples of appeng.util.InventoryAdaptor

  }

  @Override
  public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode)
  {
    InventoryAdaptor d = getHandler();

    try
    {
      if ( d != null && proxy.isActive() )
      {
        IEnergyGrid energy = proxy.getEnergy();

        double power = items.getStackSize();
        if ( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
        {
          if ( mode == Actionable.MODULATE )
            return AEItemStack.create( d.addItems( items.getItemStack() ) );
          return AEItemStack.create( d.simulateAdd( items.getItemStack() ) );
        }
      }
    }
    catch (GridAccessException e)
    {
View Full Code Here

Examples of appeng.util.InventoryAdaptor

        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;
            List<ItemStack> list = Arrays.asList( newItems );
            Platform.spawnDrops( player.worldObj, te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, list );
View Full Code Here

Examples of appeng.util.InventoryAdaptor

    {
      put( w, x, y, z, skychest );
      TileEntity te = w.getTileEntity( x, y, z );
      if ( te != null && te instanceof IInventory )
      {
        InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP );

        int primary = Math.max( 1, (int) (Math.random() * 4) );

        if ( primary > 3 ) // in case math breaks...
          primary = 3;

        for (int zz = 0; zz < primary; zz++)
        {
          int r = 0;
          boolean duplicate = false;

          do
          {
            duplicate = false;

            if ( Math.random() > 0.7 )
              r = WorldSettings.getInstance().getNextOrderedValue( "presses" );
            else
              r = (int) (Math.random() * 1000);

            ItemStack toAdd = null;

            switch (r % 4)
            {
            case 0:
              toAdd = AEApi.instance().materials().materialCalcProcessorPress.stack( 1 );
              break;
            case 1:
              toAdd = AEApi.instance().materials().materialEngProcessorPress.stack( 1 );
              break;
            case 2:
              toAdd = AEApi.instance().materials().materialLogicProcessorPress.stack( 1 );
              break;
            case 3:
              toAdd = AEApi.instance().materials().materialSiliconPress.stack( 1 );
              break;
            default:
            }

            if ( toAdd != null )
            {
              if ( ap.simulateRemove( 1, toAdd, null ) == null )
                ap.addItems( toAdd );
              else
                duplicate = true;
            }
          }
          while (duplicate);
        }

        int secondary = Math.max( 1, (int) (Math.random() * 3) );
        for (int zz = 0; zz < secondary; zz++)
        {
          switch ((int) (Math.random() * 1000) % 3)
          {
          case 0:
            ap.addItems( AEApi.instance().blocks().blockSkyStone.stack( (int) (Math.random() * 12) + 1 ) );
            break;
          case 1:
            List<ItemStack> possibles = new LinkedList<ItemStack>();
            possibles.addAll( OreDictionary.getOres( "nuggetIron" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetCopper" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetTin" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetSilver" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetLead" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetPlatinum" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetNickel" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetAluminium" ) );
            possibles.addAll( OreDictionary.getOres( "nuggetElectrum" ) );
            possibles.add( new ItemStack( net.minecraft.init.Items.gold_nugget ) );

            ItemStack nugget = Platform.pickRandom( possibles );
            if ( nugget != null )
            {
              nugget = nugget.copy();
              nugget.stackSize = (int) (Math.random() * 12) + 1;
              ap.addItems( nugget );
            }
            break;
          }
        }
      }
View Full Code Here

Examples of appeng.util.InventoryAdaptor

        IUpgradeModule um = (IUpgradeModule) is.getItem();
        Upgrades u = um.getType( is );

        if ( u != null )
        {
          InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, ForgeDirection.UNKNOWN );
          if ( ad != null )
          {
            if ( player.worldObj.isRemote )
              return false;

            player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( is ) );
            return true;
          }
        }
      }
    }
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.