Package net.minecraft.src

Examples of net.minecraft.src.ItemStack


    //System.out.println(Temp.ItemID + ":" + this.ItemID + " - " + Temp.ItemDamage + ":" + this.ItemDamage + " - " + Temp.StackSize + ":" + this.StackSize);
    return Temp.ItemID == this.ItemID && (Temp.ItemDamage == this.ItemDamage || this.ItemDamage == -1 || Temp.ItemDamage == -1);
  }
  public ItemStack toItemStack()
  {
    return new ItemStack(ItemID, StackSize, ItemDamage);
  }
View Full Code Here


 
  // Check InventorPlayer contains the ItemStack.
  private int getFirstInventoryPlayerSlotWithItemStack(InventoryPlayer inventory, ItemStack itemstack)
  {
    for(int i = 0; i < inventory.getSizeInventory(); i++) {
      ItemStack itemstack1 = inventory.getStackInSlot(i);
      if(itemstack1 != null
          && itemstack1.itemID == itemstack.itemID
          && (itemstack1.getItemDamage() == itemstack.getItemDamage() || itemstack.getItemDamage() == -1)) {
        return i;
      }
    }
   
    return -1;
View Full Code Here

        for(int k = 0; k < 5; k++) {
            for(int l = 0; l < 8; l++) {
                int i1 = l + (k + j) * 8;
                Slot slot = (Slot)inventorySlots.get(l + k * 8);
                if(i1 >= 0 && i1 < numberOfRecipes) {
                  ItemStack recipeOutput = craftableRecipes.getRecipeOutput(i1);
                  if(recipeOutput != null) {
                    inventory.setInventorySlotContents(l + k * 8, recipeOutput);
                      if(slot instanceof SlotClevercraft) {
                        ((SlotClevercraft)slot).setIRecipe( craftableRecipes.getIRecipe(i1),  craftableRecipes.getListIndex(i1));
                      }
View Full Code Here

            }
        }
  }
  public ItemStack transferStackInSlot(int par1)
    {
        ItemStack var2 = null;
        Slot var3 = (Slot)this.inventorySlots.get(par1);

        if (var3 != null && var3.getHasStack())
        {
            ItemStack var4 = var3.getStack();
            var2 = var4.copy();

            if (par1 < 58 && par1 > 39)
            {
                if (!this.mergeItemStack(var4, 58, 94, true))
                {
View Full Code Here

        && slotIndex >= 0
        && inventorySlots.get(slotIndex) != null
        && inventorySlots.get(slotIndex) instanceof SlotClevercraft) {
     
      // Check if the currently held itemstack is different to the clicked itemstack.
      ItemStack itemstack = inventory.getStackInSlot(slotIndex);
      ItemStack playerItemStack = entityplayer.inventory.getItemStack();
      boolean currentItemStackIsDifferent = false;
      if(playerItemStack != null && itemstack != null) {
        if(playerItemStack.itemID == itemstack.itemID
            && (itemstack.getItemDamage() == -1 || itemstack.getItemDamage() == playerItemStack.getItemDamage())) {
          currentItemStackIsDifferent = false;
        } else {
          currentItemStackIsDifferent = true;
        }
      }
     
      if(currentItemStackIsDifferent)
        return null;
     
      // Ignore right click.
      if(mouseButton == 1) {
        return null;
      } else if(shiftIsDown) {
        onRequestMaximumRecipeOutput( (SlotClevercraft)inventorySlots.get(slotIndex) );
        populateSlotsWithRecipes();
        updateVisibleSlots(ScrollValue);
        return null;
      } else {
        if( !onRequestSingleRecipeOutput( (SlotClevercraft)inventorySlots.get(slotIndex) ) )
          populateSlotsWithRecipes();
          updateVisibleSlots(ScrollValue);
          return null;
      }
    }
   
    if(shiftIsDown) {
      transferStackInSlot(slotIndex);
      populateSlotsWithRecipes();
      updateVisibleSlots(ScrollValue);
      return null;
    } else {
      ItemStack itemstack = super.slotClick(slotIndex, mouseButton, shiftIsDown, entityplayer);
      populateSlotsWithRecipes();
      updateVisibleSlots(ScrollValue);
      return itemstack;
    }
    }
View Full Code Here

  }
 
  public static boolean onRequestSingleRecipeOutput(EntityPlayer thePlayer, IRecipe irecipe, TileEntityCraftingTableII Internal, int RecipeIndex)
  {
   
    ItemStack recipeOutputStack = irecipe.getRecipeOutput().copy();
   
    if (Proxy.IsClient() && Proxy.isMutiplayer())
    {
      mod_CraftingTableIII.getInstance().SendCraftingPacket(irecipe.getRecipeOutput().copy(), false, Internal.xCoord, Internal.yCoord, Internal.zCoord, RecipeIndex);
    }
View Full Code Here

  }
  public static void onRequestMaximumRecipeOutput(EntityPlayer thePlayer, IRecipe irecipe, TileEntityCraftingTableII Internal, int RecipeIndex)
  { 
   
   
    ItemStack recipeOutputStack = irecipe.getRecipeOutput().copy();
    //this.addFavouriteRecipe(irecipe);
   
    if (Proxy.IsClient() && Proxy.isMutiplayer())
    {
      mod_CraftingTableIII.getInstance().SendCraftingPacket(irecipe.getRecipeOutput().copy(), true, Internal.xCoord, Internal.yCoord, Internal.zCoord, RecipeIndex);
View Full Code Here

    ModLoader.takenFromCrafting(thePlayer, recipeOutputStack, craftMatrix);
    ForgeHooks.onTakenFromCrafting(thePlayer, recipeOutputStack, craftMatrix);
    // Remove items from the craftMatrix and replace container items.
    for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
    {
            ItemStack itemstack1 = craftMatrix.getStackInSlot(i);
            if(itemstack1 != null)
            {
                craftMatrix.decrStackSize(i, 1);
                if(itemstack1.getItem().hasContainerItem())
                {
                    craftMatrix.setInventorySlotContents(i, new ItemStack(itemstack1.getItem().getContainerItem()));
                }
            }
        }
        // Transfer any remaining items in the craft matrix to the player.
        for(int i = 0; i < craftMatrix.getSizeInventory(); i++) {
          ItemStack itemstack = craftMatrix.getStackInSlot(i);
          if(itemstack != null) {
            inventoryPlayer.addItemStackToInventory(itemstack);
            craftMatrix.setInventorySlotContents(i, null);
          }
        }
View Full Code Here

 
  public boolean UpdateInventory()
  {
    for (int var1 = 0; var1 < this.inventorySlots.size(); ++var1)
        {
            ItemStack var2 = ((Slot)this.inventorySlots.get(var1)).getStack();
            ItemStack var3 = (ItemStack)this.inventoryItemStacks.get(var1);

            if (!ItemStack.areItemStacksEqual(var3, var2))
            {
                var3 = var2 == null ? null : var2.copy();
                this.inventoryItemStacks.set(var1, var3);
View Full Code Here

  }

  @Override
  public ItemStack decrStackSize(int i, int j) {

    ItemStack newStack = theInventory[i].copy();
    newStack.stackSize = j;
   
    theInventory [i].stackSize -= j;
   
    if (theInventory[i].stackSize == 0) {
View Full Code Here

TOP

Related Classes of net.minecraft.src.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.