Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local acceptedItems = {
- "Natura:Dark Tree",
- "Natura:Dark Leaves",
- "minecraft:log",
- "minecraft:leaves"
- }
- local plantItem = "minecraft:sapling"
- local fuelItem = "minecraft:log"
- function checkData(d)
- for _, v in ipairs(acceptedItems) do
- if d.name == v then
- return true
- end
- end
- return false
- end
- function checkRefuel()
- if turtle.getFuelLevel() < 100 then
- reorganize()
- turtle.select(16)
- turtle.refuel(turtle.getItemCount(16))
- end
- end
- function breakTree()
- checkRefuel()
- local block, data = turtle.inspect()
- if block and checkData(data) then
- turtle.dig()
- turtle.suck()
- turtle.forward()
- breakTree()
- turtle.back()
- end
- local block, data = turtle.inspectUp()
- if block and checkData(data) then
- turtle.digUp()
- turtle.suckUp()
- turtle.up()
- breakTree()
- turtle.down()
- end
- local block, data = turtle.inspectDown()
- if block and checkData(data) then
- turtle.digDown()
- turtle.suckDown()
- turtle.down()
- breakTree()
- turtle.up()
- end
- turtle.turnLeft()
- local block, data = turtle.inspect()
- if block and checkData(data) then
- turtle.dig()
- turtle.suck()
- turtle.forward()
- breakTree()
- turtle.back()
- end
- turtle.turnRight()
- turtle.turnRight()
- local block, data = turtle.inspect()
- if block and checkData(data) then
- turtle.dig()
- turtle.suck()
- turtle.forward()
- breakTree()
- turtle.back()
- end
- turtle.turnLeft()
- end
- function plantSapling()
- turtle.select(1)
- turtle.place()
- end
- function reorganize()
- for i = 1, 16 do
- turtle.select(i)
- local data = turtle.getItemDetail()
- if data and data.name == plantItem then
- turtle.transferTo(1)
- elseif data and data.name == fuelItem then
- turtle.transferTo(16)
- end
- end
- end
- while true do
- local block, data = turtle.inspect()
- if block and checkData(data) then
- breakTree()
- reorganize()
- plantSapling()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement