Roguelike Dungeons

Roguelike Dungeons

33M Downloads

Bounds?

meza opened this issue ยท 2 comments

commented

Hey,

I'm trying to set stuff up, but every now and then I get an ugly java.lang.IllegalArgumentException: bound must be positive in my face. As much as I looked in the code it would appear that the chests.size() returns 0. What am I doing wrong?

On MC 1.7.10


java.lang.IllegalArgumentException: bound must be positive
	at java.util.Random.nextInt(Random.java:388)
	at greymerk.roguelike.treasure.TreasureManager.addItem(TreasureManager.java:70)
	at greymerk.roguelike.treasure.loot.LootRule.process(LootRule.java:31)
	at greymerk.roguelike.treasure.loot.LootRuleManager.process(LootRuleManager.java:73)
	at greymerk.roguelike.dungeon.Dungeon.generate(Dungeon.java:77)
	at greymerk.roguelike.dungeon.Dungeon.generateNear(Dungeon.java:65)
	at greymerk.roguelike.dungeon.Dungeon.spawnInChunk(Dungeon.java:138)
	at greymerk.roguelike.DungeonGenerator.generate(DungeonGenerator.java:16)
	at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:112)
	at net.minecraft.world.gen.ChunkProviderServer.func_73153_a(ChunkProviderServer.java:280)
	at net.minecraft.world.chunk.Chunk.func_76624_a(Chunk.java:1045)
	at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:190)
	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:131)
	at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:101)
	at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:265)
	at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:78)
	at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:92)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387)
	at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

lootconf.zip

commented

Actually fixed it. The reason there weren't any chests, is that my level config and loot rules had different level numbers by accident. Still, it might be worth doing a >0 check on the chests size for a better error message and maybe no crash? :)

commented

I just recently fixed this in 1.10.2 and 1.11.2

At this point probably not worth releasing a new version for 1.7.10 as this is a niche bug. Naturally this bug is only triggered in a situation where you ask the system to add items to specific kind of chest, but you neglect to add chests of that type. which is probably why I never saw it happen personally.