Relics

Relics

24M Downloads

StackOverflow in case of fixed randomness

TheDeadSnake opened this issue ยท 1 comments

commented

Method that causes the Overflow:

The recursive method utils/MathUtils.multicast has no upper limit / definite stopping point:

public static int multicast(RandomSource random, double chance, double chanceMultiplier) {
return random.nextDouble() <= chance ? multicast(random, chance * chanceMultiplier, chanceMultiplier) + 1 : 0;
}


How to reproduce:

Example Mod: Mahou Tsukai (Link)

  1. Use Mahou Tsukais 'Rule Breaker' item, to fix randomness to a constant value
  2. Kill a Mob
java.lang.StackOverflowError: Exception in server tick loop
	at TRANSFORMER/[email protected]/it.hurts.sskirillss.relics.utils.MathUtils.multicast(MathUtils.java:43) ~[relics-1.21-0.9.2.0.jar%23845!/:1.21-0.9.2.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/it.hurts.sskirillss.relics.utils.MathUtils.multicast(MathUtils.java:43) ~[relics-1.21-0.9.2.0.jar%23845!/:1.21-0.9.2.0] {re:mixin,re:classloading}
[...]
commented

Thanks for the info. Fixed in fb2981f. Will be released in the next update.