Credit for original code to BikerEleven
EDIT: BikerEleven has stopped playing minecraft, and has given me permission to take credit for any updates.
Original forum thread can be found here:
http://bit.ly/NYbb3u
This is an update for BikerEleven's [1.3]AutoTreeFarm program
Here are a few of the changes:
Spoiler
- fixed typo 'startLoging' to 'startLogging'
- allows for more rednet control by broadcasting messages.
- turtles now compare instead of detect during harvestTree()
- turtles will not attempt to plant saplings if they run out
- turtles are slightly more efficient
- turtles are smarter
- turtles now work correctly with spruce and jungle trees
- turtles will emit redstone from their left side and bottom
- turtles will now start if a redstone input changes next to them
- Be careful! if turtles are to the left of each other and emitting redstone, they could trigger each other!
This program will work with Computercraft 1.41 as well as being compatible with Computercraft 1.3 and possibly older versions (not tested)
The original program by BikerEleven had a serious flaw:
the turtle would sometimes get saplings in its inventory in slots other than slot 1. This was because the turtle would dig the leaves at the top of the trees, giving it a sapling 1 in 20 times.
They no longer do that. Instead, they stop digging when there is no more wood to dig. Also, if the turtle runs into any blocks where it didn't expect to, it will drop them.
For instance, if a tree grows with its leaves low to the ground so that the turtle has to dig through, it will notice if it picks up a sapling in a slot other than slot 1 and it will drop the sapling.
You got my attention, so what do I do?
Spoiler
A video tutorial FOR THE 1.3 UNUPDATED VERSION can be found here:http://bit.ly/NWJ84b
Watch this video. The wall of text below will help you understand the program, but the video will be much clearer.
*Still read the text though. There's information about additional programs that make things much easier!
If the program is installed correctly, you should be able to go to any turtle and type 'logger'
Doing so will ask you to choose some settings.
The settings can be changed after they are created by pressing 's'.
To manually start the turtle and all nearby turtles, press 'r'.
If you choose to output redstone, then the turtle will output redstone when it returns from harvesting, and will continue until slots 3-9 are empty.
This allows you to create a pipe system to filter out the wood. I recommend using 'advanced wooden pipes' from the Buildcraft Additional Pipes mod and setting them to exclude saplings and dirt.
The turtle will ask for your desired length and width. 5x5 is a good size. If you make it too big, the turtle won't be able to carry enough saplings to plant them all.
*Make sure there are saplings in the first slot, and dirt in the second!
Birch saplings make the farm as consistent as possible, and work perfectly with BikerEleven's version.
I recommend jungle saplings, as the trees will be taller on average, and the turtle can now tolerate the occasional low-hanging leaves.
If you want dedicated tree farmers, I suggest following the instructions below on how to set up the broadcast console, with two differences:
Instead of shell.run("broadcast") type in:
- shell.run("logger")
*I recommend using this program with two of my other programs, made specifically to make automatic tree farming simpler :P/>/>
It's worth noting that the equivalent exchange mod, included in Tekkit, puts a value of 32 EMC on each piece of tree wood. Each stack is worth 2048 EMC.
The programs can be found below.
Both programs are for computers, although they would technically work for turtles also.
To make them work, you must set up a computer (preferably high up) with a wireless modem to be the broadcast computer. This computer handles all traffic to and from the turtles.
Note that this computer will become a dedicated computer, and you will not be able to use it for anything else.
Make sure this computer is near the turtles that you want to farm trees. Put it as close as you can, without it being in the way.
In the computer, type:
- edit startup
- shell.run("broadcast")
Now reboot the computer by holding down 'ctrl-r'
It should display 'BROADCAST CONSOLE'
If it does not, then either,
you installed to the wrong directory,
the name is incorrect or has a .txt extension,
or you typed the above command incorrectly.
If it does say 'BROADCAST CONSOLE' then congratulations!
Now you can go to any nearby computer with a wireless modem and type 'log'
Doing so should print the message 'Started Logging'
*Remember that you will need wireless mining turtles to receive the message.
If you type 'log' again, it should say 'Please Wait…' then print out useful information regarding the loggers!
Information includes how many loggers are finished, if any loggers are low on saplings, and if any loggers are out of saplings.
How do I install these programs?
Spoiler
For instructions on installing computercraft programs, see here:http://bit.ly/OShGWK
To install for tekkit, go to %appdata%.techniclaunchertekkitmodsComputerCraftluaromprograms
Anything placed in this directory will be available to both computers and turtles, IN SINGLEPLAYER.
There is a similar path a server owner must save to if the programs are to work on a server.
You can make programs exclusive to computers or turtles by saving the program to the respective folder.
Where can I get these programs?
Spoiler
Right here!Just paste into a text editor, (like notepad++) and save to the location detailed above.
Make sure to erase the .txt extension at the end of the filename and save as 'All Types', rather than as a 'Normal Text File'.
Otherwise, the program will NOT work!
http://pastebin.com/DXS4N7MM –name this program logger. Save it to the 'turtle' folder.
What about the bonus programs that will make tree farming so much easier? I must have them!
Spoiler
Calm down, they're right here:http://pastebin.com/fe99rTPB –name this program log
http://pastebin.com/54wJt5fV –name this program broadcast
Edit:
–Code Updated!
Spoiler
–if you're using tekkit, set up an advanced wooden transport pipe to suck out only the wood.–if updating, press 's' to recreate settings, otherwise you will get an error.
–turtle now has an option to wait for full saplings between cycles.
–the turtle will output redstone on the bottom, left and right sides.
–make the redstone power a redstone engine, powering a pipe that brings saplings to the turtle.
–depending on how long the pipe is, the turtle will have to throw away a couple saplings if he gets too many.
–use a transposer to automatically pick up any extra saplings.
–turtle will not wait for full saplings unless 'output redstone on cycle' is selected.
–this code is not ideal, but it works if you really want that small amount more automation.
–if not, do not select 'Wait for full saplings'