Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- definitions
- local arg = { ... }
- local log_name = "minecraft:birch_log"
- function autoRefuel()
- if turtle.getFuelLevel() < 80 then
- turtle.select(16)
- while turtle.getFuelLevel() < 80 do
- turtle.refuel(1)
- end
- turtle.select(1)
- end
- end
- function autoBonemeal()
- n = turtle.getItemCount(14)
- turtle.select(14)
- for i=1,n do
- if not turtle.place() then break end
- end
- end
- -- turn left and suck
- function LS()
- turtle.turnLeft()
- turtle.suck()
- end
- -- turn right and suck
- function RS()
- turtle.turnRight()
- turtle.suck()
- end
- -- go forward and suck
- function FS()
- turtle.forward()
- turtle.suck()
- end
- -- pick up the drops from the tree leaves
- function getDrops()
- RS()
- LS()
- LS()
- FS()
- FS()
- LS()
- FS()
- LS()
- -- at bottom left corner facing right
- FS()
- FS()
- FS()
- FS()
- LS()
- -- at bottom right corner facing forward
- FS()
- FS()
- FS()
- FS()
- LS()
- -- at top right corner facing left
- FS()
- FS()
- FS()
- FS()
- LS()
- -- at top left corner facing back
- FS()
- LS()
- FS()
- FS()
- FS()
- RS()
- FS()
- FS()
- RS()
- FS()
- RS()
- -- back at start
- end
- --print("Enter number of trees to cut:")
- --treesToCut = read()
- if arg[1] then
- treesToCut = arg[1]
- else
- treesToCut = 1
- end
- autoRefuel()
- for i=1, treesToCut do
- autoRefuel()
- -- place sapling
- turtle.select(15)
- turtle.place()
- autoBonemeal()
- turtle.select(16)
- crap, data = turtle.inspect()
- while data.name ~= log_name do
- crap, data = turtle.inspect()
- end
- -- cut tree
- while turtle.detect() do
- turtle.dig()
- turtle.digUp()
- turtle.up()
- end
- while not turtle.detectDown() do
- turtle.down()
- end
- turtle.select(15)
- getDrops()
- for j=1,12 do
- turtle.select(j)
- turtle.dropDown()
- end
- print(i, "/", treesToCut, " trees cut down.")
- end
- select(1)
- print("Finished.")
Add Comment
Please, Sign In to add comment