Advertisement
Guest User

livingrock

a guest
Jan 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. function scan()
  2.   local isDownTrue, dataDown = turtle.inspectDown()
  3.   local isUpTrue, dataUp = turtle.inspectUp()
  4.   local block = "Botania:livingrock"
  5.   if (dataDown.name == block) and (dataUp.name == block) then
  6.     return true
  7.   else
  8.     return false
  9.   end
  10. end
  11.  
  12. function dig()
  13.   turtle.digDown()
  14.   turtle.digUp()  
  15. end
  16.  
  17. function place()
  18.   for i=1,16 do
  19.     local data = turtle.getItemDetail(i)
  20.     if type(data) == "nil" then
  21.     else
  22.       if data.name == "minecraft:stone" then
  23.         turtle.select(i)
  24.         turtle.placeUp()
  25.         turtle.placeDown()
  26.       end
  27.     end
  28.   end
  29. end
  30.  
  31. function move()
  32.   isBlock = turtle.detect()
  33.   if isBlock then
  34.     turtle.turnLeft()
  35.     turtle.forward()
  36.   else
  37.     turtle.forward()
  38.   end
  39. end
  40.  
  41. function inventory()
  42.   local rock = "Botania:livingrock"
  43.   local stone = "minecraft:stone"
  44.   local coal = "minecraft:coal"
  45.   for i=1,16 do
  46.     local data = turtle.getItemDetail(i)
  47.     if data.name == rock then
  48.       turtle.select(i)
  49.       turtle.turnLeft()
  50.       turtle.turnLeft()
  51.       turtle.drop()
  52.       turtle.turnLeft()
  53.       turtle.turnLeft()
  54.     elseif data.name == stone then
  55.      
  56.     elseif data.name == coal then
  57.      
  58.     end
  59. end
  60.  
  61. while true do
  62.   if scan() == true then    
  63.     dig()
  64.     place()
  65.     move()
  66.   else
  67.     --inventory()
  68.     sleep(5)
  69.   end
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement