Examples of canTakeStack()


Examples of net.minecraft.inventory.Slot.canTakeStack()

          // Override default behavior to use putStack
          // instead of manipulating stackSize directly.
          ItemStack slotStack = slot.getStack();
          ItemStack holding = player.inventory.getItemStack();
          if ((slotStack != null) && (holding != null) &&
              ((holding == null) ? slot.canTakeStack(player) : slot.isItemValid(holding)) &&
              StackUtils.matches(slotStack, holding)) {
            int amount = ((button == 0) ? holding.stackSize : 1);
            amount = Math.min(amount, slot.getSlotStackLimit() - slotStack.stackSize);
            amount = Math.min(amount, slotStack.getMaxStackSize() - slotStack.stackSize);
            if (amount > 0) {
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

          }
        }
      } else if (special == 1) {
        // Override default shift-click so it doesn't call
        // retrySlotClick, whatever that was meant for.
        return (slot.canTakeStack(player) ? transferStackInSlot(player, slotId) : null);
      } else if ((special == 2) && (button >= 0) && (button < 9)) {
        // Override default hotbar switching to make sure
        // the items can be taken and put into those slots.
        if (startHotbar < 0) return null;
        Slot slot2 = (Slot)inventorySlots.get(startHotbar + button);
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

        // Override default hotbar switching to make sure
        // the items can be taken and put into those slots.
        if (startHotbar < 0) return null;
        Slot slot2 = (Slot)inventorySlots.get(startHotbar + button);
        ItemStack stack = slot.getStack();
        if (!slot2.canTakeStack(player) ||
            ((stack != null) && !slot2.isItemValid(stack)))
          return null;
      }
    }
    return super.slotClick(slotId, button, special, player);
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

        } else if(par3 == 1) {
          if(par1 < 0) { return null; }
         
          slot2 = (Slot)this.inventorySlots.get(par1);
         
          if(slot2 != null && slot2.canTakeStack(par4EntityPlayer)) {
            itemstack3 = this.transferStackInSlot(par4EntityPlayer, par1);
           
            if(itemstack3 != null) {
              Item item = itemstack3.getItem();
              itemstack = itemstack3.copy();
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

               
                if(itemstack4.stackSize == 0) {
                  inventoryplayer.setItemStack((ItemStack)null);
                }
              }
            } else if(slot2.canTakeStack(par4EntityPlayer)) {
              if(itemstack4 == null) {
                l1 = par2 == 0 ? itemstack3.stackSize : (itemstack3.stackSize + 1) / 2;
                itemstack5 = slot2.decrStackSize(l1);
                inventoryplayer.setItemStack(itemstack5);
               
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

          }
        }
      } else if(par3 == 2 && par2 >= 0 && par2 < 9) {
        slot2 = (Slot)this.inventorySlots.get(par1);
       
        if(slot2.canTakeStack(par4EntityPlayer)) {
          itemstack3 = inventoryplayer.getStackInSlot(par2);
          boolean flag = itemstack3 == null || slot2.inventory == inventoryplayer && slot2.isItemValid(itemstack3);
          l1 = -1;
         
          if(!flag) {
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

          inventoryplayer.setItemStack(itemstack3);
        }
      } else if(par3 == 4 && inventoryplayer.getItemStack() == null && par1 >= 0) {
        slot2 = (Slot)this.inventorySlots.get(par1);
       
        if(slot2 != null && slot2.getHasStack() && slot2.canTakeStack(par4EntityPlayer)) {
          itemstack3 = slot2.decrStackSize(par2 == 0 ? 1 : slot2.getStack().stackSize);
          slot2.onPickupFromSlot(par4EntityPlayer, itemstack3);
          par4EntityPlayer.dropPlayerItemWithRandomChoice(itemstack3, true);
        }
      } else if(par3 == 6 && par1 >= 0) {
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

        }
      } else if(par3 == 6 && par1 >= 0) {
        slot2 = (Slot)this.inventorySlots.get(par1);
        itemstack3 = inventoryplayer.getItemStack();
       
        if(itemstack3 != null && (slot2 == null || !slot2.getHasStack() || !slot2.canTakeStack(par4EntityPlayer))) {
          i1 = par2 == 0 ? 0 : this.inventorySlots.size() - 1;
          l1 = par2 == 0 ? 1 : -1;
         
          for(int i2 = 0; i2 < 2; ++i2) {
            for(int j2 = i1; j2 >= 0 && j2 < this.inventorySlots.size() && itemstack3.stackSize < itemstack3.getMaxStackSize(); j2 += l1) {
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

         
          for(int i2 = 0; i2 < 2; ++i2) {
            for(int j2 = i1; j2 >= 0 && j2 < this.inventorySlots.size() && itemstack3.stackSize < itemstack3.getMaxStackSize(); j2 += l1) {
              Slot slot3 = (Slot)this.inventorySlots.get(j2);
             
              if(slot3.getHasStack() && func_94527_a(slot3, itemstack3, true) && slot3.canTakeStack(par4EntityPlayer) && this.func_94530_a(itemstack3, slot3) && (i2 != 0 || slot3.getStack().stackSize != slot3.getStack().getMaxStackSize())) {
                int k1 = Math.min(itemstack3.getMaxStackSize() - itemstack3.stackSize, slot3.getStack().stackSize);
                ItemStack itemstack2 = slot3.decrStackSize(k1);
                itemstack3.stackSize += k1;
               
                if(itemstack2.stackSize <= 0) {
View Full Code Here

Examples of net.minecraft.inventory.Slot.canTakeStack()

    // can take?

    if ( isA != null && !a.canTakeStack( invPlayer.player ) )
      return;

    if ( isB != null && !b.canTakeStack( invPlayer.player ) )
      return;

    // swap valid?

    if ( isB != null && !a.isItemValid( isB ) )
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.