Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local running = false
- function cutUp()
- turtle.digUp()
- turtle.up()
- end
- function down()
- turtle.down()
- end
- function cutTree()
- turtle.dig()
- turtle.forward()
- repeat
- cutUp()
- until turtle.detectUp() == false
- repeat
- down()
- until turtle.detectDown() == true
- end
- function run()
- while running == true do
- if turtle.getFuelLevel() < 20 then
- turtle.refuel(1)
- end
- p1,p2 = turtle.inspect()
- if p2.name == "minecraft:stone" then
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- if p2.name == "minecraft:cobblestone" then
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- end
- if p2.name == "minecraft:brick_block" then
- print("Loop complete... returning home.")
- turtle.turnRight()
- for i=1,20 do
- turtle.forward()
- end
- turtle.turnRight()
- if p2.name == "minecraft:sapling" then
- return
- end
- end
- cutTree()
- repeat
- turtle.forward()
- print(turtle.getFuelLevel())
- until turtle.detect() == true
- end
- end
- function start()
- repeat
- turtle.forward()
- until turtle.detect() == true
- running = true
- run()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement