Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Author
- Rasmus Sommer aka. TheSommer
- youtube.com/thesommersmc
- twitch.tv/thesommer
- How to use:
- (WORKS WELL WITH BIRCH, SPRUCE OR FIR)
- Slot 1 - Fuel
- Slot 2 - Saplings
- Slot 3 - Bonemeal
- treefeller <amount>
- --]]
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: treefeller <amount>" )
- return
- end
- local length = tonumber( tArgs[1] )
- if length < 1 then
- print( "Amount must be positive" )
- return
- end
- local function tryRefuel()
- if turtle.getFuelLevel() == 0 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function tryDig()
- while turtle.detect() == true do
- turtle.dig()
- sleep(0.5)
- end
- end
- local function tryDigUp()
- while turtle.detectUp() == true do
- turtle.digUp()
- sleep(0.5)
- end
- end
- local function tryUp()
- tryDigUp()
- tryRefuel()
- turtle.up()
- end
- local function tryDown()
- while turtle.detectDown() == true do
- turtle.digDown()
- sleep(0.5)
- end
- tryRefuel()
- turtle.down()
- end
- local function tryForward()
- tryDig()
- tryRefuel()
- turtle.forward()
- end
- local count = 1
- for i = 1, length do
- turtle.select(2)
- turtle.place()
- turtle.select(3)
- while turtle.place() == true do
- sleep(0.5)
- end
- tryForward()
- while turtle.detectUp() == true do
- tryUp()
- end
- while turtle.detectDown() == false do
- tryDown()
- end
- turtle.back()
- end
Advertisement
Add Comment
Please, Sign In to add comment