Advertisement
GladdeSnaak

Minertest

Feb 8th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. X = 0
  2. Y = 0
  3. Z = 0
  4.  
  5. function fuel()
  6.     for i = 1,16 do
  7.         itemInfo = turtle.getItemDetail(i)
  8.         if itemInfo == nil then
  9.         else
  10.         if itemInfo["name"] == "minecraft:coal" then
  11.             turtle.select(i)
  12.             turtle.refuel(itemInfo["count"])
  13.         end
  14.         end
  15.     end
  16. end
  17.  
  18. function depositItems()
  19.     fuel()
  20.         for d = 1,16 do
  21.             turtle.select(d)
  22.             turtle.drop()
  23.         end
  24. end
  25.  
  26. function updateloc(x,y,z)
  27.      X = X+x
  28.      Y = Y+y
  29.      Z = Z+z
  30. end
  31.  
  32. function forward()
  33.     turtle.dig()
  34.     turtle.forward()
  35.     updateloc(1,0,0)
  36. end
  37.  
  38. function up()
  39.     turtle.digUp()
  40.     turtle.up()
  41.     updateloc(0,1,0)
  42. end
  43.  
  44. function down(amount)
  45.     for p = 1,amount do
  46.     turtle.digDown()
  47.     turtle.down()
  48.     updateloc(0,0,-1)
  49.     end
  50. end
  51.  
  52. function back(blockamount)
  53.     turtle.turnRight()
  54.     turtle.turnRight()
  55.         for i = 1, blockamount do
  56.             turtle.dig()
  57.             forward()
  58.             updateloc(-1,0,0)
  59.         end
  60.     turtle.turnRight()
  61.     turtle.turnRight()
  62. end
  63.  
  64.  
  65. function dig()
  66. fuel()
  67. turtle.dig()
  68. up()
  69. turtle.dig()
  70. up()
  71. turtle.dig()
  72. down(2)
  73. fuel()
  74. end
  75.  
  76. function digRight()
  77. turtle.turnRight()
  78. dig()
  79. turtle.turnLeft()
  80. end
  81.  
  82. function digLeft()
  83. turtle.turnLeft()
  84. dig()
  85. turtle.turnRight()
  86. end
  87.  
  88. function mineRows(amount)
  89.     for p = 1,amount do
  90.     digLeft()
  91.     digRight()
  92.     dig()
  93.     forward()
  94.     end
  95. gohome = amount
  96. goHome()
  97. end
  98.  
  99. function goHome()
  100.  back(gohome)
  101.  gohome = 0
  102. for i = 1,16 do
  103. turtle.select(i)
  104. turtle.drop()
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement