94Lord

Untitled

Aug 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. -- ( HOLZ) --
  2. j = 0
  3. fuellevel = 100
  4. count = 0
  5. treeblock = "minecraft:log"
  6. chestdistance = 5
  7.  
  8. function fell()
  9. count = count + 1
  10. print("Baum Nr. " ..count.. " wird gefaellt!")
  11. while(turtle.forward()==false) do
  12. turtle.dig()
  13. end
  14. success, data = turtle.inspectUp()
  15. while(success and data.name==treeblock) do
  16. turtle.digUp()
  17. turtle.up()
  18. success, data = turtle.inspectUp()
  19. end
  20. while(turtle.down()) do end
  21. while(turtle.back()==false) do end
  22. end
  23.  
  24. function place()
  25. turtle.select(2)
  26. turtle.place()
  27. turtle.select(1)
  28. end
  29.  
  30. function collect()
  31. print("Sammle auf")
  32. sleep(10)
  33. turtle.suck()
  34. while(turtle.down()==false) do end
  35. turtle.suckDown()
  36. sleep(1)
  37. turtle.suckDown()
  38. sleep(1)
  39. turtle.suckDown()
  40. sleep(1)
  41. while(turtle.up()==false) do end
  42. end
  43.  
  44. function refuel()
  45. if(turtle.getFuelLevel() < fuellevel) then
  46. turtle.select(16)
  47. turtle.refuel(1)
  48. print("Aufgetankt")
  49. end
  50. end
  51.  
  52. function forward()
  53. while(turtle.forward()==false) do end
  54. end
  55.  
  56. function unload()
  57. if(turtle.getItemCount(16) > 0) then
  58. turtle.turnRight()
  59. turtle.turnRight()
  60. for i=1, chestdistance do
  61. forward()
  62. end
  63. for i=3,16 do
  64. turtle.select(i)
  65. turtle.drop(64)
  66. end
  67. turtle.turnRight()
  68. turtle.turnRight()
  69. for i=1, chestdistance do
  70. forward()
  71. end
  72. end
  73. end
  74.  
  75. for j=1,10 do
  76. turtle.select(1)
  77. success, data = turtle.inspect()
  78. if(success and data.name==treeblock) then
  79. refuel()
  80. fell()
  81. place()
  82. sleep(5)
  83. collect()
  84. refuel()
  85. unload()
  86. else
  87. print("Kein Baum")
  88. Sleep(10)
  89. j = j+1
  90. end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment