Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public int getFirstNotEmptySlot(ItemStackHandler inventory)
  2. {
  3. int slot = 0;
  4. int counter;
  5. for (counter = inventory.getSlots(); counter > 0; counter -= 1);
  6. {
  7. if (!inventory.getStackInSlot(counter).isEmpty())
  8. {
  9. return counter;
  10. }
  11. }
  12. return slot;
  13. }
  14. public int getFirstEmptySlot(ItemStackHandler inventory)
  15. {
  16. int slot = 0;
  17. int counter;
  18. for (counter = 0; counter < inventory.getSlots() - 1; counter += 1);
  19. {
  20. if (inventory.getStackInSlot(counter).isEmpty())
  21. {
  22. return counter;
  23. }
  24. }
  25. return slot;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement