Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --"Lumberjack Turtle" v2.0
- -- Created by: Jeff "Deczx" Kloos, edited by: Daniele "Raniel" Sabre, Fulgar
- -- -------READ BELOW FOR INSTRUCTIONS--------
- -- This is a program that makes a ComputerCraft Mine Turtle chop down trees for you. It is fully automatic and replants after chopping the tree down.
- -- Quick start: The way you have to set it up is pretty simple. Put a chest in the ground and place the turtle on top. Put a sapling of your choice in front of the turtle. Put a single sapling of the corresponding wood in the 4th inventory slot of the turtle (top-right). Now put some saplings in the 16th inventory slot (bottom-right) for the turtle to replant. Fuel up the turtle, run the program and voila!
- local waitTime = 10
- print("Well I'm a lumberjack and I'm OK! ^.^")
- print("[hold ctrl+t to terminate]")
- while turtle.getFuelLevel() > 20 do -- If the Fuel gets below 64 the loop stops, you can change this, of course.
- --Here, the turtle looks for the sapling to turn into the woodblock.
- local success, sapling = turtle.inspect()
- while c do
- for i = 1,16 do -- search bone meal
- item = turtle.getItemDetail(i)
- if item == nil then
- c = true
- else
- if item.name == "minecraft:dye" then
- turtle.select(i)
- turtle.place()
- end
- success, sapling = turtle.inspect()
- end
- end
- sleep(waitTime)
- success, sapling = turtle.inspect()
- if sapling.name == "minecraft:log" then
- c = false
- else
- c = true
- end
- end
- --If it sees that the sapling is a woodblock it will start cutting the tree down.
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- print("Aye! ^o^7")
- -- The turtle will keep going up until there are no more blocks above him.
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- end
- -- Then it will go down.
- while turtle.down() == true do
- end
- -- Until it hits the ground.
- turtle.back()
- for i = 1,16 do -- search oak sapling
- item = turtle.getItemDetail(i)
- if item == nil then
- c = true
- else
- if item.name == "minecraft:sapling" then
- turtle.select(i)
- turtle.place()
- i=16
- end
- end
- end
- for i = 1,16 do -- search oak wood
- item = turtle.getItemDetail(i)
- if item == nil then
- c = true
- else
- if item.name == "minecraft:log" then
- turtle.select(i)
- if turtle.getFuelLevel() < 100 then
- turtle.refuel(1)
- end
- turtle.dropDown() -- drop wood on hcest below
- end
- end
- end
- turtle.select(1)
- print("Hard Work Makes Me Sleepy! XoX <<ZZzzz>>.") -- Then the turtle will go back to sleep mode.
- end
- -- If the turtle runs out of fuel, it will print a message and terminate the program.
- print("So Hungry. -o-")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement