mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
remove reflection in ModAndClassUtil (#406)
This commit is contained in:
1 parent
a7fdb3ce7e
commit
d97285ba52
4 files changed
+9
-106
No files matched your search
@@ -73,7 +73,6 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
|
||||
|
||||
@@ -94,7 +93,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
private ItemStack tooltipStack;
|
||||
private boolean online;
|
||||
private final boolean neiPresent;
|
||||
private int viewHeight;
|
||||
|
||||
protected GuiTabButton craftingStatusBtn;
|
||||
@@ -117,7 +115,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
setScrollBar(new GuiScrollbar());
|
||||
xSize = 209;
|
||||
ySize = 255;
|
||||
neiPresent = Loader.isModLoaded("NotEnoughItems");
|
||||
|
||||
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
|
||||
|
||||
@@ -190,7 +187,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
itemRender);
|
||||
craftingStatusBtn.setHideEdge(13);
|
||||
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
|
||||
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
|
||||
setSearchString();
|
||||
}
|
||||
buttonList.add(terminalStyleBox);
|
||||
@@ -251,7 +248,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
ySize - 96 + 3,
|
||||
GuiColors.InterfaceTerminalInventory.getColor());
|
||||
|
||||
if (!neiPresent && tooltipStack != null) {
|
||||
if (!ModAndClassUtil.NEI && tooltipStack != null) {
|
||||
renderToolTip(tooltipStack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -290,7 +287,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (ModAndClassUtil.isSaveText && btn == searchStringSave) {
|
||||
if (btn == searchStringSave) {
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
|
||||
@@ -94,11 +94,9 @@ public class CommonProxy {
|
||||
if (ModAndClassUtil.ThE) {
|
||||
ThaumicEnergisticsCrafting.postInit();
|
||||
}
|
||||
if (ModAndClassUtil.isBigInterface) {
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 3);
|
||||
}
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 3);
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1);
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public final class ModAndClassUtil {
|
||||
@@ -29,97 +21,16 @@ public final class ModAndClassUtil {
|
||||
public static boolean WCT = false;
|
||||
public static boolean IC2 = false;
|
||||
public static boolean NEI = false;
|
||||
public static boolean COFH = false;
|
||||
public static boolean GTPP = false;
|
||||
public static boolean WAILA = false;
|
||||
public static boolean WAILA_PLUGINS = false;
|
||||
public static boolean AVARITIA = false;
|
||||
public static boolean NEW_HORIZONS_CORE_MOD = false;
|
||||
|
||||
public static boolean isV2;
|
||||
public static boolean isDoubleButton;
|
||||
public static boolean isSaveText;
|
||||
public static boolean isSearchStringTooltip;
|
||||
public static boolean isCraftStatus;
|
||||
public static boolean isSearchBar;
|
||||
public static boolean isShiftTooltip;
|
||||
public static boolean isBigInterface;
|
||||
|
||||
public static boolean isBeSubstitutionsButton;
|
||||
public static boolean BAUBLES = false;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public static void init() {
|
||||
|
||||
try {
|
||||
Field d = Upgrades.class.getDeclaredField("PATTERN_CAPACITY");
|
||||
if (d == null) isBigInterface = false;
|
||||
isBigInterface = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isBigInterface = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = GuiText.class.getDeclaredField("HoldShiftForTooltip");
|
||||
if (d == null) isShiftTooltip = false;
|
||||
isShiftTooltip = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isShiftTooltip = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = AEConfig.instance.getClass().getDeclaredField("preserveSearchBar");
|
||||
if (d == null) isSearchBar = false;
|
||||
isSearchBar = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isSearchBar = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = ActionItems.class.getDeclaredField("DOUBLE");
|
||||
if (d == null) isDoubleButton = false;
|
||||
isDoubleButton = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isDoubleButton = false;
|
||||
}
|
||||
try {
|
||||
Field d = ButtonToolTips.class.getDeclaredField("BeSubstitutionsDescEnabled");
|
||||
isBeSubstitutionsButton = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isBeSubstitutionsButton = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = Settings.class.getDeclaredField("SAVE_SEARCH");
|
||||
if (d == null) isSaveText = false;
|
||||
isSaveText = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isSaveText = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = ButtonToolTips.class.getDeclaredField("SearchStringTooltip");
|
||||
if (d == null) isSearchStringTooltip = false;
|
||||
isSearchStringTooltip = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isSearchStringTooltip = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = Settings.class.getDeclaredField("CRAFTING_STATUS");
|
||||
if (d == null) isCraftStatus = false;
|
||||
isCraftStatus = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isCraftStatus = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Class<?> calculatorV2 = Class.forName("appeng.crafting.v2.CraftingCalculations");
|
||||
if (calculatorV2 == null) isV2 = false;
|
||||
isV2 = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
isV2 = false;
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) {
|
||||
try {
|
||||
Class.forName("gregtech.api.recipe.RecipeMap");
|
||||
@@ -137,11 +48,11 @@ public final class ModAndClassUtil {
|
||||
if (Loader.isModLoaded("ae2wct")) WCT = true;
|
||||
if (Loader.isModLoaded("IC2")) IC2 = true;
|
||||
if (Loader.isModLoaded("NotEnoughItems")) NEI = true;
|
||||
if (Loader.isModLoaded("CoFHCore")) COFH = true;
|
||||
if (Loader.isModLoaded("miscutils")) GTPP = true;
|
||||
if (Loader.isModLoaded("Waila")) WAILA = true;
|
||||
if (Loader.isModLoaded("wailaplugins")) WAILA_PLUGINS = true;
|
||||
if (Loader.isModLoaded("Avaritia")) AVARITIA = true;
|
||||
if (Loader.isModLoaded("dreamcraft")) NEW_HORIZONS_CORE_MOD = true;
|
||||
if (Loader.isModLoaded("Baubles")) BAUBLES = true;
|
||||
}
|
||||
}
|
||||
@@ -61,15 +61,12 @@ import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import baubles.api.BaublesApi;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public final class Util {
|
||||
|
||||
public static boolean isBaublesLoaded = Loader.isModLoaded("Baubles");
|
||||
|
||||
public static int drainItemPower(AEBaseContainer c, InventoryPlayer ip, int slot, int ticks, double pm,
|
||||
IFluidPortableCell wt) {
|
||||
if (slot != -1) {
|
||||
@@ -204,7 +201,7 @@ public final class Util {
|
||||
}
|
||||
}
|
||||
|
||||
if (isBaublesLoaded) {
|
||||
if (ModAndClassUtil.BAUBLES) {
|
||||
IInventory handler = BaublesApi.getBaubles(player);
|
||||
if (handler != null) {
|
||||
invSize = handler.getSizeInventory();
|
||||
|
||||
Reference in new issue
Block a user