IllegalArgumentException in DecoFallenTree
Tommsy64 opened this issue ยท 2 comments
Affected Mod Versions:
- Forge version: 14.23.5.2838
- RTG version: RTG-1.12.2-6.1.0.0-beta.7
Affected method:
public boolean isValidLogCondition(float strength, Random rand) {
switch (this.logCondition) {
case ALWAYS_GENERATE:
return true;
case RANDOM_CHANCE:
return (rand.nextInt(this.logConditionChance) == 0);
case X_DIVIDED_BY_STRENGTH:
return (rand.nextInt((int) (this.logConditionNoise / strength)) == 0);
default:
return false;
}
}
Seems like either logConditionChance
is 0 or logConditionNoise
is 0 or strength >> logConditionNoise
.
The only two Biomes I see that use X_DIVIDED_BY_STRENGTH
are RealisticBiomeBOPGrove
and RealisticBiomeBOPMapleWoods
.
Commit 1496705 removed the lines .setLogConditionNoise(8f);
statements from these two Biomes while keeping the logCondition
as X_DIVIDED_BY_STRENGTH
. Therefore, the IllegalArgumentException is probably caused by the 0 valued logConditionNoise
.
Right now, the private field logConditionNoise
has its only reference in #isValidLogCondition(float, rand)
and in its getter. The getter has no reference, and the field has no setter.
Proposed Solutions
- Add back the setter for
logConditionNoise
and set it to8f
and add check to make surelogConditionNoise
is not 0 before using it inrand.nextInt()
.
OR - Completely remove
logConditionNoise
andX_DIVIDED_BY_STRENGTH
Thanks for submitting the bug report - this has already been squashed in a local dev branch and will be pushed soon.
If you're interested in being a beta tester, consider joining our Discord server and letting us know. We're about to release a proper build for testing.
Fixed in af2f20c