From 1b820de08a05070909a267e17f033fcf58ac8710 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 2 Sep 2024 23:17:17 +0200 Subject: The Great Renaming (#3014) * move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names --- .../xmod/gregtech/api/util/GTPPConfig.java | 123 +++++++++++++++++++++ .../xmod/gregtech/api/util/GTPP_Config.java | 123 --------------------- .../api/util/SpecialBehaviourTooltipHandler.java | 4 +- 3 files changed, 125 insertions(+), 125 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPPConfig.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/util') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPPConfig.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPPConfig.java new file mode 100644 index 0000000000..1a32b75bb8 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPPConfig.java @@ -0,0 +1,123 @@ +package gtPlusPlus.xmod.gregtech.api.util; + +import static gregtech.api.enums.GTValues.E; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import gregtech.api.GregTechAPI; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; + +public class GTPPConfig implements Runnable { + + public static boolean troll = false; + + public static Configuration sConfigFileIDs; + public final Configuration mConfig; + + public GTPPConfig(Configuration aConfig) { + mConfig = aConfig; + mConfig.load(); + mConfig.save(); + } + + public static int addIDConfig(Object aCategory, String aName, int aDefault) { + if (GTUtility.isStringInvalid(aName)) return aDefault; + Property tProperty = sConfigFileIDs.get( + aCategory.toString() + .replaceAll("\\|", "."), + aName.replaceAll("\\|", "."), + aDefault); + int rResult = tProperty.getInt(aDefault); + if (!tProperty.wasRead() && GregTechAPI.sPostloadFinished) sConfigFileIDs.save(); + return rResult; + } + + public static String getStackConfigName(ItemStack aStack) { + if (GTUtility.isStackInvalid(aStack)) return E; + Object rName = GTOreDictUnificator.getAssociation(aStack); + if (rName != null) return rName.toString(); + try { + if (GTUtility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); + } catch (Throwable e) { + /* Do nothing */ + } + String sName = aStack.getItem() + .toString(); + String[] tmp = sName.split("@"); + if (tmp.length > 0) sName = tmp[0]; + return sName + "." + aStack.getItemDamage(); + } + + public boolean get(Object aCategory, ItemStack aStack, boolean aDefault) { + String aName = getStackConfigName(aStack); + return get(aCategory, aName, aDefault); + } + + public boolean get(Object aCategory, String aName, boolean aDefault) { + if (GTUtility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); + boolean rResult = tProperty.getBoolean(aDefault); + if (!tProperty.wasRead() && GregTechAPI.sPostloadFinished) mConfig.save(); + return rResult; + } + + public int get(Object aCategory, ItemStack aStack, int aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public int get(Object aCategory, String aName, int aDefault) { + if (GTUtility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); + int rResult = tProperty.getInt(aDefault); + if (!tProperty.wasRead() && GregTechAPI.sPostloadFinished) mConfig.save(); + return rResult; + } + + public double get(Object aCategory, ItemStack aStack, double aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public double get(Object aCategory, String aName, double aDefault) { + if (GTUtility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); + double rResult = tProperty.getDouble(aDefault); + if (!tProperty.wasRead() && GregTechAPI.sPostloadFinished) mConfig.save(); + return rResult; + } + + public String get(Object aCategory, ItemStack aStack, String aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public String get(Object aCategory, String aName, String aDefault) { + if (GTUtility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get( + aCategory.toString() + .replaceAll("\\|", "_"), + (aName + "_" + aDefault).replaceAll("\\|", "_"), + aDefault); + String rResult = tProperty.getString(); + if (!tProperty.wasRead() && GregTechAPI.sPostloadFinished) mConfig.save(); + return rResult; + } + + @Override + public void run() { + mConfig.save(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java deleted file mode 100644 index 65beea207a..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java +++ /dev/null @@ -1,123 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.util; - -import static gregtech.api.enums.GT_Values.E; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; - -public class GTPP_Config implements Runnable { - - public static boolean troll = false; - - public static Configuration sConfigFileIDs; - public final Configuration mConfig; - - public GTPP_Config(Configuration aConfig) { - mConfig = aConfig; - mConfig.load(); - mConfig.save(); - } - - public static int addIDConfig(Object aCategory, String aName, int aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = sConfigFileIDs.get( - aCategory.toString() - .replaceAll("\\|", "."), - aName.replaceAll("\\|", "."), - aDefault); - int rResult = tProperty.getInt(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) sConfigFileIDs.save(); - return rResult; - } - - public static String getStackConfigName(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return E; - Object rName = GT_OreDictUnificator.getAssociation(aStack); - if (rName != null) return rName.toString(); - try { - if (GT_Utility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); - } catch (Throwable e) { - /* Do nothing */ - } - String sName = aStack.getItem() - .toString(); - String[] tmp = sName.split("@"); - if (tmp.length > 0) sName = tmp[0]; - return sName + "." + aStack.getItemDamage(); - } - - public boolean get(Object aCategory, ItemStack aStack, boolean aDefault) { - String aName = getStackConfigName(aStack); - return get(aCategory, aName, aDefault); - } - - public boolean get(Object aCategory, String aName, boolean aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - boolean rResult = tProperty.getBoolean(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public int get(Object aCategory, ItemStack aStack, int aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public int get(Object aCategory, String aName, int aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - int rResult = tProperty.getInt(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public double get(Object aCategory, ItemStack aStack, double aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public double get(Object aCategory, String aName, double aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - double rResult = tProperty.getDouble(aDefault); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - public String get(Object aCategory, ItemStack aStack, String aDefault) { - return get(aCategory, getStackConfigName(aStack), aDefault); - } - - public String get(Object aCategory, String aName, String aDefault) { - if (GT_Utility.isStringInvalid(aName)) return aDefault; - Property tProperty = mConfig.get( - aCategory.toString() - .replaceAll("\\|", "_"), - (aName + "_" + aDefault).replaceAll("\\|", "_"), - aDefault); - String rResult = tProperty.getString(); - if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); - return rResult; - } - - @Override - public void run() { - mConfig.save(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java index df95b7de2b..da6db942aa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java @@ -7,7 +7,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.GTUtility; public class SpecialBehaviourTooltipHandler { @@ -22,7 +22,7 @@ public class SpecialBehaviourTooltipHandler { if (event != null) { if (event.itemStack != null) { for (ItemStack aKey : mTooltipCache.keySet()) { - if (GT_Utility.areStacksEqual(aKey, event.itemStack, false)) { + if (GTUtility.areStacksEqual(aKey, event.itemStack, false)) { String s = mTooltipCache.get(aKey); if (s != null && s.length() > 0) { event.toolTip.add(EnumChatFormatting.RED + s); -- cgit