From a6e9f62a360ecb43eb771e4d0952a0e728cd748d Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 27 May 2018 14:01:51 +1000 Subject: $ Fixed Locale issue. % Made Large Eggs turn into Spawn eggs for large chickens. --- src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Java/gtPlusPlus/core/util') diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 43fc6d3cc4..9682c673b6 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -755,6 +755,13 @@ public class ItemUtils { } String mCacheKey = block.getUnlocalizedName()+":"+meta; if (mLocaleCache.containsKey(mCacheKey)) { + //Recache the key if it's invalid. + if (mLocaleCache.get(mCacheKey).toLowerCase().contains(".name")) { + mLocaleCache.remove(mCacheKey); + String mNew = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName(); + Logger.INFO("Re-caching "+mNew+" into locale cache."); + mLocaleCache.put(mCacheKey, mNew); + } return mLocaleCache.get(mCacheKey); } else { @@ -763,7 +770,10 @@ public class ItemUtils { return "Bad Item"; } String unlocalizedName = item.getUnlocalizedName(new ItemStack(block, 1, meta)); - String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); + String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); + if (blockName.toLowerCase().contains(".name")) { + blockName = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName(); + } mLocaleCache.put(mCacheKey, blockName); return blockName; } -- cgit