Advertisement
HarrysTechReviews

Transfer Stack In Slot

Jul 21st, 2018
1,229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. @Override
  2. public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
  3. {
  4. ItemStack itemstack = ItemStack.EMPTY;
  5. Slot slot = this.inventorySlots.get(index);
  6.  
  7. if (slot != null && slot.getHasStack())
  8. {
  9. ItemStack itemstack1 = slot.getStack();
  10. itemstack = itemstack1.copy();
  11.  
  12. if (index < this.numRows * 9)
  13. {
  14. if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true))
  15. {
  16. return ItemStack.EMPTY;
  17. }
  18. }
  19. else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false))
  20. {
  21. return ItemStack.EMPTY;
  22. }
  23.  
  24. if (itemstack1.isEmpty())
  25. {
  26. slot.putStack(ItemStack.EMPTY);
  27. }
  28. else
  29. {
  30. slot.onSlotChanged();
  31. }
  32. }
  33.  
  34. return itemstack;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement