AcademyCraft

AcademyCraft

1M Downloads

[1.0.4] Location Teleport client-side crash when first used in a Mystcraft world

OronDF343 opened this issue ยท 1 comments

commented

When entering a new Mystcraft world, the first time Location Teleport is activated the client crashes before the list of locations is displayed. After logging back in, Location Teleport works as expected without crashing.

UPDATE: Same thing happens with RFTools dimensions.

The crash report below is from the client, the world is SMP, and the number 2 refers to the dimension ID of the Mystcraft world.

---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 8/23/16 2:59 PM
Description: Unexpected error

java.util.NoSuchElementException: key not found: 2
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:59)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:59)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.newAdd(LocationTeleport.scala:423)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.cn$academy$vanilla$teleporter$skill$LocationTeleport$Gui$$updateList(LocationTeleport.scala:356)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.(LocationTeleport.scala:287)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$$anon$2.onKeyDown(LocationTeleport.scala:96)
at cn.academy.ability.api.context.ClientRuntime$Events.onClientTick(ClientRuntime.java:299)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_783_Events_onClientTick_ClientTickEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at cpw.mods.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:325)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1587)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:310)
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:395)
at org.multimc.EntryPoint.listen(EntryPoint.java:170)
at org.multimc.EntryPoint.main(EntryPoint.java:54)

A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head --
Stacktrace:
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:59)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:59)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.newAdd(LocationTeleport.scala:423)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.cn$academy$vanilla$teleporter$skill$LocationTeleport$Gui$$updateList(LocationTeleport.scala:356)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$Gui.(LocationTeleport.scala:287)
at cn.academy.vanilla.teleporter.skill.LocationTeleport$$anon$2.onKeyDown(LocationTeleport.scala:96)
at cn.academy.ability.api.context.ClientRuntime$Events.onClientTick(ClientRuntime.java:299)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_783_Events_onClientTick_ClientTickEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at cpw.mods.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:325)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1587)

commented

Thanks, will fix it.

related code:

      val message = {
        val dimID = player.worldObj.provider.dimensionId
        val name = dimensionNameMap(dimID) // line 423

        List(name + s" (#$dimID)", "(%.0f, %.0f, %.0f)".format(player.posX, player.posY, player.posZ))
      }

Where dimensionNameMap is initialized at first query and is not updated when new world is created. This conflicts with Mystcraft's behaviour (adding dimension dynamically). Resolving the name dynamically every time solves this issue.