Package net.minecraft.item

Examples of net.minecraft.item.ItemStack


    if (player.capabilities.isCreativeMode)
      return;

    List<ItemStack> talismansToCheck = new ArrayList();
    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
      ItemStack stackInSlot = player.inventory.getStackInSlot(i);
      if (stackInSlot != null && stackInSlot.getItem() == blockToPlace.getItem() && stackInSlot.getItemDamage() == blockToPlace.getItemDamage()) {
        stackInSlot.stackSize--;
        if (stackInSlot.stackSize == 0)
          player.inventory.setInventorySlotContents(i, null);

        return;
      }

      if (stackInSlot != null && stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
        talismansToCheck.add(stackInSlot);
    }

    for (ItemStack talisman : talismansToCheck) {
      Block block = ItemBlockTalisman.getBlock(talisman);
View Full Code Here


    if (player.capabilities.isCreativeMode)
      return true;

    int required = blocks.length;
    int current = 0;
    ItemStack reqStack = new ItemStack(getBlock(stack), 1, getBlockMeta(stack));
    List<ItemStack> talismansToCheck = new ArrayList();
    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
      ItemStack stackInSlot = player.inventory.getStackInSlot(i);
      if (stackInSlot != null && stackInSlot.getItem() == reqStack.getItem() && stackInSlot.getItemDamage() == reqStack.getItemDamage()) {
        current += stackInSlot.stackSize;
        if (current >= required)
          return true;
      }
      if (stackInSlot != null && stackInSlot.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class))
        talismansToCheck.add(stackInSlot);
    }

    for (ItemStack talisman : talismansToCheck) {
      Block block = ItemBlockTalisman.getBlock(talisman);
View Full Code Here

    Block block = getBlock(par1ItemStack);
    int size = getSize(par1ItemStack);

    par3List.add(size + " x " + size);
    if (block != null && block != Blocks.air)
      par3List.add(StatCollector.translateToLocal(new ItemStack(block, 1, getBlockMeta(par1ItemStack)).getUnlocalizedName() + ".name"));
  }
View Full Code Here

    return LibItemNames.PLACEMENT_MIRROR;
  }

  @Override
  public IRegisterableResearch getResearchItem() {
    return (IRegisterableResearch) new KamiResearchItem(LibResearch.KEY_PLACEMENT_MIRROR, new AspectList().add(Aspect.CRAFT, 2).add(Aspect.CRYSTAL, 1).add(Aspect.ELDRITCH, 1).add(Aspect.MIND, 1), 17, 16, 5, new ItemStack(this)).setParents(LibResearch.KEY_BLOCK_TALISMAN)
        .setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_PLACEMENT_MIRROR));

  }
View Full Code Here

  }

  @Override
  public ThaumicTinkererRecipe getRecipeItem() {
    return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_PLACEMENT_MIRROR, new ItemStack(this), 12, new AspectList().add(Aspect.CRAFT, 65).add(Aspect.CRYSTAL, 32).add(Aspect.MAGIC, 50).add(Aspect.MIND, 32), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBlockTalisman.class)),
        new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)), new ItemStack(Blocks.dropper), new ItemStack(Items.diamond), new ItemStack(Blocks.glass), new ItemStack(Items.blaze_powder), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)));

  }
View Full Code Here

    return null;
  }

  @Override
  public ThaumicTinkererRecipe getRecipeItem() {
    return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_SKY_PEARL, LibResearch.KEY_WARP_GATE, new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemSkyPearl.class), 2), 6, new AspectList().add(Aspect.TRAVEL, 32).add(Aspect.ELDRITCH, 32).add(Aspect.FLIGHT, 32).add(Aspect.AIR, 16), new ItemStack(Items.ender_pearl),
        new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class), 1, 7), new ItemStack(Blocks.lapis_block), new ItemStack(Items.diamond));

  }
View Full Code Here

  protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1F, 1F, 1F, 1F);
    mc.renderEngine.bindTexture(gui);
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

    ItemStack itemToEnchant = enchanter.getStackInSlot(0);
    if (enchantButtons[8].enabled) {
      if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
        drawTexturedModalRect(x + 30, y + 26, 0, ySize, 147, 24);
    }

    if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
      drawTexturedModalRect(x + 30, y + 50, 0, ySize, 147, 24);

    if (!enchanter.enchantments.isEmpty()) {
      int x = this.x + 40;
      GL11.glEnable(GL11.GL_BLEND);
View Full Code Here

      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 {
        int remove = remove(par1ItemStack, 1);
        if (remove > 0) {
          Item.getItemFromBlock(bBlock).onItemUse(new ItemStack(bBlock, 1, bmeta), par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
          set = true;
        }
      }
    }
View Full Code Here

  @SideOnly(Side.CLIENT)
  public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    Block block = getBlock(par1ItemStack);
    if (block != null && block != Blocks.air) {
      int count = getBlockCount(par1ItemStack);
      par3List.add(StatCollector.translateToLocal(new ItemStack(block, 1, getBlockMeta(par1ItemStack)).getUnlocalizedName() + ".name") + " (x" + count + ")");
    }

    if (par1ItemStack.getItemDamage() == 1)
      par3List.add(StatCollector.translateToLocal("ttmisc.active"));
    else par3List.add(StatCollector.translateToLocal("ttmisc.inactive"));
View Full Code Here

      boolean hasFreeSlot = false;
      int[] counts = new int[player.inventory.getSizeInventory() - player.inventory.armorInventory.length];
      Arrays.fill(counts, 0);

      for (int i = 0; i < counts.length; i++) {
        ItemStack stack = player.inventory.getStackInSlot(i);
        if (stack == null) {
          hasFreeSlot = true;
          continue;
        }

        if (Item.getItemFromBlock(block) == stack.getItem() && stack.getItemDamage() == meta) {
          counts[i] = stack.stackSize;
          if (highest == -1)
            highest = i;
          else highest = counts[i] > counts[highest] && highest > 8 ? i : highest;
        }
      }

      if (highest == -1) {
        ItemStack heldItem = player.inventory.getItemStack();
        if (hasFreeSlot && (heldItem == null || Item.getItemFromBlock(block) == heldItem.getItem() || heldItem.getItemDamage() != meta)) {
          ItemStack stack = new ItemStack(block, remove(itemstack, 64), meta);
          if (stack.stackSize != 0)
            player.inventory.addItemStackToInventory(stack);
        }
      } else {
        for (int i = 0; i < counts.length; i++) {
          int count = counts[i];

          if (i == highest || count == 0)
            continue;

          add(itemstack, count);
          player.inventory.setInventorySlotContents(i, null);
        }

        int countInHighest = counts[highest];
        int maxSize = new ItemStack(block, 1, meta).getMaxStackSize();
        if (countInHighest < maxSize) {
          int missing = maxSize - countInHighest;
          ItemStack stackInHighest = player.inventory.getStackInSlot(highest);
          stackInHighest.stackSize += remove(itemstack, missing);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.item.ItemStack

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.