Advertisement
Guest User

Lighter

a guest
Dec 12th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. x,y,z=1,1,0
  2. dir=0
  3.  
  4. function Forward()
  5. while not turtle.forward() do
  6. turtle.attack()
  7. end
  8. if (dir%2)==0 then y=y+1-(dir%4)
  9. else x=x+2-(dir%4)
  10. end
  11. end
  12.  
  13. function Up()
  14. while not turtle.up() do
  15. turtle.attackUp()
  16. end
  17. z=z+1
  18. end
  19.  
  20. function Down()
  21. while not turtle.down() do
  22. turtle.attackDown()
  23. end
  24. z=z-1
  25. end
  26.  
  27. function Right()
  28. turtle.turnRight()
  29. dir=(dir-1)%4
  30. end
  31.  
  32. function Left()
  33. turtle.turnLeft()
  34. dir=(dir+1)%4
  35. end
  36.  
  37. function SelectTorch()
  38. for i=1,16 do
  39. local data=turtle.getItemDetail(i)
  40. if data and data.name=="minecraft:torch" then
  41. turtle.select(i)
  42. break
  43. end
  44. end
  45. end
  46.  
  47. function SelectCobble()
  48. for i=1,16 do
  49. local data=turtle.getItemDetail(i)
  50. if data and data.name=="minecraft:cobblestone" then
  51. turtle.select(i)
  52. break
  53. end
  54. end
  55. end
  56.  
  57. function PlaceTorch()
  58. local success,data=turtle.inspect()
  59. if success and data.name=="minecraft:cobblestone" then
  60. else
  61. SelectCobble()
  62. turtle.place()
  63. Up()
  64. SelectTorch()
  65. turtle.place()
  66. Down()
  67. end
  68. end
  69.  
  70. function Column()
  71. for i=1,100 do
  72. if turtle.detect() then break end
  73. Forward()
  74. if (y%4)==0 then
  75. Left()
  76. PlaceTorch()
  77. Right()
  78. end
  79. end
  80. Right() Right()
  81. while y>1 do Forward() end
  82. Right() Right()
  83. end
  84.  
  85.  
  86.  
  87. while true do
  88. Left()
  89. if turtle.detect() then
  90. Right() Right()
  91. while x>1 do Forward() end
  92. Left()
  93. else
  94. for n=1,100 do
  95. Forward()
  96. if x%3==1 then
  97. Right()
  98. Column()
  99. Left()
  100. if turtle.detect() then
  101. Right()
  102. break
  103. end
  104. end
  105. end
  106. end
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement