Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. -- Brain by dispeller
  2. -- A bunch of useful turtle functions
  3.  
  4.  
  5. -- Like turtle.refuel except eats all fuel in slot
  6. PowerUp = function(fuelSlotNum)
  7. if turtle.getFuelLevel() ~= turtle.getFuelLimit() then
  8. for i=1,turtle.getItemCount(fuelSlotNum) do
  9. if turtle.getFuelLevel() ~= turtle.getFuelLimit() then
  10. turtle.refuel(fuelSlotNum)
  11. end
  12. end
  13. end
  14. print('[BRAIN]:POWER AT '.. 100*(turtle.getFuelLevel()/turtle.getFuelLimit())..'%' )
  15. end
  16.  
  17. -- Search through every slot for specified item
  18. GetItemSlot = function(name)
  19. local found = false
  20. for i=1,16 do
  21. if (not found) and (turtle.getItemDetail(i).name == name) then
  22. found = i
  23. end
  24. end
  25. return found
  26. end
  27.  
  28. -- Loops through every slot and selects the specified item
  29. SelectItem = function(name)
  30. return turtle.select(GetItemSlot(name))
  31. end
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. --------------------------------------------------------------
  39. -- QUARY
  40.  
  41. SelectItem('minecraft:iron_pickaxe')
  42.  
  43. turtle.equipLeft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement