Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-237375

Secondary dark oak leaves generation uses incorrect offset from branches

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.17.1, 1.19, 1.20.1
    • Community Consensus
    • (Unassigned)

      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.

            Unassigned Unassigned
            Wormbo Wormbo
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: