Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- http://computercraft.info/wiki/Turtle_(API)
- treeHeight = 6
- t = turtle
- digTree = function() -- main dig tree function
- t.dig()
- t.forward()
- for i = 1, treeHeight - 1, 1 do
- t.digUp()
- t.up()
- end
- for i = 1, treeHeight - 1, 1 do
- t.down()
- end
- t.back()
- return true
- end
- dumpItems = function() -- dumps all items directly downwards
- t.refuel(2)
- for i = 16, 1, -1 do
- t.select(i)
- t.dropDown()
- end
- return true
- end
- detectTree = function()
- local success, data = t.inspect()
- if success and data.name == "minecraft:log" then
- return true
- end
- end
- plantTree = function()
- t.back()
- t.back()
- t.down()
- t.suckDown(1)
- t.up()
- t.forward()
- t.forward()
- t.place()
- end
- while true do -- MAIN LOOP
- if detectTree() then
- print("I FOUND A TREE, BABY!")
- digTree()
- dumpItems()
- plantTree()
- end
- print("LOOP")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement