Negative chance passed to randInt (reported from Twilight Forest Discord)
noobanidus opened this issue ยท 2 comments
I'm not sure who reported it or who posted the following crash report:
[17:48:23] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Exception ticking world
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:762) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185) ~[chd.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
Caused by: java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:388) ~[?:1.8.0_51]
at net.daveyx0.multimob.spawn.MMSpawnChecks.isLuckyEnoughToSpawn(MMSpawnChecks.java:181) ~[MMSpawnChecks.class:?]
at net.daveyx0.multimob.spawn.MMSpawnChecks.performSpawnChecks(MMSpawnChecks.java:39) ~[MMSpawnChecks.class:?]
at net.daveyx0.multimob.spawn.MMSpawnerEventHandler.onCheckSpawn(MMSpawnerEventHandler.java:81) ~[MMSpawnerEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1880_MMSpawnerEventHandler_onCheckSpawn_CheckSpawn.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
at net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(ForgeEventFactory.java:201) ~[ForgeEventFactory.class:?]
at net.minecraft.world.WorldEntitySpawner.func_77192_a(WorldEntitySpawner.java:151) ~[anb.class:?]
at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:203) ~[oo.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:756) ~[MinecraftServer.class:?]
... 4 more
Androsa pointed out: https://github.com/Daveyx0/MultiMob/blob/master/main/java/net/daveyx0/multimob/spawn/MMSpawnChecks.java#L177-L181 seems to be the issue
And basically said: It would be better to check chance < 1 instead of == -1 as there appear to be issues where negative values greater than -1 are being passed in.
Addendum: 0 or lower is not allowed for random.nextInt
.