ComputerCraft: Turtle Programs, Ep 11: Tree Farm

Share on facebook
Share on twitter

ComputerCraft: Turtle Programs, Ep 11: Tree Farm

104 060 views | 1 Feb. 2015
104 060 views | 1 Feb. 2015

In this epsiode you will learn about the automated Tree Farm program, which won the poll I did for you. I show you how to download the program, make the turtle set-up the tree farm (optional), how to run the farm and I explain some of the program mechanics. You can either use a crafty felling turtle or a crafty mining turtle to run this automated farm that will provide you thousands of wood :)

To keep this video short I split it up in two parts. All the important stuff to run the progam is in this first part, so don't you worry ;)

Hope this helps you especially in early game. Enjoy! :)

2018-01-07 update v1.40: bugfix turtle start position


program aTreeFarm:

About the mods:

I'm using FTB modpack Direwolf20 1.7 (v1.0.3) with CameraStudio (v2.1710) and Fastcraft (v1.9).

Turtles are part of dan200's mod computercraft which is about computers, programming and robotics in minecraft:

Computercraft uses the programming language LUA:


Pamgaea, by Kevin MacLeod (

Stealth Groover, by Kevin MacLeod (

Tea Roots, by Kevin MacLeod (

Questions and Feedback:

Please, comment the video and maybe share some of your ideas for future turtle programs. Like and subscribefor more videos.

Hope you enjoy, have fun!!

benoit Lafenetre

Hey thank you a lot for this programm but sometimes the turtle stop and said aTreeFarm:406:attempt to call nil what this means ? ^^ cauz every time i got this i have to restart from 0 to reload the turtle :)


richtig gutes programm danke


wie starte ich die Turtle?? Hab das Label gesetzt denn Code runter geladen und wenn ich denn Namen des Programmes in die Turtle eingebe (treefarm) passiert garnichts. Muss ich noch irgend was wichtiges machen?

Mehmetcan Düzenli

muss es eine felling mining turtle sein


@Kaikaku wenn ich pastebin get JgRgRK5q aTreefarm eingebe und nochmal aTreeFarm eingebe passiert nix das setup menü öffnet sich nicht in der Turtle es fängt einfach nur eine neue Zeile an.


I am playing Ftb infinity evolved skyblock and may turtel is not working I can download the programm with the pastebin command but if I want to run the programm my turtel is doing nothing


For people having problems (no skript runs), watch this


I wish a separate chest was used for refuling it. That way I could use pipes and drain all wood from the chest~ Unless it uses wood picked up as fuel.


@Kaikaku do u know of a issue that the turtle stops working? i just had it happen it placed the chest it had in to above it then gave a Nil error and now i cant get it back working. ive used ur program for almost a year off and on first bug ive seen


2020-06-13, info: There is for a while a change in pastebin. To pastebin get programs watch this
Haven't played Minecraft for a while, but I'll fix it next time I do (but don't wait for it).
2018-01-07, update v1.04: Just uploaded the new version to pastebin. There was a bug where the turtle mined the drop chest if it tried to refuel. Should be fixed now. If you have further problems, please comment. It helps me a lot, if you add the text which was shown on the turtle as the error occured. Enjoy!


ctrl + t isn't working for me for some reason do you have a fix?


+:3 Ferdi Vielleicht nochmal probieren, es sollte eigentlich klappen.


whenever I try to start the program it simply wont go. I press enter on page 2/2 and it just will not do anything, even with materials correct.

Animator Of Souls

I'm getting a bug where every time the turtle tries to refuel it returns "trees:406: attempt to call field 'craft' (a nil value)" and terminates the program. Any idea how to fix?

Nick Chance

I have no idea if this is still active but every time I run it works perfectly but it always have a really low probability therefore it never plants sapling.

Jaime Rodriguez

I like to thank youfor your treefarm turtle. that Im using in my video


Very helpful, thanks!

Tyler Jackson

it wont work it says "Setting up tree farm... treefarm:173: attempt to perform arithmetic __sub on string and number" what does that mean (this is when i press enter to set up

Florian W.

super Video, es ist echt eine super idee Turtles fürs bauen und Farmen zu nutzen , da die so billig sind. In meiner Welt wird nach den Videos nichts mehr ohne Turtles laufen

da sloth

im trying to make a enderlily farm using a turtle but i cant make it check if its fully grown or not. help please?


ich hab ein problem, habe versucht eine farm zu machen hab alles in die turtle rein, auh kohle dann steht fuel level ok und sie startet einfach nicht... was habe ich falschgemacht?


How do I get the turtle to start the program? I've given it the things it says in the first screen, but when I press enter it just shows me the second screen.

lucas fryhl

Control T?

Johannes Becker

I have a problem. Ctr + T doesnt work in the programm of my turtle and i cant let it setup the farm first

Christopher Tavarez

This doesn’t work if there is a timber mod, he will collect the first block he hits but not the rest that falls


Don't know if you are still around, but I need to make changes to the program and I am stuck. I can only make a felling turtle, so it need it to either use some of the wood to refuel or get fuel from a chest or something.


still awesome man

Ich bims, Erik

Ich krieg den Schritt mit Control and T nicht hin kannst du mir helfen? (Control ist doch Strg oder?)

Philipp Leuchtenberger

die ersten 3 würte und ich wusste du bist deutscher .. dieses englisch immer XD


good video only when i try it it doesnt work, when if placed all needed recouses i press enter and nothing happends

Nagy Kálmán

hello dude i use the 1.5 adn this is not working for me. i got "no such program" any idea? thanks os much


Good stuff. Thanks for the tutorial. I am a computer craft newbie

Daniel S.

i cant download it :(


why does the program stop working? .. it gives me this error in the robot (No such program)


Your outro Musics Sound as if we travelled to a City in far future with a time machine :D


deutscher haha

Open Bottle

Hey Kaikaku, hope all is well! I finally got around to featuring this script in one of my videos! Let me know if the credit for you is okay or if you'd like anything changed!


mine started to act up recently. it only does one round of the course and then when it gets back to the starting point it places a chest over the chest that was in the background and it says "attempt to call nil" and I have to keep destroying and replacing it which is annoying.

Carl Taylor

hey, I can't get this to work I download from pastebin get the success message but when I type aTreeFarm it just goes to the next line and nothing happens.
Any ideas what I am doing wrong?


it isnt working. I attempt to download it with pastebin get, but the code is downloaded empty.

Joey Groh

can you run this process with 2 or more fellers?

Burny - Valve Source Games - Happys Edits

How is the turtle reffiling fuel?


Mach deutsche vidios

Burny - Valve Source Games - Happys Edits

okay so the problem is its not wireless so it will deasivate if chunk is not loaded, is it possible to be still loaded without crafting chunk loader?


It doesnt work, if i pastbin it in the program is just empty :/

nvm fixed it :D


Is there any obvious reason why it would not craft the planks to refuel and also seems to put the chest in 16 in to chest under it with the wood.

Aztun 31

5 years later and still fonctional good job bro


if you have this guy's accent you are automatically a master programmer


Hey! I can not get this to work. I followed everything, but the turtle will not plant saplings. It has 26 saplings in the correct spot and the correct wood right next to it. It just keeps following the path not planting. It did harvest one tree though when I planted and bonemealed it myself.

Darren Hooper

The farm was working great, I noticed today that the turtle had stopped. When I try to restart it, I get the following error:
attempt to compare number with string expected, got number.


my turtle disappeard after farming about 15 stacks of wood o__O
I was afk next to it

Lennart Schipper

Hey, erstmal: Das war ein super Video:)
Nur habe ich ein Problem in Zeile 412 mit dem Programm. Die Turtle schmeißt irgendein Fehler mit nil raus. Vlt. kannst du mir ja helfen. Sonst gucke ich nochmal genauer nach.
Schon mal Danke im voraus.

Overlord Overmind

Version 1.13.2, When running the setup program on the turtle, It mines out the path but doesn't place the blocked pattern or the torches. Is there something wrong with the coding?


the pastebin code is : JgRgRK5q

Krystal Stephens

Does this work for CraftOS 1.7?


1080p in 2015... not bad...

T n T

+1 abo just for intro xD


It works, but trees growing so much that turtle is out of fuel and somehow can't refuel itself. Any ideas?


I'd like to start out by saying that this is a great program that really has been working for me. I don't normally comment on YouTube videos, but I thought I would add this comment to suggest a small tweak to the code that fixes a problem I'd been having. I'd been having a lot of trouble with one-high stumps being left around. The turtle will ordinarily hit logic to remove and replant the stubs, but it only actually runs this logic if the turtle has more than 10 saplings. If you start with a relatively low number of saplings, it can become possible to quickly build up many stumps. To fix this, I made two changes. On line 319, I changed "if pf() then" to "if (turtle.getItemCount(1) > 10 and pf()) then". This means that stumps still won't be replanted if the turtle has 10 or fewer saplings. Then I added a couple of calls to replantStub in line 374 (still conditional on turtle.detect()). That way the stumps will still be removed even if there aren't many saplings.


Gutes Video :) aber was tun wenn versehentlich der Chunk entladen wurde? Das Programm neustarten und alle Bäume manuell fällen?


How can i refuel it? i want to get max output so i doesn't use all the wood up. can i put coal in the chest? or how does it work


It won't run on my server

hans kjær

it´s a soo freaking easy YAY


what do you do when you go out of render and it stops ? I tried to restart it but with no avail I would appreciate the help !


There Is A Question Written in english down the bottom guys.
Ich spreche oder verstehe kein Deutsch, aber um dich zu begrüßen, habe ich mich entschlossen, für meine Begrüßung Google zu übersetzen. Alle Ihre Programme sind ehrfürchtig und ich genieße sie, halten sie oben die große Arbeit, ich habe abonniert, also kann ich Ihre folgenden Uploads erhalten. Ich habe auch eine deutsche ancestral bloodline. Ich habe nur ein Problem Ich brauche Hilfe mit.
Im Playing in 1.7.10 and upon putting everything in and pressing enter 2/2 times the turtle doesn't lay down the setting up but rather goes straight into tree farming and so when it tries to put things in the chest where its meant to be, it spits them out on the ground. So currently i set it up by hand while the turtle is farming, but i really would love to see it set itself up. Im not Shure if i have it in one chunk tho so that could be the case but i do have a crafting felling turtle doing it so I'm Shure its not the turtle. :) Cheers mate


Ctrl T DOESNT work for me! it doesn't type out the work Terminted like yours someone helppppp me!


bios:337: [string "atreefarm"]:1: unexpected symbol :(

ftb unleashed 1.5.2

Damn Boi

Kann mir jemand den code davon sagen also pastebin get ....


Does the turtle work if big oak trees spawn?


FTB Ultimate Reloaded, MC 1.12 - If the chest is in slot 16 (to get it started), it will have a 50/50 chance of putting the wooden chest above the felling turtle when it dumps logs into the chest at the start. Then I have to terminate and restart the program. Pulling the chest out of 16 after it's started seems to fix the issue?

Snake Hunter

i have the problem that my turtle dont automaticly refuel she say she will call nil


Wait. so this is actually really simple. :D

Hannes Harsch

du bist deutscher oder ?

Hamish technic reviews

i did everything but when i type atreefarm:

oliver stech

Du brauchst einen Popschutz :)

Andrew Shower

When I quit the world, the program stops. do I just run it again to continue?

Fabian Schirmer

Du bist doch bestimmt deutsch


With the turtle interface if you press Ctrl it opens the save and exit section and when I hold Ctrl it flashes the interface and I cant copy the code. Why is this? How do I fix it?

Windows XP

i do "atreefarm" and it doesnt work... I just get send to the next line D-:

JokDeny 29

Der ist Safe deutsch

Jonathan Srb

control+t=Srg t auf deutsch?

Vsaucerino Kripperino

Hey, our of curiosity, how does the turtle know when to turn right or left?

Do you have a hard coded pattern in there? I don't see anything in the turtle API that allows you to check the blocks the way you have got it working.


This was working literally two days ago and now it's stopped working.

Dragon__ Style__

Danke für das Tutorial, auch wenn das schon ne weile her ist, hat mir sehr geholfen :D

Andrew the bored

Is there any benefits to a felling turtle? Dont see a reason to switch


Geht das hier auch mit Greatwood Sapplings von Thaumcraft?


No kind of startup thing comes up for me I type sTreetcar after downloading it and nothing happens


Problem, es möchte nicht in stage 2 umsteigen

Emery Tharp

Fantastic tutorial, many thanks for the video and the code.

motorist .Chris

Hey, i have a problem, when i start the setup the turtle place the first line of cobble and when it turns to the right to build the path, the turtle just stops and do nothing more. No error code just stops and i cant write a new command or so.

Thank you.

Nooh Abdulaal

Cant i go to creative and get wood?

John Smith

Liked and subscribed, thanks from Chicago. Great programming

Tim Müller

tolles Video hilft mir sehr weiter


How do I program a turtle using the program

Caden Barrera

If you having problems with the ctrl+c make sure you HOLD BOTHE KEYS FOR AT LEAST 5 sec.

AlucaBr Games

crash broken program ¬¬


I would like to have this program run on startup. I do not have the ability to use a chunk loader early game and need to either simulate pressing enter twice to start the program or take out the lines of code that require pressing enter. Can someone please help me. I do not know Lua very well

Israel Hoffman

Why don't you just keep an array where the turtle can track where it planted trees? Perhaps it could be a trinomial array (0 for no tree, 1 for sapling, and 2 for adult tree)?
I am also curious why you didn't just use turtle.inspect().metadata to determine a trees age instead of turtle.detect()? This would allow the turtle to inspect from the ground level, so that it wouldn't leave stumps.

All that said, Kudos. Your solution works, and as of yet mine does not. All the best.


after i downloaded the pastebin i typed aTreeFarm and it didnt give me the slot list or allow me to run the script


what happened to the other code videos, like the one where the turtle cloned itself? (Minned, then Multiplied)