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 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Decorator | |
|
|
|
|
How to reproduce
Download the attached data pack
and add it to a new world
Teleport to the
mojira:crashlanddimension/execute in mojira:crashland run tp @s ~ ~ ~❌ The game crashes
To test each of the above cases, open
data/mojira/worldgen/biome/crashland.jsonand 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.
I can confirm.