Examples of IInventory


Examples of net.minecraft.inventory.IInventory

      }
      else if(getState(stack) == 1) //Empty
      {
        if(tile instanceof IInventory)
        {
          IInventory inv = (IInventory)tile;

          if(!(inv instanceof TileEntityElectricChest) || (((TileEntityElectricChest)inv).canAccess()))
          {
            for(int i = 0; i < inv.getSizeInventory(); i++)
            {
              ItemStack slotStack = inv.getStackInSlot(i);

              if(slotStack != null)
              {
                if(getEnergy(stack) < ENERGY_PER_ITEM_DUMP)
                {
                  break;
                }

                float xRandom = random.nextFloat() * 0.8F + 0.1F;
                float yRandom = random.nextFloat() * 0.8F + 0.1F;
                float zRandom = random.nextFloat() * 0.8F + 0.1F;

                while(slotStack.stackSize > 0)
                {
                  int j = random.nextInt(21) + 10;

                  if(j > slotStack.stackSize)
                  {
                    j = slotStack.stackSize;
                  }

                  slotStack.stackSize -= j;
                  EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage()));

                  if(slotStack.hasTagCompound())
                  {
                    item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
                  }

                  float k = 0.05F;
                  item.motionX = random.nextGaussian() * k;
                  item.motionY = random.nextGaussian() * k + 0.2F;
                  item.motionZ = random.nextGaussian() * k;
                  world.spawnEntityInWorld(item);

                  inv.setInventorySlotContents(i, null);
                  setEnergy(stack, getEnergy(stack) - ENERGY_PER_ITEM_DUMP);
                }
              }
            }

View Full Code Here

Examples of net.minecraft.inventory.IInventory

      {
        return false;
      }
    }

    IInventory inventory = checkChestInv((IInventory)tileEntity);

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

        ItemStack inSlot = inventory.getStackInSlot(i);

        if(inSlot == null)
        {
          return true;
        }
        else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
        {
          if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
          {
            return true;
          }
          else {
            int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();

            if(rejects < itemStack.stackSize)
            {
              return true;
            }
          }
        }
      }
    }
    else {
      ISidedInventory sidedInventory = (ISidedInventory)inventory;
      int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[side]);

      if(slots != null && slots.length != 0)
      {
        if(force && sidedInventory instanceof TileEntityBin && ForgeDirection.OPPOSITES[side] == 0)
        {
          slots = sidedInventory.getAccessibleSlotsFromSide(1);
        }

        for(int get = 0; get <= slots.length - 1; get++)
        {
          int slotID = slots[get];

          if(!force)
          {
            if(!sidedInventory.isItemValidForSlot(slotID, itemStack) || !sidedInventory.canInsertItem(slotID, itemStack, ForgeDirection.OPPOSITES[side]))
            {
              continue;
            }
          }

          ItemStack inSlot = inventory.getStackInSlot(slotID);

          if(inSlot == null)
          {
            return true;
          }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

            {
                final EntityPlayer entityplayer = (EntityPlayer) iterator.next();

                if (entityplayer.openContainer instanceof ContainerChest)
                {
                    final IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();

                    if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this))
                    {
                        ++this.numUsingPlayers;
                    }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

        {
            return true;
        }
        else
        {
            IInventory iinventory = this.getInventory(par1World, par2, par3, par4);

            if (iinventory != null && par5EntityPlayer instanceof EntityPlayerMP)
            {
                par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, par2, par3, par4);
            }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

        if (tileEntity != null)
        {
            if (tileEntity instanceof IInventory)
            {
                IInventory inventory = (IInventory) tileEntity;

                for (int var6 = 0; var6 < inventory.getSizeInventory(); ++var6)
                {
                    ItemStack var7 = inventory.getStackInSlot(var6);

                    if (var7 != null)
                    {
                        Random random = new Random();
                        float var8 = random.nextFloat() * 0.8F + 0.1F;
View Full Code Here

Examples of net.minecraft.inventory.IInventory

            {
                final EntityPlayer entityplayer = (EntityPlayer) iterator.next();

                if (entityplayer.openContainer instanceof ContainerChest)
                {
                    final IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();

                    if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this))
                    {
                        ++this.numUsingPlayers;
                    }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

            {
                final EntityPlayer entityplayer = (EntityPlayer) iterator.next();

                if (entityplayer.openContainer instanceof ContainerChest)
                {
                    final IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();

                    if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this))
                    {
                        ++this.numUsingPlayers;
                    }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

    if (block.hasTileEntity(meta)) {
      TileEntity tile = context.world().getTileEntity(x, y, z);

      if (tile instanceof IInventory) {
        IInventory inv = (IInventory) tile;

        ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();

        for (int i = 0; i < inv.getSizeInventory(); ++i) {
          if (inv.getStackInSlot(i) != null) {
            rqs.add(inv.getStackInSlot(i));
          }
        }

        storedRequirements = JavaTools.concat(storedRequirements,
            rqs.toArray(new ItemStack[rqs.size()]));
View Full Code Here

Examples of net.minecraft.inventory.IInventory

        if (tileEntity != null)
        {
            if (tileEntity instanceof IInventory)
            {
                IInventory inventory = (IInventory) tileEntity;

                for (int var6 = 0; var6 < inventory.getSizeInventory(); ++var6)
                {
                    ItemStack var7 = inventory.getStackInSlot(var6);

                    if (var7 != null)
                    {
                        Random random = new Random();
                        float var8 = random.nextFloat() * 0.8F + 0.1F;
View Full Code Here

Examples of net.minecraft.server.v1_6_R3.IInventory

    return openInventoryWindow(inventory, location, false);
  }

  @Override
  public boolean openInventoryWindow(Inventory inventory, Location location, boolean ignoreDistance) {
    IInventory dialog = ((CraftInventory) inventory).getInventory();
    if (dialog instanceof TileEntityDispenser) {
      getHandle().openDispenser((TileEntityDispenser) dialog);
    } else if (dialog instanceof TileEntityFurnace) {
      getHandle().openFurnace((TileEntityFurnace) dialog);
    } else {
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.