Posted 16 May 2013 - 12:57 PM
Hello ComputerCrafters,
I just made a program which I call: Automatic Tree Farm.
This is also my first ComputerCraft program.
Note: It currently only works on birch, jungle and spruce saplings. As oak saplings have a chance of growing into a giant tree, it won't work.
Note: The bug where the turtle will do weird things when it runs out of saplings, bonemeal or fuel is now solved. However, you do need to place the exact same saplings, bonemeal and fuel (coal and charcoal are different items) in slots 14, 15 and 16. You only need 1 template item per slot. If you place the template items in the wrong order, or you don't even place them, the turtle will show a fake message saying it has run out of saplings, bonemeal or fuel.
If you didn't already guess, this is a fully automatic tree farm program. You need to give it saplings, bonemeal and some kind of fuel (coal, wood, lava, etc). The saplings go into the first slot, the bonemeal into the second slot and the fuel into the third slot. You now also need to place template items in slots 14, 15 and 16. The items must be exactly the same as the items the turtle is using. This is needed for the failsafe function. You only need 1 template item per slot. If you place the template items in the wrong order, or you don't even place them, the turtle will show a fake message saying it has run out of saplings, bonemeal or fuel. It currently only supports 1 stack of bonemeal, unfortunately.
How to install:
Make a mining turtle and enter this:
pastebin get 7Nxdz8Le programname
You can replace programname with whatever you want the name of the program to be.
If you don't have the http api installed:
Make a mining turtle and make an empty program (name doesn't matter). Then go to your minecraft directory and then to saves, then your world, then computer and then the search the folders there for the program you just made. Open that file in notepad (or textedit for Mac users) and paste the code from here: http://pastebin.com/7Nxdz8Le
Version history:
1.1.1 again some minor coding changes thanks to UNOBTANIUM
1.1 - some minor coding changes thanks to UNOBTANIUM
1.0 - initial release
Screenshots:
Code:
Be sure to leave feedback and report any bugs you encounter.
If you have questions feel free to ask them.
Also, if you have an idea on how it can support multiple (3 preferred) stacks of bonemeal, tell me.
I just made a program which I call: Automatic Tree Farm.
This is also my first ComputerCraft program.
Note: It currently only works on birch, jungle and spruce saplings. As oak saplings have a chance of growing into a giant tree, it won't work.
Note: The bug where the turtle will do weird things when it runs out of saplings, bonemeal or fuel is now solved. However, you do need to place the exact same saplings, bonemeal and fuel (coal and charcoal are different items) in slots 14, 15 and 16. You only need 1 template item per slot. If you place the template items in the wrong order, or you don't even place them, the turtle will show a fake message saying it has run out of saplings, bonemeal or fuel.
If you didn't already guess, this is a fully automatic tree farm program. You need to give it saplings, bonemeal and some kind of fuel (coal, wood, lava, etc). The saplings go into the first slot, the bonemeal into the second slot and the fuel into the third slot. You now also need to place template items in slots 14, 15 and 16. The items must be exactly the same as the items the turtle is using. This is needed for the failsafe function. You only need 1 template item per slot. If you place the template items in the wrong order, or you don't even place them, the turtle will show a fake message saying it has run out of saplings, bonemeal or fuel. It currently only supports 1 stack of bonemeal, unfortunately.
How to install:
Spoiler
If you have the http api installed:Make a mining turtle and enter this:
pastebin get 7Nxdz8Le programname
You can replace programname with whatever you want the name of the program to be.
If you don't have the http api installed:
Make a mining turtle and make an empty program (name doesn't matter). Then go to your minecraft directory and then to saves, then your world, then computer and then the search the folders there for the program you just made. Open that file in notepad (or textedit for Mac users) and paste the code from here: http://pastebin.com/7Nxdz8Le
Version history:
Spoiler
1.2 - added a failsafe. You now do need to place template items in slots 14, 15 and 16. More info in the notes section.1.1.1 again some minor coding changes thanks to UNOBTANIUM
1.1 - some minor coding changes thanks to UNOBTANIUM
1.0 - initial release
Screenshots:
Spoiler
Code:
Spoiler
function failsafe()
turtle.select(1)
if not turtle.compareTo(14) then
print("No more Saplings")
print("Press any button to shutdown computer...")
os.pullEvent("key")
stop()
end
turtle.select(2)
if not turtle.compareTo(15) then
print("No more Bone Meal")
print("Press any button to shutdown computer...")
os.pullEvent("key")
stop()
end
turtle.select(3)
if not turtle.compareTo(16) then
print("No more fuel")
print("Press any button to shutdown computer...")
os.pullEvent("key")
stop()
end
end
function stop()
os.shutdown()
end
function chop() --Creates the function chop() for the wood chopping algorithm.
turtle.dig()
turtle.digUp()
turtle.up()
end
Bonemealcount = 20 --Sets the number of times it will place bonemeal on the sapling. I don't recommend changing this as this ensures the trees will grow and don't worry, it won't use bonemeal when the tree is already grown.
while true do
failsafe()
while turtle.getFuelLevel() <= 20 do --Checks if a refuel is needed and if it is needed it will refuel.
turtle.select(3)
turtle.refuel(1)
end
turtle.select(1) --Selects and places sapling.
turtle.place()
turtle.select(2) --Selects bonemeal.
for i = 1, Bonemealcount do --Places bonemeal on sapling.
turtle.place()
end
while turtle.detect() do --Wood chopping algorithm.
chop()
end
while not turtle.detectDown() do --Goes down until it reaches the ground.
turtle.down()
end
end
Be sure to leave feedback and report any bugs you encounter.
If you have questions feel free to ask them.
Also, if you have an idea on how it can support multiple (3 preferred) stacks of bonemeal, tell me.