Mojira Archive
MC-216588

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

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.

Fixed

[Helper] Misode

[Mojang] slicedlime

2021-02-23, 02:41 AM

2021-04-09, 01:03 PM

2021-04-09, 01:03 PM

5

4

Confirmed

Very Important

Crash

21w07a, 21w11a

21w15a