ThatGravyBoat

Untitled

Aug 6th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1.     public ItemStack transferStackInSlot(@Nonnull PlayerEntity playerIn, int index) {
  2.         ItemStack itemstack = ItemStack.EMPTY;
  3.         Slot slot = this.inventorySlots.get(index);
  4.         if (slot != null && slot.getHasStack()) {
  5.             ItemStack itemstack1 = slot.getStack();
  6.             itemstack = itemstack1.copy();
  7.  
  8.             if (index <= 1) {
  9.                 if (!this.mergeItemStack(itemstack1, 2, inventorySlots.size(), true)) {
  10.                     return ItemStack.EMPTY;
  11.                 }
  12.             } else if (!this.mergeItemStack(itemstack1, 0, 2, false)) {
  13.                 return ItemStack.EMPTY;
  14.             }
  15.  
  16.             if (itemstack1.isEmpty()) {
  17.                 slot.putStack(ItemStack.EMPTY);
  18.             } else {
  19.                 slot.onSlotChanged();
  20.             }
  21.         }
  22.         return itemstack;
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment