ReIative

Untitled

Jun 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. local tArgs={ ... }
  2. print("Making a brand new floor for you master..")
  3.  
  4. turtle.refuel()
  5.  
  6. local total=0
  7. local selected=16
  8.  
  9. print("I've got "..turtle.getItemCount(selected).." blocks for now!")
  10.  
  11. local finished=false
  12. while not finished do
  13. while not (turtle.detect() or turtle.detectDown()) do
  14. if turtle.placeDown() then
  15. total=total+1
  16. end
  17. turtle.forward()
  18.  
  19. -- if there is no more block on that slot
  20. if turtle.getItemCount(selected) == 0 then
  21. -- decrement the slot number (from bottom-right to top-left)
  22. selected=selected-1
  23.  
  24. -- do not consume coal (experimental not tested yet)
  25. assert(selected ~= 1, "No more blocks left, sorry master")
  26.  
  27. -- select the new item slot
  28. turtle.select(selected)
  29. print("Switched to slot ".. selected .. " now having ".. turtle.getItemCount(selected) .." for use!")
  30. end
  31.  
  32. end
  33.  
  34. if turtle.detectDown() then
  35. turtle.back()
  36. turtle.turnRight()
  37. turtle.forward()
  38.  
  39. if turtle.detectDown() then
  40. finished=true
  41. print("Floor finished!")
  42. end
  43. else
  44. turtle.turnRight()
  45. print("Turtle say: bump!")
  46. end
  47. end
  48.  
  49. print(total .. " blocks have been consumed in the operation.")
Add Comment
Please, Sign In to add comment