A big oak tree is made up of a main trunk and multiple branches. A "branch" always contains leaves, but may not always contain logs.
heightLimit
: The actual height of the tree, including leaf blocks at the top (between 5 and 16)trunkHeight
: The height of the trunkleafDistanceLimit
: The distance from a log that leaves can generate, set to 4 for sapling growth, though appears to be set to 5 for natural growth for some reasonheightAttenuation
: The ratio between theheightLimit
to thetrunkHeight
, equal to 1/phi (0.618)branchCount
: The number of branches per y-layerbranchSlope
: The slope/gradient of a branch, equal to 0.381
- Check if the tree is in a valid spawn location
- Prepare for growth: choose branch positions
- Generate leaves
- Generate trunk
- Generate logs in branches
- The spawn location is invalid if the block standing on is not dirt, grass or farmland.
heightLimit
is set to a random value between 5 and 16.- The spawn location is invalid while there is an obstruction between the sapling and the sapling plus the
heightLimit
. - The
heightLimit
is decreased until the spawn location is valid. The growth algorithm does not give up just because there was an obstruction at the start. - If the
heightLimit
is now less than 6, the spawn location is invalid.
A branch is defined by two coordinates, the coordinates of the end of the branch, and the coordinates in the trunk at the start of the branch.
trunkHeight
is set toheightLimit * heightAttenuation
, rounded down.branchCount
is set to 2 if theheightLimit
is 11 or more, and 1 otherwise.- A branch is added at the top of the trunk. Because its end is inside the trunk no extra logs are generated, but extra leaves are.
- For each y-layer from
heightLimit - leafDistanceLimit
toheightLimit * 0.3
rounded up, generatebranchCount
branches which end at that y-level. - The maximum horizontal distance from the trunk to the end of each branch is such that all branches will fit entirely inside a sphere of radius
heightLimit * 0.664
centered at heightheightLimit / 2
. - The actual distance from the trunk to the end of the branch is randomized so that the minimum length is 0.247 times the maximum length.
- The branch connects to the trunk at a lower y-position, respecting the
branchSlope
. - The branch will not generate if there is an obstruction in the straight line between its connection to the trunk and its end.
Leaves are generated in a sphere of radius leafDistanceLimit
around the end of each branch.
trunkHeight + 1
log blocks are generated for the trunk.
- A branch will only generate logs if the place it connects to the tree is more than 0.2 of the way up to
heightLimit
. - A branch generates logs in a straight line from its connection to the trunk to its end.
- If the branch is further from the trunk in the x-direction, there will be one log per x-coordinate. Otherwise there will be one log per z-coordinate.