Advertisement
manusoftar

Untitled

Sep 19th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. @Override
  2.     public ItemStack transferStackInSlot(EntityPlayer playerIn, int index){
  3.         ItemStack stack = null;
  4.         Slot slotObject = (Slot) inventorySlots.get(index);
  5.        
  6.         //null checks and checks if the item can be stacked (maxStackSize > 1)
  7.         if (slotObject != null && slotObject.getHasStack()) {
  8.                 ItemStack stackInSlot = slotObject.getStack();
  9.                 stack = stackInSlot.copy();
  10.  
  11.                 //merges the item into player inventory since its in the tileEntity
  12.                 /*if (slot < tileEntity.getSizeInventory()) {
  13.                         if (!this.mergeItemStack(stackInSlot, tileEntity.getSizeInventory(), 36+tileEntity.getSizeInventory(), true)) {
  14.                                 return null;
  15.                         }
  16.                 }
  17.                 //places it into the tileEntity is possible since its in the player inventory
  18.                 else if (!this.mergeItemStack(stackInSlot, 0, tileEntity.getSizeInventory(), false)) {
  19.                         return null;
  20.                 }*/
  21.  
  22.                 if (stackInSlot.stackSize == 0) {
  23.                         slotObject.putStack(null);
  24.                 } else {
  25.                         slotObject.onSlotChanged();
  26.                 }
  27.  
  28.                 if (stackInSlot.stackSize == stack.stackSize) {
  29.                         return null;
  30.                 }
  31.                 slotObject.onPickupFromSlot(playerIn, stackInSlot);
  32.         }
  33.         return stack;
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement