Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clearTree()
- print("attempting to clear a tree")
- turtle.dig()
- turtle.forward()
- local cleared = false
- local tempHeight = 0
- repeat
- local tempBlock, n = turtle.inspectUp()
- if tempBlock then
- if n.name == "minecraft:log" then
- turtle.digUp()
- turtle.up()
- tempHeight = tempHeight + 1
- else
- cleared = true
- end
- else
- cleared = true
- end
- until(cleared == true)
- repeat
- turtle.down()
- tempHeight = tempHeight - 1
- until (tempHeight == 0)
- turtle.back()
- print("successfully cleared a tree!")
- print("planting a sapling")
- turtle.select(1)
- turtle.place()
- print("planted a sapling!")
- end
- function nextTreeInRow()
- print("attempting to go to the next tree in row")
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- print("successfully went to the next tree in row!")
- end
- function goToNextRow()
- print ("attempting to go to the next row")
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- print (" successfully went to the next row")
- end
- function returnToStart()
- print("attempting to go to the start of the trees")
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- for i = 0, 15, 1
- do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- print("sucessfully returned to the start")
- end
- function startOfRow()
- turtle.turnRight()
- for i = 0, 11, 1
- do
- turtle.forward()
- end
- turtle.turnLeft()
- end
- local length = 4
- local width = 5
- for w = 1, width-1, 1
- do
- local tempa, x = turtle.inspect()
- if tempa then
- if x.name == "minecraft:log" then
- clearTree()
- end
- end
- for l = 1, length-1, 1
- do
- nextTreeInRow()
- local temp, x = turtle.inspect()
- if temp then
- if x.name == "minecraft:log" then
- clearTree()
- end
- end
- end
- startOfRow()
- goToNextRow()
- end
- returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement