Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
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 {

Expand All @@ -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;
Expand All @@ -117,7 +115,6 @@ public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
setScrollBar(new GuiScrollbar());
xSize = 209;
ySize = 255;
neiPresent = Loader.isModLoaded("NotEnoughItems");

searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {

Expand Down Expand Up @@ -190,7 +187,7 @@ public void initGui() {
itemRender);
craftingStatusBtn.setHideEdge(13);

if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
setSearchString();
}
buttonList.add(terminalStyleBox);
Expand Down Expand Up @@ -251,7 +248,7 @@ public void drawFG(final int offsetX, final int offsetY, final int mouseX, final
ySize - 96 + 3,
GuiColors.InterfaceTerminalInventory.getColor());

if (!neiPresent && tooltipStack != null) {
if (!ModAndClassUtil.NEI && tooltipStack != null) {
renderToolTip(tooltipStack, mouseX, mouseY);
}
}
Expand Down Expand Up @@ -290,7 +287,7 @@ protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
@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;
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/glodblock/github/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ public void postInit(FMLPostInitializationEvent event) {
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);
Expand Down
93 changes: 2 additions & 91 deletions src/main/java/com/glodblock/github/util/ModAndClassUtil.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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");
Expand All @@ -137,11 +48,11 @@ public static void init() {
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;
}
}
5 changes: 1 addition & 4 deletions src/main/java/com/glodblock/github/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@
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) {
Expand Down Expand Up @@ -204,7 +201,7 @@ public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlaye
}
}

if (isBaublesLoaded) {
if (ModAndClassUtil.BAUBLES) {
IInventory handler = BaublesApi.getBaubles(player);
if (handler != null) {
invSize = handler.getSizeInventory();
Expand Down