diff --git a/doc/changelog.html b/doc/changelog.html index e1735ad..c2620d2 100644 --- a/doc/changelog.html +++ b/doc/changelog.html @@ -25,4 +25,5 @@

JourneyMap ${version} for Minecraft ${mcversion}

diff --git a/src/main/java/journeymap/client/JourneymapClient.java b/src/main/java/journeymap/client/JourneymapClient.java index 01261fa..9b07060 100644 --- a/src/main/java/journeymap/client/JourneymapClient.java +++ b/src/main/java/journeymap/client/JourneymapClient.java @@ -14,6 +14,7 @@ import journeymap.client.cartography.ColorManager; import journeymap.client.data.DataCache; import journeymap.client.data.WaypointsData; +import journeymap.client.data.WorldData; import journeymap.client.feature.FeatureManager; import journeymap.client.forge.event.EventHandlerManager; import journeymap.client.forge.helper.ForgeHelper; @@ -494,6 +495,7 @@ private void reset() WorldInfoHandler.requestWorldID(); } + WorldData.dimNames.clear(); loadConfigProperties(); DataCache.instance().purge(); chunkRenderController = new ChunkRenderController(); diff --git a/src/main/java/journeymap/client/data/WorldData.java b/src/main/java/journeymap/client/data/WorldData.java index 38f72f1..70f865e 100644 --- a/src/main/java/journeymap/client/data/WorldData.java +++ b/src/main/java/journeymap/client/data/WorldData.java @@ -8,6 +8,8 @@ import com.google.common.base.Strings; import com.google.common.cache.CacheLoader; import cpw.mods.fml.client.FMLClientHandler; +import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; import journeymap.client.Constants; import journeymap.client.JourneymapClient; import journeymap.client.feature.Feature; @@ -19,6 +21,7 @@ import journeymap.common.Journeymap; import journeymap.common.version.VersionCheck; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.network.NetworkManager; import net.minecraft.server.integrated.IntegratedServer; import net.minecraft.world.WorldProvider; @@ -31,7 +34,14 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.URLEncoder; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; // 1.8 //import net.minecraftforge.fml.client.FMLClientHandler; @@ -58,6 +68,8 @@ public class WorldData extends CacheLoader String[] iconSetNames; int browser_poll; + public static TIntObjectMap dimNames; + /** * Constructor. */ @@ -65,6 +77,14 @@ public WorldData() { } + static + { + dimNames = new TIntObjectHashMap<>(); + ((IReloadableResourceManager) Minecraft.getMinecraft() + .getResourceManager()) + .registerReloadListener(iResourceManager -> dimNames.clear()); + } + public static boolean isHardcoreAndMultiplayer() { WorldData world = DataCache.instance().getWorld(false); @@ -285,11 +305,16 @@ public static String getSafeDimensionName(WorldProvider worldProvider) try { - String langKey = String.format("jm.common.dimension.%1$d.name", worldProvider.dimensionId); - String dimName = Constants.getString(langKey); - if (langKey.equals(dimName)) + String dimName = dimNames.get(worldProvider.dimensionId); + if (dimName == null) { - dimName = worldProvider.getDimensionName(); + String langKey = String.format("jm.common.dimension.%1$d.name", worldProvider.dimensionId); + dimName = Constants.getString(langKey); + if (langKey.equals(dimName)) + { + dimName = worldProvider.getDimensionName(); + } + dimNames.put(worldProvider.dimensionId, dimName); } return dimName;