Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Will make the turtle automatically place and mine a tree
- -- Gets fuel level
- local fuelLevel = turtle.getFuelLevel()
- -- If fuel level is greater than 30, then run the code
- if (fuelLevel > 30) then
- local isBlock, data = turtle.inspect()
- while(isBlock == false) do
- turtle.turnRight()
- turtle.turnRight()
- for count = 4, 1, -1 do
- turtle.forward()
- end
- turtle.down()
- turtle.down()
- turtle.suckDown()
- turtle.up()
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- for count = 4, 1, -1 do
- turtle.forward()
- end
- turtle.place()
- isBlock, data = turtle.inspect()
- end
- while(isBlock and string.match(data.name, "sapling")) do
- isBlock, data = turtle.inspect()
- end
- if(isBlock and string.match(data.name, "log")) then
- turtle.dig()
- turtle.forward()
- local isBlockUp, dataUp = turtle.inspectUp()
- local counter = 0
- while(string.match(dataUp.name, "log")) do
- turtle.digUp()
- turtle.up()
- counter = counter + 1
- isBlockUp, dataUp = turtle.inspectUp()
- end
- for count = counter, 1, -1 do
- turtle.down()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- local timerID = os.startTimer(1)
- local event, id
- repeat
- event, id = os.pullEvent("timer")
- until id == timerID
- os.reboot()
- end
- else
- print("Not enough fuel bro :(")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement