Package net.minecraft.inventory

Examples of net.minecraft.inventory.IInventory


  @Override
  public ItemStack decrStackSize(int i, int j) {
    if( !validIndex( i ))
      return null;
    IInventory inv = getInventoryFromIndex( i );
    int slot = getSlotFromIndex( i );
    return inv.decrStackSize( slot, j );
  }
View Full Code Here


  @Override
  public ItemStack getStackInSlotOnClosing(int i) {
    if( !validIndex( i ))
      return null;
    IInventory inv = getInventoryFromIndex( i );
    int slot = getSlotFromIndex( i );
    return inv.getStackInSlotOnClosing( slot );
  }
View Full Code Here

  @Override
  public void setInventorySlotContents(int i, ItemStack itemstack) {
    if( !validIndex( i ))
      return;
    IInventory inv = getInventoryFromIndex( i );
    int slot = getSlotFromIndex( i );
    inv.setInventorySlotContents( slot, itemstack );
  }
View Full Code Here

  @Override
  public boolean isItemValidForSlot(int i, ItemStack itemstack) {
    if( !validIndex( i ))
      return false;
    IInventory inv = getInventoryFromIndex( i );
    int slot = getSlotFromIndex( i );
    return inv.isItemValidForSlot( slot, itemstack );
  }
View Full Code Here

  }

  public static void despawn(World world, EntityMinecart cart) {

    if(cart instanceof IInventory) {
      IInventory cont = (IInventory) cart;
      for (int i = 0; i < cont.getSizeInventory(); i++) {
        cont.setInventorySlotContents(i, null);
      }
    }

    MinecraftServer minecraftserver = MinecraftServer.getServer();
    WorldServer worldserver = minecraftserver.worldServerForDimension(world.provider.dimensionId);
View Full Code Here

    conMap.put(con.getLocation(), con);

    TileEntity te = con.getBundle().getEntity();
    if(te != null) {
      for (ForgeDirection direction : con.getExternalConnections()) {
        IInventory extCon = con.getExternalInventory(direction);
        if(extCon != null) {
          inventoryAdded(con, direction, te.xCoord + direction.offsetX, te.yCoord + direction.offsetY, te.zCoord + direction.offsetZ, extCon);
        }
      }
    }
View Full Code Here

        }
      }
    }
    else if (tileEntity instanceof IInventory)
    {
      IInventory inventory = (IInventory) tileEntity;

      for (int i = 0; i < inventory.getSizeInventory(); i++)
      {
        ItemStack checkStack = getFirstItemBlock(i, inventory, itemStack);

        if (checkStack != null)
        {
View Full Code Here

  }

  @Override
  public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreDisabled) {
    IInventory inv = getExternalInventory(direction);
    if(inv instanceof ISidedInventory) {
      int[] slots = ((ISidedInventory) inv).getAccessibleSlotsFromSide(direction.getOpposite().ordinal());
      //TODO: The MFR thing is a horrible hack. Blocks like the harvester make no slots accessible but will push into a connected
      //conduit. I could just return true for sided inventories but this will lead to confusing connections in some cases.
      //Therefore, bad hack for now.
      return (slots != null && slots.length != 0) || inv.getClass().getName().startsWith("powercrystals.minefactoryreloaded");
    } else {
      return inv != null;
    }
  }
View Full Code Here

        }

      }
      else if (tileEntity instanceof IInventory)
      {
        IInventory inventory = (IInventory) tileEntity;

        for (int i = 0; i < inventory.getSizeInventory(); i++)
        {
          itemStack = this.addStackToInventory(i, inventory, itemStack);
          if (itemStack == null)
          {
            return null;
View Full Code Here

      {
        return itemStack;
      }
    }

    IInventory inventory = (IInventory)tileEntity;
    ItemStack[] testInv = copyInvFromSide(inventory, side);

    if(testInv == null)
    {
      return itemStack;
    }

    List<TransporterStack> insertQueue = getStacksToDest(Coord4D.get(tileEntity));

    for(TransporterStack tStack : insertQueue)
    {
      testInsert(inventory, testInv, side, tStack);
    }

    ItemStack toInsert = itemStack.copy();

    if(!(inventory instanceof ISidedInventory))
    {
      inventory = InventoryUtils.checkChestInv(inventory);

      for(int i = 0; i <= inventory.getSizeInventory() - 1; i++)
      {
        if(!inventory.isItemValidForSlot(i, toInsert))
        {
          continue;
        }

        ItemStack inSlot = testInv[i];
View Full Code Here

TOP

Related Classes of net.minecraft.inventory.IInventory

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.