Advertisement
Guest User

removeLayer.lua

a guest
Jan 22nd, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local length = 4
  2. local width = 4
  3. local ignore = "minecraft:cobblestone"
  4.  
  5. function digForward(  )
  6.     while turtle.forward() == false do
  7.         turtle.dig()
  8.         turtle.attack()
  9.     end
  10. end
  11.  
  12. function cleanInv( slot )
  13.    
  14.     if turtle.getItemCount(slot) > 1 then
  15.         local data = turtle.getItemDetail(slot)
  16.         if data.name == ignore then
  17.             turtle.select(slot)
  18.             turtle.drop(turtle.getItemCount() - 1)
  19.         end
  20.     end
  21. end
  22.  
  23. local lastTurnRigth = false
  24. length = length - 1
  25.  
  26. for i=1,width do
  27.     for i=1,length do
  28.         digForward()
  29.     end
  30.     cleanInv(1)    
  31.  
  32.     if lastTurnRigth == false then
  33.         lastTurnRigth = true
  34.         turtle.turnRight()
  35.         digForward()
  36.         turtle.turnRight()
  37.  
  38.     else
  39.         if lastTurnRigth == true then
  40.             lastTurnRigth = false
  41.             turtle.turnLeft()
  42.             digForward()
  43.             turtle.turnLeft()
  44.         end
  45.     end
  46. end
  47.  
  48.  
  49.  
  50.  
  51.  
  52. if lastTurnRigth == false then
  53.     lastTurnRigth = true
  54.     turtle.turnRight()
  55. else
  56.     if lastTurnRigth == true then
  57.         lastTurnRigth = false
  58.         turtle.turnLeft()
  59.     end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement