Examples of ItemStack


Examples of net.minecraft.item.ItemStack

      if (storedRequirements.length != 0) {
        for (ItemStack s : storedRequirements) {
          requirements.add(s);
        }
      } else {
        requirements.add(new ItemStack(block, 1, meta));
      }
    }
  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

  public void writeToWorld(IBuilderContext context, int x, int y, int z, LinkedList<ItemStack> stacks) {
    if (isConcrete) {
      if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), x, y, z)) {
        return;
      } else {
        ItemStack stack = stacks.getFirst();

        // force the block to be air block, in case it's just a soft
        // block which replacement is not straightforward
        context.world().setBlock(x, y, z, Blocks.air, 0, 3);

        stack.tryPlaceItemIntoWorld(
            BuildCraftAPI.proxy.getBuildCraftPlayer(context.world()),
            context.world(), x, y, z, 1, 0.0f, 0.0f, 0.0f);
      }
    } else {
      context.world().setBlock(x, y, z, Blocks.air, 0, 3);
View Full Code Here

Examples of net.minecraft.item.ItemStack

   *
   * returns: what was used (similer to req, but created from stack, so that
   * any NBT based differences are drawn from the correct source)
   */
  public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) {
    ItemStack stack = slot.getStackInSlot();
    ItemStack result = stack.copy();

    if (stack.isItemStackDamageable()) {
      if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) {
        stack.setItemDamage(req.getItemDamage() + stack.getItemDamage());
        result.setItemDamage(req.getItemDamage());
        req.stackSize = 0;
      }

      if (stack.getItemDamage() >= stack.getMaxDamage()) {
        slot.decreaseStackInSlot();
      }
    } else {
      if (stack.stackSize >= req.stackSize) {
        result.stackSize = req.stackSize;
        stack.stackSize -= req.stackSize;
        req.stackSize = 0;
      } else {
        req.stackSize -= stack.stackSize;
        stack.stackSize = 0;
      }
    }

    if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) {
      Item container = stack.getItem().getContainerItem();
      ItemStack newStack = new ItemStack(container);
      slot.setStackInSlot(newStack);
    } else if (stack.stackSize == 0) {
      slot.setStackInSlot(null);
    }

View Full Code Here

Examples of net.minecraft.item.ItemStack

    return EnumRarity.uncommon;
  }

  @Override
  public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
    return par2ItemStack.isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 2)) || super.getIsRepairable(par1ItemStack, par2ItemStack);
  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

  }

  @Override
  public IRegisterableResearch getResearchItem() {
    IRegisterableResearch research;
    research = (TTResearchItem) new TTResearchItem(LibResearch.KEY_REVEALING_HELM, new AspectList().add(Aspect.AURA, 2).add(Aspect.ARMOR, 1), 0, 0, 1, new ItemStack(this)).setParents("GOGGLES").setParentsHidden("THAUMIUM");
    ((TTResearchItem) research).setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_REVEALING_HELM));
    return research;

  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

  }

  @Override
  public ThaumicTinkererRecipe getRecipeItem() {
    return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_REVEALING_HELM, LibResearch.KEY_REVEALING_HELM, new ItemStack(this), new AspectList().add(Aspect.EARTH, 5).add(Aspect.FIRE, 5).add(Aspect.WATER, 5).add(Aspect.AIR, 5).add(Aspect.ORDER, 5).add(Aspect.ENTROPY, 5),
        "GH",
        'G', new ItemStack(ConfigItems.itemGoggles),
        'H', new ItemStack(ConfigItems.itemHelmetThaumium));
  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

  }

  @Override
  public IRegisterableResearch getResearchItem() {

    IRegisterableResearch research = (TTResearchItem) new TTResearchItem(LibResearch.KEY_SPELL_CLOTH, new AspectList().add(Aspect.MAGIC, 2).add(Aspect.CLOTH, 1), 3, 2, 2, new ItemStack(this)).setParentsHidden("ENCHFABRIC")
        .setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_SPELL_CLOTH));
    return research;

  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

  }

  @Override
  public ThaumicTinkererRecipe getRecipeItem() {
    return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_SPELL_CLOTH, new ItemStack(this), new ItemStack(ConfigItems.itemResource, 0, 7), new AspectList().add(Aspect.MAGIC, 10).add(Aspect.ENTROPY, 6).add(Aspect.EXCHANGE, 4));

  }
View Full Code Here

Examples of net.minecraft.item.ItemStack

    int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
        TileEntity tile = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();

    if (player.canPlayerEdit(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit, itemstack)) {
      ItemStack stack = getPickedBlock(itemstack);
      if (stack != null) {
        if (mop.sideHit == 0)
          --mop.blockY;
        if (mop.sideHit == 1)
          ++mop.blockY;
        if (mop.sideHit == 2)
          --mop.blockZ;
        if (mop.sideHit == 3)
          ++mop.blockZ;
        if (mop.sideHit == 4)
          --mop.blockX;
        if (mop.sideHit == 5)
          ++mop.blockX;

        if (block.canPlaceBlockOnSide(world, mop.blockX, mop.blockY, mop.blockZ, mop.sideHit)) {
          if (!world.isRemote) {
            world.setBlock(mop.blockX, mop.blockY, mop.blockZ, ((ItemBlock) stack.getItem()).field_150939_a, stack.getItemDamage(), 1 | 2);
            block.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
            NBTTagCompound tileCmp = getStackTileEntity(itemstack);
            if (tileCmp != null && !tileCmp.hasNoTags()) {
              TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
              tile1.xCoord = mop.blockX;
View Full Code Here

Examples of net.minecraft.item.ItemStack

  public String getSortingHelper(ItemStack itemstack) {
    return "DISLOCATION" + getUniqueKey(itemstack);
  }

  public String getUniqueKey(ItemStack itemstack) {
    ItemStack stack = getPickedBlock(itemstack);
    if (stack == null)
      return "";
    String name = stack.getUnlocalizedName();
    int datahash = 0;
    if (stack.getTagCompound() != null) {
      datahash = stack.getTagCompound().hashCode();
    }
    return String.format("%s-%d", name, datahash);
  }
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.