Dark/pale oak leaves sometimes do not generate centered on the tree
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree.
How to reproduce:
- Execute the following command to spawn a dark oak tree:
/place feature minecraft:dark_oak
or the following command to spawn a pale oak tree:
/place feature minecraft:pale_oak
- Repeat step 1 until you find a tree with uncentered leaves.
Expected result:
The leaves would generate roughly in the center of the treetop.
Observed result:
The leaves can sometimes generate several blocks off-center from the treetop.
Created Issue:
Dark oak leaves not growing centered on the tree
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. Possible bug or works as intended?
Environment
Windows 8.1; Java Version 7, Build 60
Example of misplaced leaves.
Dark oak leaves notgrowing centered on the treeDark oak leaves not spawning centered on the tree
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree. Possible bug or works as intended?
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree. Possible bug
or works as intended?
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree. I have seen examples of misaligned leaves spawned in roofed forests. Possible bug?
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree. I have seen examples of misaligned leaves spawned in roofed forests. Possible bug?
Edit: In the second screenshot, DarkOakLeafMisplace2.png, only half of the trunk spawned on one side.
is duplicated by
Windows 8.1; Java Version 7, Build 60
Dark oak leavesnot spawningcentered on the treeDark oak leaves sometimes do not generate centered on the tree
Dark/pale oak leaves sometimes do not generate centered on the tree
Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree.
I have seen examples of misaligned leaves spawned in roofed forests. Possible bug?
Edit: In the second screenshot, DarkOakLeafMisplace2.png, only half of the trunk spawned on one side.Occasionally when grown, dark oak leaves will grow only on one side of the tree. Appears to spawn all the leaves, just not in the right place. This does not always happen when growing a dark oak tree.
How to reproduce:
- Execute the following command to spawn a dark oak tree:
/place feature minecraft:dark_oakor the following command to spawn a pale oak tree:
/place feature minecraft:pale_oak- Repeat step 1 until you find a tree with uncentered leaves.
Expected result:
The leaves would generate roughly in the center of the treetop.
Observed result:
The leaves can sometimes generate several blocks off-center from the treetop.
relates to
I'm aware of MC-59308 and MC-168443, but I believe this issue is different enough or was not properly considered when that bug was closed as WAI.
To explain, here's a quick recap of how dark oak trees generate:
- The trunk is 2x2 and has a "bend" at the top, which is a horizontal offset of the top zero to two layers of logs.
- Vertical 1x1 "branches" can generate in random locations around the trunk, starting at random heights and ending one block below the top of the trunk. These branches are always offset from the trunk relative to where it started at the bottom, not where it ends at the top.
- A main set of leaves generates around the top of the trunk, following the bend's horizontal offset. This set consists of three or four layers. (from bottom to top: 6x6, 8x8, 6x6 and optionally 2x2)
- Secondary, overlapping sets of leaves are generated for each of the generated branches. These sets each consist of two layers, 5x5 and 3x3. (For straight trees these would essentially extend the bottom layer of the main set of leaves to 8x8 with some blocks missing around the edge, while the top layer completely blends in with the second layer of the main set of leaves.)
Expected behavior: Those secondary sets of leaves generate relative to where the branches end.
Actual behavior: The location of the secondary sets of leaves incorrectly add the horizontal offset of the bent top of the main trunk, instead of using the horizontal position of the trunk without that bend, as the branches do.
Code-wise you can see that there are multiple sets of local int variables for calculating the horizontal position. One is the original position of the sapling (1), one is the sapling location plus the horizontal offset for the "bend" at the top of the trunk (2), and then there's the branch offset (3). For the branch logs values (1) and (3) are combined, while for the foliage placer tree nodes the values (2) and (3) are combined instead. This causes the top layer of the secondary set of leaves to be completely redundant, as the main set of leaves is guaranteed to occupy that space.
This is also inconsistent with acacia, large oak or large jungle trees, which all correctly place their additional sets of leaves at the end of their branches. For visualization purposes I've attached a screenshot of a dark oak tree with a maximum bend towards the west and a branch in southeast direction. As you can see, there are some additional leaves on the lowest leaf layer towards the southeast, but they do not enclose the end of the branch, which is even exposed on its eastern side, as its corresponding leaves are needlessly offset towards the west by two blocks.
Has this been addressed? I just noticed a separate bunch of leaves around a pale oak tree's branch opposite to the direction of the main trunk's bend in 1.21.4, which suggests this was fixed.
[edit] Found some time to check the code, and it seems the error in the calculation of branch leaves attachment locations has indeed been fixed. Presumably that happened as part of the fix for MC-59308?





It's easy to see what is going on when you strip the leaves off one of the trees. The tree top is generating centered around the trunk, but the trunk is going crooked at the top, sort of like an acacia.
I'm adding a screenshot of a stripped dark oak.
Works As Intended
That is just their spawning pattern.
Can confirm in 1.21.2 Pre-Release 4 and 1.21.1.