Package net.minecraft.item

Examples of net.minecraft.item.ItemStack.copy()


    ItemStack copystack = null;
    Slot slot = (Slot) inventorySlots.get(slotIndex);
    if(slot != null && slot.getHasStack()) {

      ItemStack origStack = slot.getStack();
      copystack = origStack.copy();

      if(slotDef.isInputSlot(slotIndex) || slotDef.isUpgradeSlot(slotIndex)) {
        // merge from machine input slots to inventory
        if(!mergeItemStack(origStack, startPlayerSlot, endHotBarSlot, false)) {
          return null;
View Full Code Here


        EnchantmentData enchData = enchanter.getCurrentEnchantmentData();
        ItemStack curStack = enchanter.getStackInSlot(1);
        if(enchData == null || curStack == null || enchData.enchantmentLevel >= curStack.stackSize) {
          enchanter.setInventorySlotContents(1, (ItemStack) null);
        } else {
          curStack = curStack.copy();
          curStack.stackSize -= enchData.enchantmentLevel;
          enchanter.setInventorySlotContents(1, curStack);
          enchanter.markDirty();
        }
View Full Code Here

    ItemStack copyStack = null;
    Slot slot = (Slot) this.inventorySlots.get(par2);

    if(slot != null && slot.getHasStack()) {
      ItemStack origStack = slot.getStack();
      copyStack = origStack.copy();

      if(par2 < 2) {
        if(!mergeItemStack(origStack, 2, inventorySlots.size(), true)) {
          return null;
        }
View Full Code Here

  public ItemStack getSeedTypeInSuppliesFor(BlockCoord bc) {
    int slot = getSupplySlotForCoord(bc);
    ItemStack inv = inventory[slot];
    if(inv != null) {
      return inv.copy();
    }
    return null;
  }

  protected int getSupplySlotForCoord(BlockCoord forBlock) {
View Full Code Here

    List<ItemStack> outputStacks = new ArrayList<ItemStack>(slotDefinition.getNumOutputSlots());
    if(slotDefinition.getNumOutputSlots() > 0) {
      for (int i = slotDefinition.minOutputSlot; i <= slotDefinition.maxOutputSlot; i++) {
        ItemStack it = inventory[i];
        if(it != null) {
          it = it.copy();
        }
        outputStacks.add(it);
      }
    }
View Full Code Here

    if(slotDefinition.getNumOutputSlots() > 0) {
      int listIndex = 0;
      for (int i = slotDefinition.minOutputSlot; i <= slotDefinition.maxOutputSlot; i++) {
        ItemStack st = outputStacks.get(listIndex);
        if(st != null) {
          st = st.copy();
        }
        inventory[i] = st;
        listIndex++;
      }
    }
View Full Code Here

    if(slotDefinition.getNumOutputSlots() > 0) {
      boolean allFull = true;
      for (int i = slotDefinition.minOutputSlot; i <= slotDefinition.maxOutputSlot; i++) {
        ItemStack st = inventory[i];
        if(st != null) {
          st = st.copy();
          if(allFull && st.stackSize < st.getMaxStackSize()) {
            allFull = false;
          }
        } else {
          allFull = false;
View Full Code Here

      }
    }

    if(removed) {
      if(!plant(farm, worldObj, bc, (IPlantable) removedPlantable.getItem())) {
        result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, removedPlantable.copy()));
        worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
      }
    } else {
      worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
    }
View Full Code Here

    for (int i = 0; i < slotChecksPerTick; i++) {
      int index = nextSlot(numSlots);
      slot = slotIndices[index];
      ItemStack item = getInventory().getStackInSlot(slot);
      if(canExtractItem(item)) {
        extractItem = item.copy();
        if(getInventory().canExtractItem(slot, extractItem, inventorySide)) {
          if(doTransfer(extractItem, slot, maxExtracted)) {
            setNextStartingSlot(slot);
            return true;
          }
View Full Code Here

    if(curStack != null) {
      if(ticHack) {
        getInventory().decrStackSize(slot, numInserted);
        getInventory().markDirty();
      } else {
        curStack = curStack.copy();
        curStack.stackSize -= numInserted;
        if(curStack.stackSize > 0) {
          getInventory().setInventorySlotContents(slot, curStack);
          getInventory().markDirty();         
        } 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.