Examples of IStorageGrid


Examples of appeng.api.networking.storage.IStorageGrid

            IAEItemStack p = out.copy();
            p.reset();
            p.setStackSize( out.getCountRequestable() );

            IStorageGrid sg = getGrid().getCache( IStorageGrid.class );
            IMEInventory<IAEItemStack> items = sg.getItemInventory();

            if ( c != null && result.isSimulation() )
            {
              m = o.copy();
              o = items.extractItems( o, Actionable.SIMULATE, mySrc );
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

    prophecies = new HashSet<IAEItemStack>();
    this.actionSrc = actionSrc;

    this.callback = callback;
    ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
    IStorageGrid sg = grid.getCache( IStorageGrid.class );
    original = new MECraftingInventory( sg.getItemInventory(), actionSrc, false, false, false );

    tree = getCraftingTree( cc, what );
    availableCheck = null;
  }
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

  {
    IGrid grid = getGrid();
    if ( grid == null )
      throw new GridAccessException();

    IStorageGrid pg = grid.getCache( IStorageGrid.class );

    if ( pg == null )
      throw new GridAccessException();

    return pg;
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

        int y = te.yCoord + side.offsetY;
        int z = te.zCoord + side.offsetZ;

        Block blk = w.getBlock( x, y, z );

        IStorageGrid storage = proxy.getStorage();
        IEnergyGrid energy = proxy.getEnergy();

        Material mat = blk.getMaterial();
        boolean ignore = mat == Material.air || mat == Material.lava || mat == Material.water || mat.isLiquid() || blk == Blocks.bedrock
            || blk == Blocks.end_portal || blk == Blocks.end_portal_frame || blk == Blocks.command_block;

        if ( !ignore )
        {
          if ( !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
          {
            float hardness = blk.getBlockHardness( w, x, y, z );
            if ( hardness >= 0.0 )
            {
              ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
              float total = 1 + hardness;
              for (ItemStack is : out)
                total += is.stackSize;

              boolean hasPower = energy.extractAEPower( total, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > total - 0.1;
              if ( hasPower )
              {
                if ( eatForReal )
                {
                  energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
                  w.setBlock( x, y, z, Platform.air, 0, 3 );

                  AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
                  for (Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ))
                  {
                    if ( ei instanceof EntityItem )
                    {
                      EntityItem item = (EntityItem) ei;
                      if ( !item.isDead )
                      {
                        IAEItemStack storedItem = AEItemStack.create( item.getEntityItem() );
                        storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
                        if ( storedItem != null )
                          Buffer.add( storedItem );

                        item.setDead();
                      }
                    }
                  }

                  ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, side, true ) );

                  for (ItemStack snaggedItem : out)
                  {
                    IAEItemStack storedItem = AEItemStack.create( snaggedItem );
                    storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
                    if ( storedItem != null )
                      Buffer.add( storedItem );
                  }

                  return TickRateModulation.URGENT;
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

  private void storeBuffer()
  {
    try
    {
      IStorageGrid storage = proxy.getStorage();
      IEnergyGrid energy = proxy.getEnergy();

      while (!Buffer.isEmpty())
      {
        IAEItemStack storedItem = Buffer.pop();
        storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
        if ( storedItem != null )
        {
          Buffer.add( storedItem );
          break;
        }
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

  {
    IGrid g = getGrid();
    if ( g == null )
      return;

    IStorageGrid sg = g.getCache( IStorageGrid.class );
    IMEInventory<IAEItemStack> ii = sg.getItemInventory();

    for (IAEItemStack is : inventory.getItemList())
    {
      is = inventory.extractItems( is.copy(), Actionable.MODULATE, machineSrc );
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

      return null;

    if ( isBusy() || !isActive() || getAvailableStorage() < job.getByteTotal() )
      return null;

    IStorageGrid sg = g.getCache( IStorageGrid.class );
    IMEInventory<IAEItemStack> storage = sg.getItemInventory();
    MECraftingInventory ci = new MECraftingInventory( storage, true, false, false );

    try
    {
      waitingFor.resetStatus();
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

      {
        IGrid grid = node.getGrid();
        if ( grid == null )
          return;

        IStorageGrid inv = grid.getCache( IStorageGrid.class );
        IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
        ISecurityGrid security = grid.getCache( ISecurityGrid.class );
        IInventory craftMatrix = cct.getInventoryByName( "crafting" );

        Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;

        if ( inv != null && recipe != null && security != null )
        {
          InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
          for (int x = 0; x < 9; x++)
          {
            if ( recipe[x] != null && recipe[x].length > 0 )
            {
              ic.setInventorySlotContents( x, recipe[x][0] );
            }
          }

          IRecipe r = Platform.findMatchingRecipe( ic, pmp.worldObj );

          if ( r != null && security.hasPermission( player, SecurityPermissions.EXTRACT ) )
          {
            ItemStack is = r.getCraftingResult( ic );

            if ( is != null )
            {
              IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
              IItemList all = storage.getStorageList();
              IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );

              for (int x = 0; x < craftMatrix.getSizeInventory(); x++)
              {
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

      try
      {
        gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );

        IStorageGrid gs = gridProxy.getStorage();
        Platform.postChanges( gs, removed, added, mySrc );
      }
      catch (GridAccessException ignored)
      {
View Full Code Here

Examples of appeng.api.networking.storage.IStorageGrid

    try
    {
      gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );

      IStorageGrid gs = gridProxy.getStorage();
      Platform.postChanges( gs, removed, added, mySrc );
    }
    catch (GridAccessException ignored)
    {
    }
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.