In Control!

In Control!

72M Downloads

IllegalArgumentException: bound must be positive

JulieCooper opened this issue ยท 1 comments

commented

Getting a server crash whenever a player attempts to join the server. Doesn't always crash the server though. Seems to be the result of a negative number being fed to nextInt on line 353 of SpawnerSystem.java. Is this related to the new 1.18 world heights now allowing negatives?

---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 2/14/22, 12:52 AM
Description: Exception in server tick loop

java.lang.IllegalArgumentException: bound must be positive
	at java.util.Random.nextInt(Random.java:322) ~[?:?] {re:mixin}
	at mcjty.incontrol.spawner.SpawnerSystem.getValidSpawnablePosition(SpawnerSystem.java:360) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.spawner.SpawnerSystem.getRandomPositionOnGround(SpawnerSystem.java:316) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.spawner.SpawnerSystem.getRandomPosition(SpawnerSystem.java:263) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.spawner.SpawnerSystem.executeRule(SpawnerSystem.java:146) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.spawner.SpawnerSystem.executeRule(SpawnerSystem.java:117) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.spawner.SpawnerSystem.checkRules(SpawnerSystem.java:66) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at mcjty.incontrol.ForgeEventHandlers.onWorldTick(ForgeEventHandlers.java:92) ~[incontrol-1.18-6.0.0.jar%2381!/:1.18-6.0.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_581_ForgeEventHandlers_onWorldTick_WorldTickEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-5.0.3.jar%232!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%232!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%232!/:?] {}
	at net.minecraftforge.event.ForgeEventFactory.onPreWorldTick(ForgeEventFactory.java:861) ~[forge-1.18.1-39.0.75-universal.jar%23128!/:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:865) ~[server-1.18.1-20211210.034407-srg.jar%23124!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerAccessor,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A}
	at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:328) ~[server-1.18.1-20211210.034407-srg.jar%23124!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:808) ~[server-1.18.1-20211210.034407-srg.jar%23124!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerAccessor,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668) ~[server-1.18.1-20211210.034407-srg.jar%23124!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerAccessor,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A}
	at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[server-1.18.1-20211210.034407-srg.jar%23124!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerAccessor,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:crafttweaker.mixins.json:common.access.server.AccessMinecraftServer,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A}
	at java.lang.Thread.run(Thread.java:833) [?:?] {}

The crash can be replicated with an empty spawn.json and as much as a single spawning rule in spawner.json:

[
    {
        "mob": [
            "minecraft:zombie"
        ],
        "persecond": 1,
        "attempts": 1,
        "amount": {"minimum": 1, "maximum": 4},
        "conditions": {
            "dimension": "minecraft:overworld"
        }
    }
]
commented

Fixed in the last version