-
Bug
-
Resolution: Fixed
-
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
- Download the attached data pack Crashland.zip and add it to a new world
- Teleport to the mojira:crashland dimension
/execute in mojira:crashland run tp @s ~ ~ ~
- The game crashes
- 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.