Package net.minecraft.inventory

Examples of net.minecraft.inventory.IInventory


      if(item.age < 60 || item.age >= 105 && item.age < 110 || item.isDead)
        continue;

      ItemStack stack = item.getEntityItem();

      IInventory invToPutItemIn = null;
      ForgeDirection sideToPutItemIn = ForgeDirection.UNKNOWN;
      boolean priorityInv = false;

      for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
        int x_ = x + dir.offsetX;
        int y_ = y + dir.offsetY;
        int z_ = z + dir.offsetZ;

        IInventory inv = InventoryHelper.getInventory(supertile.getWorldObj(), x_, y_, z_);
        if(inv != null) {
          List<ItemStack> filter = getFilterForInventory(inv, x_, y_, z_, true);
          boolean canAccept = canAcceptItem(stack, filter, filterType);
          int stackSize = InventoryHelper.testInventoryInsertion(inv, stack, dir);
          canAccept &= stackSize == stack.stackSize;
View Full Code Here


            return new Object[]{tileEntity.getOutput()};
        }

        @Callback(doc = "function():number -- Returns the durability of the rotor in percent.")
        public Object[] getTurbineRotorStatus(final Context context, final Arguments args) {
            final IInventory inventory = tileEntity.getInventory();
            if (inventory != null && inventory.getSizeInventory() > 0) {
                final ItemStack itemStack = inventory.getStackInSlot(0);
                if (itemStack != null) {
                    return new Object[]{100 - (int) (itemStack.getItemDamage() * 100.0 / itemStack.getMaxDamage())};
                }
            }
            return new Object[]{0};
View Full Code Here

  {
    TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
    if (!(tileEntity instanceof IInventory)) {
      return;
    }
    IInventory inventory = (IInventory) tileEntity;

    for (int i = 0; i < inventory.getSizeInventory(); i++) {
      ItemStack item = inventory.getStackInSlot(i);

      if (item != null && item.stackSize > 0) {
        float rx = Utility.rng.nextFloat() * 0.8F + 0.1F;
        float ry = Utility.rng.nextFloat() * 0.8F + 0.1F;
        float rz = Utility.rng.nextFloat() * 0.8F + 0.1F;
View Full Code Here

   */
  public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
    if(stack == null)
      return 0;

    IInventory mainInv = player.inventory;
    IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);

    int invSize = mainInv.getSizeInventory();
    int size = invSize;
    if(baublesInv != null)
      size += baublesInv.getSizeInventory();

    for(int i = 0; i < size; i++) {
      boolean useBaubles = i >= invSize;
      IInventory inv = useBaubles ? baublesInv : mainInv;
      ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
      if(stackInSlot == stack)
        continue;

      if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
        IManaItem manaItem = (IManaItem) stackInSlot.getItem();
View Full Code Here

   */
  public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
    if(stack == null)
      return false;

    IInventory mainInv = player.inventory;
    IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);

    int invSize = mainInv.getSizeInventory();
    int size = invSize;
    if(baublesInv != null)
      size += baublesInv.getSizeInventory();

    for(int i = 0; i < size; i++) {
      boolean useBaubles = i >= invSize;
      IInventory inv = useBaubles ? baublesInv : mainInv;
      ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
      if(stackInSlot == stack)
        continue;

      if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
        IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
View Full Code Here

   */
  public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
    if(stack == null)
      return 0;

    IInventory mainInv = player.inventory;
    IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);

    int invSize = mainInv.getSizeInventory();
    int size = invSize;
    if(baublesInv != null)
      size += baublesInv.getSizeInventory();

    for(int i = 0; i < size; i++) {
      boolean useBaubles = i >= invSize;
      IInventory inv = useBaubles ? baublesInv : mainInv;
      ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
      if(stackInSlot == stack)
        continue;

      if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
        IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
View Full Code Here

   */
  public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
    if(stack == null)
      return false;

    IInventory mainInv = player.inventory;
    IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);

    int invSize = mainInv.getSizeInventory();
    int size = invSize;
    if(baublesInv != null)
      size += baublesInv.getSizeInventory();

    for(int i = 0; i < size; i++) {
      boolean useBaubles = i >= invSize;
      IInventory inv = useBaubles ? baublesInv : mainInv;
      ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
      if(stackInSlot == stack)
        continue;

      if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
        IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
View Full Code Here

    @Override
    @SideOnly(Side.CLIENT)
    public IMessage onMessage(MessageOpenBackpack message, MessageContext ctx) {
        EntityPlayer entityPlayer = Minecraft.getMinecraft().thePlayer;

        IInventory backpackInventory = new InventoryBasic(message.name, message.customName, message.size);

        NBTTagCompound nbtTagCompound = new NBTTagCompound();
        NBTUtil.setString(nbtTagCompound, Constants.NBT.UID, message.uuid);
        NBTUtil.setByte(nbtTagCompound, Constants.NBT.TYPE, message.type);
        NBTUtil.setInteger(nbtTagCompound, Constants.NBT.SLOTS_PER_ROW, message.slotsPerRow);
View Full Code Here

              if(stack.pathType != Path.NONE)
              {
                if(next != null && next.getTileEntity(world()) instanceof IInventory)
                {
                  needsSync.add(stack);
                  IInventory inventory = (IInventory)next.getTileEntity(world());

                  if(inventory != null)
                  {
                    ItemStack rejected = InventoryUtils.putStackInInventory(inventory, stack.itemStack, stack.getSide(this), stack.pathType == Path.HOME);
View Full Code Here

      {
        TileEntity tile = Coord4D.get(tile()).getFromSide(side).getTileEntity(world());

        if(tile instanceof IInventory)
        {
          IInventory inv = (IInventory)tile;
          InvStack stack = InventoryUtils.takeTopItem(inv, side.getOpposite().ordinal());

          if(stack != null && stack.getStack() != null)
          {
            ItemStack rejects = TransporterUtils.insert(tile, this, stack.getStack(), color, true, 0);
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.