Package appeng.util.inv

Examples of appeng.util.inv.AdaptorIInventory


      InventoryAdaptor playerHand = new AdaptorPlayerHand( player );

      WrapperInvSlot slotInv = new PatternInvSlot( inv.server );

      IInventory theSlot = slotInv.getWrapper( slot );
      InventoryAdaptor interfaceSlot = new AdaptorIInventory( theSlot );

      switch (action)
      {
      case PICKUP_OR_SET_DOWN:

        if ( hasItemInHand )
        {
          ItemStack inSlot = theSlot.getStackInSlot( 0 );
          if ( inSlot == null )
            player.inventory.setItemStack( interfaceSlot.addItems( player.inventory.getItemStack() ) );
          else
          {
            inSlot = inSlot.copy();
            ItemStack inHand = player.inventory.getItemStack().copy();

            theSlot.setInventorySlotContents( 0, null );
            player.inventory.setItemStack( null );

            player.inventory.setItemStack( interfaceSlot.addItems( inHand.copy() ) );

            if ( player.inventory.getItemStack() == null )
              player.inventory.setItemStack( inSlot );
            else
            {
              player.inventory.setItemStack( inHand );
              theSlot.setInventorySlotContents( 0, inSlot );
            }
          }
        }
        else
        {
          IInventory mySlot = slotInv.getWrapper( slot );
          mySlot.setInventorySlotContents( 0, playerHand.addItems( mySlot.getStackInSlot( 0 ) ) );
        }

        break;
      case SPLIT_OR_PLACE_SINGLE:

        if ( hasItemInHand )
        {
          ItemStack extra = playerHand.removeItems( 1, null, null );
          if ( extra != null )
            extra = interfaceSlot.addItems( extra );
          if ( extra != null )
            playerHand.addItems( extra );
        }
        else if ( is != null )
        {
          ItemStack extra = interfaceSlot.removeItems( (is.stackSize + 1) / 2, null, null );
          if ( extra != null )
            extra = playerHand.addItems( extra );
          if ( extra != null )
            interfaceSlot.addItems( extra );
        }

        break;
      case SHIFT_CLICK:
View Full Code Here


   
    IBetterStorage bs = (IBetterStorage) (AppEng.instance.isIntegrationEnabled( IntegrationType.BetterStorage ) ? AppEng.instance.getIntegration( IntegrationType.BetterStorage ) : null);
   
    if ( te instanceof EntityPlayer )
    {
      return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory, false ) );
    }
    else if ( te instanceof ArrayList )
    {
      return new AdaptorList( (ArrayList<ItemStack>) te );
    }
    else if ( bs != null && bs.isStorageCrate( te )  )
    {
      return bs.getAdaptor( te, d );
    }
    else if ( te instanceof TileEntityChest )
    {
      return new AdaptorIInventory( Platform.GetChestInv( te ) );
    }
    else if ( isSpecialInventory( te ) )
    {
      return new AdaptorISpecialInventory( (ISpecialInventory) te, d );
    }
    else if ( te instanceof ISidedInventory )
    {
      ISidedInventory si =(ISidedInventory)te;
      int[] slots = si.getAccessibleSlotsFromSide( d.ordinal() );
      if ( si.getSizeInventory() > 0 && slots != null && slots.length > 0 )
        return new AdaptorIInventory( new WrapperMCISidedInventory( si, d ) );
    }
    else if ( te instanceof IInventory )
    {
      IInventory i =(IInventory)te;
      if ( i.getSizeInventory() > 0 )
        return new AdaptorIInventory( i );
    }

    return null;
  }
View Full Code Here

  final WrapperInvSlot slotInv = new WrapperInvSlot( storage );

  private InventoryAdaptor getAdaptor(int slot)
  {
    return new AdaptorIInventory( slotInv.getWrapper( slot ) );
  }
View Full Code Here

  class InterfaceInventory extends MEMonitorIInventory
  {

    public InterfaceInventory(DualityInterface tileInterface) {
      super( new AdaptorIInventory( tileInterface.storage ) );
      mySource = new MachineSource( iHost );
    }
View Full Code Here

TOP

Related Classes of appeng.util.inv.AdaptorIInventory

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.