Hello again. I've been poring through more decompiled source code and running tests, and have prepared a definitive guide to tree growth and leaf decay.
Growth rate
Trees in single player have a chance to grow if they are within a 19x19 chunk area (304x304 blocks) centered on the player. Their growth function is called at intervals that appear somewhat random. In tests, I was getting a long-term average of slightly less than 3 calls per minute per sapling.
When the growth function is called, it first checks the light level 1 block above the sapling, which must be 9 or more. Trees are no more likely to grow in daylight than in torchlight. Trees that are artificially lit should therefore grow twice as fast as unlit outdoor trees, which only have a chance to grow during daytime.
If there is sufficient light, there is only a 1/5 chance of continuing (in effect turning 3 calls per minute into 0.6 calls per minute).
The function then increments the counter on each sapling, which starts at 0 and must reach 15. If it has reached 15, the tree-spawning function is called. If I'm doing my math right, it should be "about" 27 real minutes on average from planting to when the tree gets its first chance to spawn.
The tree-spawn function attempts to place a tree at the sapling's location. There is a 1/10 chance of using the big-tree algorithm, and a 9/10 chance of using the small-tree algorithm. Pine and birch trees are entirely separate and have their own algorithms, which are only called by world/biome creation.
If the attempt to spawn fails, the sapling's counter is reset to 0 and life goes on (for another ~27 minutes).
Finally, trees never grow additional logs or leaves after they spawn.
Small trees vs. big trees
Height and logs: Small trees require 6-8 blocks of vertical space; the trunk itself will be 2 less than this (so 4-6 logs per tree). Big trees require 6-16 blocks of vertical space, and have an additional 1/11 chance of failing to spawn because they can roll 5 height but are then canceled. Their trunk can branch out, but I think the top will often be 2 blocks lower than the clearance as well. I have seen big trees with up to 64 blocks of wood, but they can have as little as 4 and mostly seem to be in the 20s.
Horizontal clearance: Small trees require no empty (air or leaf) spaces around the sapling (so you can have a block next to it or dig it into the ground), 2 empty spaces around the top of the trunk to the top of the vertical clearance, and 1 empty space around the rest of the trunk. Only air and leaves count as empty; signs, glass, etc., do not (but see below for more on that). Note: this clearance is square, so "2" clearance means a 5x5 square around the trunk at that level must be empty. Big trees do not require any horizontal clearance at all.
Ground: Both types of trees only grow on grass or dirt. But small trees will replace grass with dirt and big ones won't.
Leaves: On small trees, leaves spawn starting from the third log down from the top, up to a single leaf block above the trunk. Big trees spawn branches and leaves all over the place.
Leaf spawning, partial blocks, and redstone
Trees behave oddly when it comes to signs, pressure plates, redstone wires, and other similar blocks that occupy a block partially. If such a block is within the clearance needed around the trunk for small trees, it will stop the tree from growing. If, however, it is outside the clearance but is in a block where leaves grow, the leaves will replace (delete) it.
This can be used to affect redstone circuits. For example (side view):
The ceiling height here is 6 to force a small tree of trunk height 4, which will have leaves 1 block off the ground. When the tree grows, it will delete the redstone that is on top of the stone, breaking the circuit. This can be used for very long timers (unfortunately, the exact time is random).
Bone meal
Bone meal bypasses the counter mechanism and the light-level condition, and gives the tree a chance to spawn immediately. It uses the exact same spawn function as natural growth does, so the tree must still be able to fit in its surroundings, and has the same big-tree/small-tree probability. This means that the number of bonemeal uses it takes to grow a tree in given surroundings is proportional to the time it will take to grow naturally (though both have random factors involved).
The fact that bone meal does not require light to grow trees ought to be exploitable, but I don't see how -- you're going to want light to see where to click with the bone meal.
Empirical test of indoor tree farming
Using MCEdit, I created two 32x32 tree farms with solid walls and ceilings (height 8), one with trees in a grid with 2 spaces in all directions (total 100 saplings) and one using a checkerboard pattern (total 512 saplings).
I inserted logging functions into the code to track the actual number of log blocks created over time in each farm, and sped growth up dramatically by making the counter go to 3 instead of 15 and increasing the 1/5 chance to 1/3. These changes should evenly apply to all farm/tree types and just made the test take less time. I did not harvest any trees, because I couldn't figure out a way to do that in a controlled way while collecting data.
The 2-spaced tree farm soon looked better, as all the saplings sprouted, whereas only 2/5 of saplings in the checkerboard sprouted. The checkerboard produced 2x as much wood during my test period, before growth slowed as many of the remaining saplings were unable to spawn.
Effectively, you're planting 5x the saplings for a 2x increase in total logs produced in a "reasonable" growing time.
I then tested the 2-spaced grid against a 1-spaced grid (256 saplings). The 1-spaced grid, although it had 2.5x as many saplings, only grew slightly more trees (and logs) than the 2-spaced grid.
Therefore, my initial conclusion is in favor of the 2-spaced grid, since the checkerboard approach requires so much more planting. Trees spaced 2 apart are also easier to cut down. 1-spaced grids are not really useful.
I don't think attempting to spawn only big trees can be efficient. Although they can produce a lot of wood, they don't produce 10x as much on average as small trees.
Leaf Decay
A leaf block will eventually decay unless there is a "path" leading through other leaf blocks, no more than 4 blocks long (no diagonals), to a log.
In other words, a single log can support leaves in an octahedral pattern, with this cross-section from the top and from the side:
Isolated leaves/small groups of leaves will decay quickly, while large amounts of leaves connected to each other will decay slowly.
There is no distinction between "original" logs and logs that you place, or between different colors of logs. However, it appears that if you place a log while leaf decay is already taking place, it might or might not prevent decay.
When a leaf block decays or is destroyed, it has a 1/16 chance of dropping a sapling.
Trees destroyed with TNT can drop logs and saplings. TNT destroys 7/10 of all item drops from destroyed blocks.
Biomes
The following are the probabilities of different types of trees appearing in different biomes. Note that some biomes simply generate more or fewer trees than others; the below is just the probability, given that a tree is being placed, of it being each available type of tree.
Rainforest: 33% big, 67% small Forest: 20% birch, 27% big, 53% small Taiga: 33% pine with round top, 67% pine with conical shape Others: 10% big, 90% small
Impressive, well done.
However, I have a question. Is it possible to grow birch trees and redwood/pine trees from saplings?
I've never had any such luck, only ever getting standard trees, even when using saplings harvested from
the new trees.
Impressive, well done. However, I have a question. Is it possible to grow birch trees and redwood/pine trees from saplings?
No, because they use entirely separate code. I started working on a mod for varietal saplings, but it's harder than it seems at first. The data value that other objects use for varieties, like logs, wool, etc., is used in saplings for a growth timer. I know it's possible somehow, Would be easier with non-obfuscated code! (Saplings growing random tree types would be easy, but I want them to propagate correctly.)
Quote from niels »
looks like somebody had too much free time good work
(Looks around forum.) Yes, but did you mean somebody in particular?
Quote from TheNosferatu »
Thanks for thr guide, great work! If i understand it correctly, placing blocks in the spacing, but not directly above the sapling at 4 - 6 high will (eventually) force a super tree
Yep, all it takes to force the big tree algorithm, or, rather disallow the small tree algorithm, is a pillar two blocks high next to the sapling. Or any other block within the clearance area.
honk, small tree and big tree refer to tree types/algorithms, not literally to the size. Trees generated with the "large tree" algorithm can have trunks as short as 4 blocks (total height 6). Also, the first trees to grow in a close-packed environment will not have other trees obstructing them yet.
Impressive, well done.
However, I have a question. Is it possible to grow birch trees and redwood/pine trees from saplings?
I've never had any such luck, only ever getting standard trees, even when using saplings harvested from
the new trees.
I'm gonna throw this out here again, b/c it's an interesting and unanswered point.
Since a bunch of people have been wondering about growing birch/pine trees, I put up a mod for it in the mods forum. Without that, though, you only get regular trees.
Sathka, good question. I updated the post. Some biomes do have different distributions.
Also, leaves do have the same chance to drop saplings whether they decay or are destroyed. But if you take out the leaves in the middle of the tree (after the trunk is gone), the whole thing will decay a bit faster.
Im trying to set up a tree farm, but cant decide on the exact pattern i want to plant in. I want all the trees to be able to grow without blocking eachother, so that when i decide to "harvest" i can do so all in one go..
So, how much space do i need to make sure all trees can grow together? I have currently placed the trees with 5 blocks between them, so they dont block eachother, but it feels ineffective since it takes up so much space.
Im also curious what height is ideal? I want to be able to harvest all the blocks without placing a block to stand on, so i assumed that 6 high room would be great, however this leads to my trees only producing 4 logs each, wich is very íneffective. I guess a 7 high roof would produce 5-log trees, since the top block is always leaves as i understand it. Anyway, some suggestions on layouts would be appreciated, thanks.
it's not "space efficient" as some would contest, but I can harvest it very quickly and it's easy to re-plant, just walk sideways and hold my mouse button. I think all the patterns people come up with like the 80% planted surface is dumb because you have to go multiple directions to harvest it all and to me, that wastes time (the world is infinite, space efficency is the least of your concerns, harvest efficiency should be the ONLY concern).
Rollback Post to RevisionRollBack
Join me on Dirkocraft.com
Paininabox's Thread O' Links tips, tricks and a wealth of consolidated info!
Hello again. I've been poring through more decompiled source code and running tests, and have prepared a definitive guide to tree growth and leaf decay.
...
Leaf spawning, partial blocks, and redstone
Trees behave oddly when it comes to signs, pressure plates, redstone wires, and other similar blocks that occupy a block partially. If such a block is within the clearance needed around the trunk for small trees, it will stop the tree from growing. If, however, it is outside the clearance but is in a block where leaves grow, the leaves will replace (delete) it.
...
Questions?
<Sigh> Well, back to the test chamber then...
Here we are with newly grown trees showing a decided tendency (100%) to avoid destroying torches or signs. If the code says replace them, it isn't happening. This is single player, fancy graphics. Both graphics quality and single/multi-player have previously been shown to affect leaves and trees.
Growth rate
Trees in single player have a chance to grow if they are within a 19x19 chunk area (304x304 blocks) centered on the player. Their growth function is called at intervals that appear somewhat random. In tests, I was getting a long-term average of slightly less than 3 calls per minute per sapling.
When the growth function is called, it first checks the light level 1 block above the sapling, which must be 9 or more. Trees are no more likely to grow in daylight than in torchlight. Trees that are artificially lit should therefore grow twice as fast as unlit outdoor trees, which only have a chance to grow during daytime.
If there is sufficient light, there is only a 1/5 chance of continuing (in effect turning 3 calls per minute into 0.6 calls per minute).
The function then increments the counter on each sapling, which starts at 0 and must reach 15. If it has reached 15, the tree-spawning function is called. If I'm doing my math right, it should be "about" 27 real minutes on average from planting to when the tree gets its first chance to spawn.
The tree-spawn function attempts to place a tree at the sapling's location. There is a 1/10 chance of using the big-tree algorithm, and a 9/10 chance of using the small-tree algorithm. Pine and birch trees are entirely separate and have their own algorithms, which are only called by world/biome creation.
If the attempt to spawn fails, the sapling's counter is reset to 0 and life goes on (for another ~27 minutes).
Finally, trees never grow additional logs or leaves after they spawn.
Small trees vs. big trees
Height and logs: Small trees require 6-8 blocks of vertical space; the trunk itself will be 2 less than this (so 4-6 logs per tree). Big trees require 6-16 blocks of vertical space, and have an additional 1/11 chance of failing to spawn because they can roll 5 height but are then canceled. Their trunk can branch out, but I think the top will often be 2 blocks lower than the clearance as well. I have seen big trees with up to 64 blocks of wood, but they can have as little as 4 and mostly seem to be in the 20s.
Horizontal clearance: Small trees require no empty (air or leaf) spaces around the sapling (so you can have a block next to it or dig it into the ground), 2 empty spaces around the top of the trunk to the top of the vertical clearance, and 1 empty space around the rest of the trunk. Only air and leaves count as empty; signs, glass, etc., do not (but see below for more on that). Note: this clearance is square, so "2" clearance means a 5x5 square around the trunk at that level must be empty. Big trees do not require any horizontal clearance at all.
Ground: Both types of trees only grow on grass or dirt. But small trees will replace grass with dirt and big ones won't.
Leaves: On small trees, leaves spawn starting from the third log down from the top, up to a single leaf block above the trunk. Big trees spawn branches and leaves all over the place.
Leaf spawning, partial blocks, and redstone
Trees behave oddly when it comes to signs, pressure plates, redstone wires, and other similar blocks that occupy a block partially. If such a block is within the clearance needed around the trunk for small trees, it will stop the tree from growing. If, however, it is outside the clearance but is in a block where leaves grow, the leaves will replace (delete) it.
This can be used to affect redstone circuits. For example (side view):
[] [] [] []
[] [] [] [] []
[] [] [] [] []
[] [] [] [] []
[] [] [] [] []
[] [] [] []
Where = redstone wire and = sapling
The ceiling height here is 6 to force a small tree of trunk height 4, which will have leaves 1 block off the ground. When the tree grows, it will delete the redstone that is on top of the stone, breaking the circuit. This can be used for very long timers (unfortunately, the exact time is random).
Bone meal
Bone meal bypasses the counter mechanism and the light-level condition, and gives the tree a chance to spawn immediately. It uses the exact same spawn function as natural growth does, so the tree must still be able to fit in its surroundings, and has the same big-tree/small-tree probability. This means that the number of bonemeal uses it takes to grow a tree in given surroundings is proportional to the time it will take to grow naturally (though both have random factors involved).
The fact that bone meal does not require light to grow trees ought to be exploitable, but I don't see how -- you're going to want light to see where to click with the bone meal.
Empirical test of indoor tree farming
Using MCEdit, I created two 32x32 tree farms with solid walls and ceilings (height 8), one with trees in a grid with 2 spaces in all directions (total 100 saplings) and one using a checkerboard pattern (total 512 saplings).
I inserted logging functions into the code to track the actual number of log blocks created over time in each farm, and sped growth up dramatically by making the counter go to 3 instead of 15 and increasing the 1/5 chance to 1/3. These changes should evenly apply to all farm/tree types and just made the test take less time. I did not harvest any trees, because I couldn't figure out a way to do that in a controlled way while collecting data.
The 2-spaced tree farm soon looked better, as all the saplings sprouted, whereas only 2/5 of saplings in the checkerboard sprouted. The checkerboard produced 2x as much wood during my test period, before growth slowed as many of the remaining saplings were unable to spawn.
Effectively, you're planting 5x the saplings for a 2x increase in total logs produced in a "reasonable" growing time.
I then tested the 2-spaced grid against a 1-spaced grid (256 saplings). The 1-spaced grid, although it had 2.5x as many saplings, only grew slightly more trees (and logs) than the 2-spaced grid.
Therefore, my initial conclusion is in favor of the 2-spaced grid, since the checkerboard approach requires so much more planting. Trees spaced 2 apart are also easier to cut down. 1-spaced grids are not really useful.
I don't think attempting to spawn only big trees can be efficient. Although they can produce a lot of wood, they don't produce 10x as much on average as small trees.
Leaf Decay
A leaf block will eventually decay unless there is a "path" leading through other leaf blocks, no more than 4 blocks long (no diagonals), to a log.
In other words, a single log can support leaves in an octahedral pattern, with this cross-section from the top and from the side:
[] [] [] [] [] [] [] []
[] [] [] [] [] []
[] [] [] []
[] []
[] []
[] [] [] []
[] [] [] [] [] []
[] [] [] [] [] [] [] []
Isolated leaves/small groups of leaves will decay quickly, while large amounts of leaves connected to each other will decay slowly.
There is no distinction between "original" logs and logs that you place, or between different colors of logs. However, it appears that if you place a log while leaf decay is already taking place, it might or might not prevent decay.
When a leaf block decays or is destroyed, it has a 1/16 chance of dropping a sapling.
Trees destroyed with TNT can drop logs and saplings. TNT destroys 7/10 of all item drops from destroyed blocks.
Biomes
The following are the probabilities of different types of trees appearing in different biomes. Note that some biomes simply generate more or fewer trees than others; the below is just the probability, given that a tree is being placed, of it being each available type of tree.
Rainforest: 33% big, 67% small
Forest: 20% birch, 27% big, 53% small
Taiga: 33% pine with round top, 67% pine with conical shape
Others: 10% big, 90% small
Questions?
However, I have a question. Is it possible to grow birch trees and redwood/pine trees from saplings?
I've never had any such luck, only ever getting standard trees, even when using saplings harvested from
the new trees.
I thought it said troll science at first
No, because they use entirely separate code. I started working on a mod for varietal saplings, but it's harder than it seems at first. The data value that other objects use for varieties, like logs, wool, etc., is used in saplings for a growth timer. I know it's possible somehow, Would be easier with non-obfuscated code! (Saplings growing random tree types would be easy, but I want them to propagate correctly.)
(Looks around forum.) Yes, but did you mean somebody in particular?
Yep, all it takes to force the big tree algorithm, or, rather disallow the small tree algorithm, is a pillar two blocks high next to the sapling. Or any other block within the clearance area.
I'm gonna throw this out here again, b/c it's an interesting and unanswered point.
Also, leaves do have the same chance to drop saplings whether they decay or are destroyed. But if you take out the leaves in the middle of the tree (after the trunk is gone), the whole thing will decay a bit faster.
yes, search "tree tube" on these forums or "tree tube minecraft" on youtube.
Paininabox's Thread O' Links tips, tricks and a wealth of consolidated info!
by c0yote
I tried it with terrible results. I gave my wife my glasses for a second, a creeper showed up and now my wife is pregnant.
Stupid 3D..
I posted about this in a another thread.
Here's the first post I made on the first page
viewtopic.php?f=1020&t=150594#p2160492
and here's the second of my posts on a different page. This one shows how I harvest it.
viewtopic.php?f=1020&t=150594&start=30#p2162218
it's not "space efficient" as some would contest, but I can harvest it very quickly and it's easy to re-plant, just walk sideways and hold my mouse button. I think all the patterns people come up with like the 80% planted surface is dumb because you have to go multiple directions to harvest it all and to me, that wastes time (the world is infinite, space efficency is the least of your concerns, harvest efficiency should be the ONLY concern).
Paininabox's Thread O' Links tips, tricks and a wealth of consolidated info!
<Sigh> Well, back to the test chamber then...
Here we are with newly grown trees showing a decided tendency (100%) to avoid destroying torches or signs. If the code says replace them, it isn't happening. This is single player, fancy graphics. Both graphics quality and single/multi-player have previously been shown to affect leaves and trees.