Java lang illegalargumentexception at java util random nextint

(RESOLVED) Game is crashing: java.lang.IllegalArgumentException: bound must be positive

As the title states, I’m running into a very annoying issue. The game keeps crashing and this seems to be the main error that’s shown up the past five times it’s crashed:

---- Minecraft Crash Report ---- // Shall we play a game? Time: 11/3/20 5:08 AM Description: Exception ticking world java.lang.IllegalArgumentException: bound must be positive at java.util.Random.nextInt(Random.java:388) ~[?:1.8.0_252] <> at net.minecraft.world.spawner.WorldEntitySpawner.spawnEntitiesInChunk(WorldEntitySpawner.java:95) ~[. ] at net.minecraft.world.server.ServerChunkProvider.lambda$tickChunks$5(ServerChunkProvider.java:372) ~[. ] at it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap$1.forEach(Long2ObjectLinkedOpenHashMap.java:1661) ~[fastutil-8.2.1.jar:?] <> at com.google.common.collect.Iterables$UnmodifiableIterable.forEach(Iterables.java:105) ~[guava-21.0.jar:?] <> at net.minecraft.world.server.ServerChunkProvider.tickChunks(ServerChunkProvider.java:355) ~[. ] at net.minecraft.world.server.ServerChunkProvider.tick(ServerChunkProvider.java:331) ~[. ] at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:316) ~[. ] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) ~[. ] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[. ] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[. ] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) [. ] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252] <> A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at java.util.Random.nextInt(Random.java:388) at net.minecraft.world.spawner.WorldEntitySpawner.spawnEntitiesInChunk(WorldEntitySpawner.java:95) at net.minecraft.world.server.ServerChunkProvider.lambda$tickChunks$5(ServerChunkProvider.java:372) at it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap$1.forEach(Long2ObjectLinkedOpenHashMap.java:1661) at com.google.common.collect.Iterables$UnmodifiableIterable.forEach(Iterables.java:105) at net.minecraft.world.server.ServerChunkProvider.tickChunks(ServerChunkProvider.java:355) at net.minecraft.world.server.ServerChunkProvider.tick(ServerChunkProvider.java:331) at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:316) -- Affected level -- Details: All players: 1 total; [ServerPlayerEntity['Dev'/155, l='Voidlands', x=-39.25, y=95.87, z=-56.17]] Chunk stats: ServerChunkCache: 1089 Level dimension: DimensionType Derived: true Level name: Voidlands Level seed: 2600708484192271368 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: <> Level spawn location: World: (55,63,46), Chunk: (at 7,3,14 in 3,2; contains blocks 48,0,32 to 63,255,47), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 1284 game time, 1284 day time Known server brands: forge Level was modded: true Level storage version: 0x04ABD - Anvil Level weather: Rain time: 43996 (now: false), thunder time: 37183 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) at java.lang.Thread.run(Thread.java:748)

I really wish I understood what exactly was going on or why it was even crashing in the first place. At first I thought it was something to do with the new mob I added, but after disabling its spawning entirely, it’s still crashing. All I’m trying to do is get one of my other mobs to actually spawn :\

Читайте также:  Link web font css

I would also like to add that both of the mobs I’ve added to my workspace were made for 1.15.2 in Blockbench, the same version the mod was made for, so I’m honestly confused.

Источник

IllegalArgumentException: граница должна быть положительной

Я получаю сообщение о том, что моя оценка должна быть положительной. Вот строка, в которой я ее использую:

inv.setItem(i, items.get(r.nextInt(items.size()))); 

Насколько я знаю, он исходит из той части, где я запрашиваю случайное целое из списка элементов. Вот как я определил список:

List items = getAllItems(level); 
public List getAllItems(int level) < Listitems = new ArrayList(); for (String item : settings.getChests().getStringList("chestitems." + level)) < ItemStack toAdd = parseItem(item); items.add(toAdd); >return items; > 
[19:03:53 ERROR]: Error occurred while enabling KitPvP v0.5 (Is it up to date?) java.lang.IllegalArgumentException: bound must be positive at java.util.Random.nextInt(Unknown Source) ~[?:1.8.0_51] at me.iamguus.gamegetsiepunt.kitpvp.chests.ChestsUtil.randomlyFillInv(ChestsUtil.java:101) ~[. ] at me.iamguus.gamegetsiepunt.kitpvp.Main.onEnable(Main.java:40) ~[. ] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:356) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:316) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:746) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.Bukkit.reload(Bukkit.java:534) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:646) [spigot.jar:git-Spigot-5818108-a486600] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:632) [spigot.jar:git-Spigot-5818108-a486600] at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:405) [spigot.jar:git-Spigot-5818108-a486600] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:369) [spigot.jar:git-Spigot-5818108-a486600] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [spigot.jar:git-Spigot-5818108-a486600] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [spigot.jar:git-Spigot-5818108-a486600] at java.lang.Thread.run(Unknown Source) [?:1.8.0_51] 

Источник

Оцените статью