mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
more careful ae2 check and obs field check
This commit is contained in:
1 parent
170e8c4a3b
commit
39b089805c
6 files changed
+76
-18
No files matched your search
@@ -35,6 +35,7 @@ import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.network.CPacketSetTargetItem;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -161,7 +162,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
}
|
||||
else if( btn == this.searchStringSave )
|
||||
else if( ModAndClassUtil.isSaveText && btn == this.searchStringSave )
|
||||
{
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
}
|
||||
@@ -271,8 +272,10 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE ) ) );
|
||||
offset += 20;
|
||||
|
||||
this.buttonList.add( this.searchStringSave = new GuiImgButton( this.guiLeft - 18, offset, Settings.SAVE_SEARCH, AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO ) );
|
||||
offset += 20;
|
||||
if (ModAndClassUtil.isSaveText) {
|
||||
this.buttonList.add( this.searchStringSave = new GuiImgButton( this.guiLeft - 18, offset, Settings.SAVE_SEARCH, AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO ) );
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
offset += 20;
|
||||
@@ -282,11 +285,12 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.searchField.setMaxStringLength( 25 );
|
||||
this.searchField.setTextColor( 0xFFFFFF );
|
||||
this.searchField.setVisible( true );
|
||||
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
|
||||
if (ModAndClassUtil.isSearchStringTooltip)
|
||||
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
|
||||
|
||||
if( this.viewCell)
|
||||
{
|
||||
if (AEConfig.instance.getConfigManager().getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
|
||||
if (ModAndClassUtil.isCraftStatus && AEConfig.instance.getConfigManager().getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
|
||||
this.buttonList.add(this.craftingStatusImgBtn = new GuiImgButton(this.guiLeft - 18, offset, Settings.CRAFTING_STATUS, AEConfig.instance.settings.getSetting(Settings.CRAFTING_STATUS)));
|
||||
} else {
|
||||
this.buttonList.add(this.craftingStatusBtn = new GuiTabButton(this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), itemRender));
|
||||
@@ -298,7 +302,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
final Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
|
||||
|
||||
if (AEConfig.instance.preserveSearchBar || this.isSubGui())
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui()))
|
||||
{
|
||||
setSearchString(memoryText, false);
|
||||
}
|
||||
@@ -740,7 +744,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn ) {
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
if (AEConfig.instance.preserveSearchBar && searchField != null)
|
||||
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||
}
|
||||
public boolean isOverSearchField(int x, int y)
|
||||
|
||||
@@ -22,7 +22,7 @@ public class BlockFluidPacketDecoder extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BlockFluidPatternEncoder extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -36,9 +37,9 @@ public class Ae2Reflect {
|
||||
|
||||
static {
|
||||
try {
|
||||
fInventory_container = reflectField(InventoryCrafting.class, "eventHandler");
|
||||
fInventory_width = reflectField(InventoryCrafting.class, "inventoryWidth");
|
||||
fInventory_stackList = reflectField(InventoryCrafting.class, "stackList");
|
||||
fInventory_container = reflectField(InventoryCrafting.class, "eventHandler", "field_70465_c", "c");
|
||||
fInventory_width = reflectField(InventoryCrafting.class, "inventoryWidth", "field_70464_b", "b");
|
||||
fInventory_stackList = reflectField(InventoryCrafting.class, "stackList", "field_70466_a", "a");
|
||||
fAEContainer_upgradeable = reflectField(ContainerUpgradeable.class, "upgradeable");
|
||||
mItemSlot_setExtractable = reflectMethod(ItemSlot.class, "setExtractable", boolean.class);
|
||||
mTracker_isBusy = reflectMethod(MultiCraftingTracker.class, "isBusy", int.class);
|
||||
@@ -54,8 +55,17 @@ public class Ae2Reflect {
|
||||
return m;
|
||||
}
|
||||
|
||||
public static Field reflectField(Class<?> owner, String name) throws NoSuchFieldException {
|
||||
Field f = owner.getDeclaredField(name);
|
||||
public static Field reflectField(Class<?> owner, String ...names) throws NoSuchFieldException {
|
||||
Field f = null;
|
||||
for (String name : names) {
|
||||
try {
|
||||
f = owner.getDeclaredField(name);
|
||||
if (f != null) break;
|
||||
}
|
||||
catch (NoSuchFieldException ignore) {
|
||||
}
|
||||
}
|
||||
if (f == null) throw new NoSuchFieldException("Can't find field from " + Arrays.toString(names));
|
||||
f.setAccessible(true);
|
||||
return f;
|
||||
}
|
||||
@@ -144,8 +154,8 @@ public class Ae2Reflect {
|
||||
fGuiMEMonitorable_configSrc = Ae2Reflect.reflectField(GuiFCBaseMonitor.class, "configSrc");
|
||||
fGuiMEMonitorable_craftingStatusBtn = Ae2Reflect.reflectField(GuiFCBaseMonitor.class, "craftingStatusBtn");
|
||||
fGuiCPUStatus_icon = Ae2Reflect.reflectField(GuiCraftingStatus.class, "myIcon");
|
||||
fGuiContainer_guiLeft = Ae2Reflect.reflectField(GuiContainer.class, "guiLeft");
|
||||
fGuiContainer_guiTop = Ae2Reflect.reflectField(GuiContainer.class, "guiTop");
|
||||
fGuiContainer_guiLeft = Ae2Reflect.reflectField(GuiContainer.class, "guiLeft", "field_147003_i", "i");
|
||||
fGuiContainer_guiTop = Ae2Reflect.reflectField(GuiContainer.class, "guiTop", "field_147009_r", "r");
|
||||
fCPU_cpu = Ae2Reflect.reflectField(CraftingCPURecord.class, "cpu");
|
||||
fCPU_myName = Ae2Reflect.reflectField(CraftingCPURecord.class, "myName");
|
||||
fCPU_processors = Ae2Reflect.reflectField(CraftingCPURecord.class, "processors");
|
||||
|
||||
@@ -1,23 +1,66 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public final class ModAndClassUtil {
|
||||
|
||||
public static boolean GT5 = false;
|
||||
public static boolean GT6 = false;
|
||||
|
||||
public static boolean isDoubleButton;
|
||||
public static boolean isSaveText;
|
||||
public static boolean isSearchStringTooltip;
|
||||
public static boolean isCraftStatus;
|
||||
public static boolean isSearchBar;
|
||||
|
||||
public static void init() {
|
||||
|
||||
try {
|
||||
ActionItems x = ActionItems.DOUBLE;
|
||||
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 (Exception e) {
|
||||
} catch (NoSuchFieldException e) {
|
||||
isDoubleButton = 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;
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi"))
|
||||
GT5 = true;
|
||||
if (Loader.isModLoaded("gregapi") && Loader.isModLoaded("gregapi_post"))
|
||||
|
||||
Reference in new issue
Block a user