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

Feature placement - java.lang.IllegalArgumentException: bound must be positive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 21w15a
    • 21w07a, 21w11a
    • None
    • Confirmed
    • Crash
    • Very Important

      The bug

      Some features and decorators use Random.randInt with a configurable value as input. This input is not always validated to be above 0 and can crash the game.

      Feature Crashes if
      random_patch xspread < 0
      or yspread < 0
      or zspread < 0
      flower xspread <= 0
      or yspread <= 0
      or zspread <= 0
      random_patch
      or flower
      block_placer.type is "column_placer"
      and block_placer.extra_size < 0
      geode min_distribution_points >= max_distribution_points
      or min_point_offset >= max_point_offset
      simple_random_selector features is empty
      tree foliage_placer.type is "pine_foliage_placer"
      and calculated trunk height < foliage_placer.height [1]
      Decorator  
      depth_average spread < 0
      glowstone count < 0

      How to reproduce

      1. Download the attached data pack Crashland.zip and add it to a new world
      2. Teleport to the mojira:crashland dimension
        /execute in mojira:crashland run tp @s ~ ~ ~
        
      3. The game crashes
      4. To test each of the above cases, open data/mojira/worldgen/biome/crashland.json and edit the configured feature on line 21.

      Footnotes

      Method and class names using Mojang names.

      1. The reason only the PineFoliagePlacer can crash is because it uses nextInt in PineFoliagePlacer.foliageRadius. The value that is used for this is computed by trunkPlacer.getTreeHeight(...) - foliagePlacer.foliageHeight(...) + 1.

            slicedlime [Mojang] slicedlime
            Misoloo [Helper] Misode
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: