mercwear

Turtle inventory sort

Apr 1st, 2025 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. print("Press CTRL+T to stop")
  2. local turtle_inventory_slot = 1
  3. local selected_item_details = turtle.getItemDetail(turtle_inventory_slot)
  4. local inventory_details = 1
  5. local open_inventory_slot = 1
  6.  
  7. --Sort inventory of turtle
  8. while turtle_inventory_slot <= 16 do
  9. turtle.select(turtle_inventory_slot)
  10. selected_item_details = turtle.getItemDetail(turtle_inventory_slot)
  11.  
  12. if selected_item_details ~= nil then
  13. if selected_item_details.name ~= "minecraft:netherrack" then
  14. turtle.dropUp()
  15. else --Space has correct item in it
  16. turtle.transferTo(open_inventory_slot)
  17. open_inventory_slot = open_inventory_slot + 1
  18. end
  19. end
  20. turtle_inventory_slot = turtle_inventory_slot + 1
  21.  
  22. end
Advertisement
Add Comment
Please, Sign In to add comment