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

The big tree generator handles tree height variable incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 18w07a
    • Minecraft 1.4.7, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.6.2, Minecraft 1.10.2, Minecraft 16w33a, Minecraft 16w39c, Minecraft 16w40a, Minecraft 16w44a, Minecraft 1.11, Minecraft 17w16b
    • Confirmed

      (Relates to MC-10534 and MC-2759; doesn't fix them, but perhaps makes the effects of the feature less noticeable.)

      (Using MCP namings.)
      The WorldGenBigTree has instance variable heightLimit. The same generator instance is used to create many trees during world generation. However, that heightLimit variable is only written to at few occasions; initialization to 0, randomized when it is zero, and when tree height (free space) check deems it needs to be shorter. Thus, the start of world generation can look like this (for tree heights):
      0 -> 10, 10, 10, 10, 10, .. (30 more of 10) .., 7, 7, 7, 7, 7, 10, 10, 10, (10 more of 10), ... (occasional streak of 10 times 11), etc. etc.

      (Edit: ) Note also that the trees are created somewhat "next to next" per location, the same height of trees can be noticed in the world, as many nearby big trees have the same height, then another bunch has another height shared between them, etc.

      Fix?

      WorldGenBigTree
          public boolean generate(World world, Random random, int x, int y, int z) {
              ...
              // FIX? Remove this check.
              //if (this.heightLimit == 0) {
                  this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit);
              //}
      
              if (!this.validTreeLocation()) {
                  return false;
              }
              ...
      

      Tested on 1.4.7 and nice random heights from tree to tree, no sequences of same height observable.

      Since the generated worlds from the same seed (from MC-10534) look exactly the same (including the pair of two small "bigtrees"), this affects also all the way to 13w10b, 1.5-pre. (Can not check the code for the latest (only the trees/world), though, but would be quite the miracle if this bug wasn't there, yet produced same trees.)

            ProfMobius ProfMobius (Thomas Guimbretiere)
            bugi74 Markku
            Votes:
            37 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: