arpruss / raspberryjammod

Raspberry Jam Mod - a Mod Forge Minecraft mod implementing most of Raspberry Juice/Pi API
http://www.instructables.com/id/Python-coding-for-Minecraft/
Other
355 stars 95 forks source link

ArrayIndexOutOfBoundsException: 0. In Location.getWorldByEncodedAltitude #43

Open xuetaolu opened 5 years ago

xuetaolu commented 5 years ago

While using mc.entity.spawnEntity("falling_block", ... ) frequently, like spawn 5 to 10 times per game tick, that is 40 to 200 times per second. It may occur java.lang.ArrayIndexOutOfBoundsException: 0.

[11:08:36] [Thread-24/INFO] [STDOUT]: [mobi.omegacentauri.raspberryjammod.APIHandler:rename111:909]: Searching for FallingSand [11:08:36] [Thread-24/INFO] [STDOUT]: [mobi.omegacentauri.raspberryjammod.APIHandler:rename111:913]: found minecraft:falling_block [11:08:36] [Thread-24/INFO] [STDOUT]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:515]: java.lang.ArrayIndexOutOfBoundsException: 0 [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: java.lang.ArrayIndexOutOfBoundsException: 0 [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.Location.getWorldByEncodedAltitude(Location.java:26) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.Location.decodeVec3w(Location.java:72) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIHandler.spawnEntity(APIHandler.java:932) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIHandler.runCommand(APIHandler.java:779) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIHandler.process(APIHandler.java:504) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIServer.socketCommunicate(APIServer.java:146) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIServer.access$000(APIServer.java:41) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at mobi.omegacentauri.raspberryjammod.APIServer$1.run(APIServer.java:113) [11:08:36] [Thread-24/INFO] [STDERR]: [mobi.omegacentauri.raspberryjammod.APIHandler:process:516]: at java.lang.Thread.run(Unknown Source) [11:08:36] [Server thread/INFO] [FML]: Applying holder lookups [11:08:36] [Server thread/INFO] [FML]: Holder lookups applied [11:08:36] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [11:08:36] [main/INFO] [FML]: Server terminated. [11:08:36] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server [11:08:36] [Client Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players

Maybe, if the game lag due to using spawnEntity command frequently, the length of var serverWorlds will be 0, in Location.getWorldByEncodedAltitude.