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

Root system feature allows hanging root vertical span of 0, causing error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.2, 1.19.3 Pre-release 2
    • None
    • Plausible
    • Custom Worlds, Data Packs
    • Low
    • Platform

      minecraft:root_system feature allows hanging_roots_vertical_span to be set to 0. If a data pack is used to generate such feature, however, this actually causes an error during world generation.

      Code analysis (yarn 1.19.2)

      RootSystemFeatureConfig's config describes hanging_roots_vertical_span as a value between 0 and 16. (See Codec.intRange(0, 16).fieldOf("hanging_roots_vertical_span"))

      In RootSystemFeature#generateHangingRoots, however, random.nextInt is called with the vertical span value. This crashes when the value is 0. (See also MC-254774 for crash with similar cause)

          int i = config.hangingRootRadius;
          int j = config.hangingRootVerticalSpan;
          for (int k = 0; k < config.hangingRootPlacementAttempts; k++) {
            mutablePos.set((Vec3i)pos, random.nextInt(i) - random.nextInt(i), random.nextInt(j) - random.nextInt(j), random.nextInt(i) - random.nextInt(i));
      

            Unassigned Unassigned
            apple502j apple502j
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: