diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-11-24 16:14:12 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-11-24 16:14:12 +0000 |
commit | f3a698a3af1826ef6f5ac719d31334b930e0005e (patch) | |
tree | 5964a9e90c6c3bd3fd71a3e65a48d3ff3f9277e9 /src/Java/gtPlusPlus/core/util | |
parent | 9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff) | |
download | GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.gz GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.bz2 GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.zip |
+ Added Concurrent Set objects to the API.
+ Added Flexible Pair objects to the API.
+ Added logging to ICO formation code.
% Adjusted position of GUI elements in NEI for Chemical Plant recipes.
% Adjusted the recipe for the Lava Filter.
% Adjusted which fluids are returned when requesting tiered fluids from CI. This will inevitably adjust many recipes as a result.
% Adjusted handling of the creative energy buffer.
% Adjusted Achievement handler for Dev Mode.
% Adjusted Tank Capacity on my Chemical Plants.
$ Fixed Output buffer checks on multiblocks, Closes #574.
$ Fixed LuV Super Bus recipes, Closes #575. (ULV super bus recipe is still broken for the time being)
$ Attempted once more to fix Hot Water localization.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java | 9 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java | 51 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 88fdda555c..cb490203df 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -47,6 +47,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -1083,6 +1084,14 @@ public class ItemUtils { } + + public static String getFluidName(FluidStack aFluid) { + return aFluid != null ? aFluid.getFluid().getLocalizedName(aFluid) : "NULL"; + } + + public static String getFluidName(Fluid aFluid) { + return aFluid != null ? aFluid.getLocalizedName() : "NULL"; + } public static String getItemName(ItemStack aStack) { if (aStack == null) { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java new file mode 100644 index 0000000000..1de4209bf9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -0,0 +1,51 @@ +package gtPlusPlus.core.util.minecraft; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class LangUtils { + + + public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){ + return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue); + } + + @SuppressWarnings("unchecked") + public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){ + LanguageRegistry aInstance = LanguageRegistry.instance(); + Field aModLanguageData = ReflectionUtils.getField(LanguageRegistry.class, "modLanguageData"); + if (aModLanguageData != null){ + Map<String,Properties> aProps = new HashMap<String, Properties>(); + Object aInstanceProps; + try { + aInstanceProps = aModLanguageData.get(aInstance); + if (aInstanceProps != null){ + aProps = (Map<String, Properties>) aInstanceProps; + Properties aLangProps = aProps.get(aLang); + if (aLangProps != null){ + if (aLangProps.containsKey(aKey)) { + aLangProps.remove(aKey); + aLangProps.put(aKey, aNewValue); + } + else { + aLangProps.put(aKey, aNewValue); + } + aProps.remove(aLang); + aProps.put(aLang, aLangProps); + ReflectionUtils.setField(aInstance, aModLanguageData, aProps); + } + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + + } + } + return false; + } + +} |