Examples of IInventory


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

      Block bBlock = getBlock(par1ItemStack);
      int bmeta = getBlockMeta(par1ItemStack);

      TileEntity tile = par3World.getTileEntity(par4, par5, par6);
      if (tile != null && tile instanceof IInventory) {
        IInventory inv = (IInventory) tile;
        int[] slots = inv instanceof ISidedInventory ? ((ISidedInventory) inv).getAccessibleSlotsFromSide(par7) : TileTransvectorInterface.buildSlotsForLinearInventory(inv);
        for (int slot : slots) {
          ItemStack stackInSlot = inv.getStackInSlot(slot);
          if (stackInSlot == null) {
            ItemStack stack = new ItemStack(bBlock, 1, bmeta);
            int maxSize = stack.getMaxStackSize();
            stack.stackSize = remove(par1ItemStack, maxSize);
            if (stack.stackSize != 0) {
              if (inv.isItemValidForSlot(slot, stack) && (!(inv instanceof ISidedInventory) || ((ISidedInventory) inv).canInsertItem(slot, stack, par7))) {
                inv.setInventorySlotContents(slot, stack);
                inv.markDirty();
                set = true;
              }
            }
          } else if (stackInSlot.getItem() == Item.getItemFromBlock(bBlock) && stackInSlot.getItemDamage() == bmeta) {
            int maxSize = stackInSlot.getMaxStackSize();
            int missing = maxSize - stackInSlot.stackSize;
            if (inv.isItemValidForSlot(slot, stackInSlot) && (!(inv instanceof ISidedInventory) || ((ISidedInventory) inv).canInsertItem(slot, stackInSlot, par7))) {
              stackInSlot.stackSize += remove(par1ItemStack, missing);
              inv.markDirty();
              set = true;
            }
          }
        }
      } else {
View Full Code Here

Examples of net.minecraft.inventory.IInventory

    @Override
    public boolean clearContainerBlockContents(Vector position) {
        checkNotNull(position);
        TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
        if ((tile instanceof IInventory)) {
            IInventory inv = (IInventory) tile;
            int size = inv.getSizeInventory();
            for (int i = 0; i < size; i++) {
                inv.setInventorySlotContents(i, null);
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

  static Method getBaubles;
  /**
   * Retrieves the baubles inventory for the supplied player
   */
  public static IInventory getBaubles(EntityPlayer player) {
    IInventory ot = null;
      try {
          if(getBaubles == null) {
              Class fake = Class.forName("baubles.common.lib.PlayerHandler");
              getBaubles = fake.getMethod("getPlayerBaubles", EntityPlayer.class);
          }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

  @SuppressWarnings("unchecked")
  public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z, EntityPlayer player) {
    super(playerInv, world, x, y, z, player);

    final IInventory outputSlot, inputSlots;
    final int materialCost;

    try {
      outputSlot = (IInventory) _outputSlot.get(this);
      inputSlots = (IInventory) _inputSlots.get(this);
View Full Code Here

Examples of net.minecraft.inventory.IInventory

    }

    Set<ItemStack> controlledStacks = interdictionMatrix.getFilteredItems();

    int confiscationCount = 0;
    IInventory inventory = null;

    if (entityLiving instanceof EntityPlayer)
    {
      IBiometricIdentifier biometricIdentifier = interdictionMatrix.getBiometricIdentifier();

      if (biometricIdentifier != null && biometricIdentifier.isAccessGranted(((EntityPlayer) entityLiving).username, Permission.BYPASS_INTERDICTION_MATRIX))
      {
        return false;
      }

      EntityPlayer player = (EntityPlayer) entityLiving;
      inventory = player.inventory;
    }
    else if (entityLiving instanceof IInventory)
    {
      inventory = (IInventory) entityLiving;
    }

    if (inventory != null)
    {
      for (int i = 0; i < inventory.getSizeInventory(); i++)
      {
        // The ItemStack currently being checked.
        ItemStack checkStack = inventory.getStackInSlot(i);

        if (checkStack != null)
        {
          boolean stacksMatch = false;

          for (ItemStack itemStack : controlledStacks)
          {
            if (itemStack != null)
            {
              if (itemStack.isItemEqual(checkStack))
              {
                stacksMatch = true;
                break;
              }
            }
          }

          if ((interdictionMatrix.getFilterMode() && stacksMatch) || (!interdictionMatrix.getFilterMode() && !stacksMatch))
          {
            interdictionMatrix.mergeIntoInventory(inventory.getStackInSlot(i));
            inventory.setInventorySlotContents(i, null);
            confiscationCount++;
          }
        }
      }
View Full Code Here

Examples of net.minecraft.inventory.IInventory

        ForgeDirection direction = ForgeDirection.getOrientation(dir);
        TileEntity tileEntity = VectorHelper.getTileEntityFromSide(((TileEntity) projector).worldObj, new Vector3((TileEntity) projector), direction);

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

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

            if (checkStack != null)
            {
              EventStabilize evt = new EventStabilize(world, position.intX(), position.intY(), position.intZ(), checkStack);
              MinecraftForge.EVENT_BUS.post(evt);

              if (!evt.isCanceled())
              {
                if (checkStack.getItem() instanceof ItemBlock)
                {
                  if (blockInfo == null || (blockInfo[0] == ((ItemBlock) checkStack.getItem()).getBlockID() && (blockInfo[1] == checkStack.getItemDamage() || projector.getModuleCount(ModularForceFieldSystem.itemModuleApproximation) > 0)) || (projector.getModuleCount(ModularForceFieldSystem.itemModuleApproximation) > 0 && this.isApproximationEqual(blockInfo[0], checkStack)))
                  {
                    try
                    {
                      if (world.canPlaceEntityOnSide(((ItemBlock) checkStack.getItem()).getBlockID(), position.intX(), position.intY(), position.intZ(), false, 0, null, checkStack))
                      {
                        int metadata = blockInfo != null ? blockInfo[1] : (checkStack.getHasSubtypes() ? checkStack.getItemDamage() : 0);
                        Block block = blockInfo != null ? Block.blocksList[blockInfo[0]] : null;

                        if (Blacklist.stabilizationBlacklist.contains(block) || block instanceof BlockFluid || block instanceof IFluidBlock)
                        {
                          return 1;
                        }

                        ItemStack copyStack = checkStack.copy();
                        inventory.decrStackSize(i, 1);
                        ((ItemBlock) copyStack.getItem()).placeBlockAt(copyStack, null, ((TileEntity) projector).worldObj, position.intX(), position.intY(), position.intZ(), 0, 0, 0, 0, metadata);
                        PacketHandler.sendPacketToClients(ModularForceFieldSystem.PACKET_TILE.getPacket((TileEntity) projector, TilePacketType.FXS.ordinal(), 1, position.intX(), position.intY(), position.intZ()), ((TileEntity) projector).worldObj);

                        if (this.blockCount++ >= projector.getModuleCount(ModularForceFieldSystem.itemModuleSpeed) / 3)
                        {
View Full Code Here

Examples of net.minecraft.inventory.IInventory

    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 = rand.nextFloat() * 0.8F + 0.1F;
        float ry = rand.nextFloat() * 0.8F + 0.1F;
View Full Code Here

Examples of net.minecraft.inventory.IInventory

      int _x = x + dir.offsetX;
      int _y = y + dir.offsetY;
      int _z = z + dir.offsetZ;
      TileEntity te = world.getBlockTileEntity( _x, _y, _z );
      if( te != null && InventoryUtils.isValidInventory( te ) ) {
        IInventory inv = InventoryUtils.getInventoryFrom( te, dir.getOpposite() );
        if( inv != null )
          list.add( inv );
      }
    }
    return list;
View Full Code Here

Examples of net.minecraft.inventory.IInventory

  @Override
  public ItemStack getStackInSlot(int i) {
    if( !validIndex( i ))
      return null;
    IInventory inv = getInventoryFromIndex( i );
    int slot = getSlotFromIndex( i );
    return inv.getStackInSlot( slot );
  }
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.