diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
4 files changed, 43 insertions, 13 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 1d4ebaaa0c..a274ccd378 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -106,7 +106,7 @@ public class COMPAT_HANDLER { //GregtechMiniRaFusion.run(); GregtechComponentAssembler.run(); GregtechTeslaTower.run(); - GregtechSuperTanks.run(); + GregtechSuperChests.run(); GregtechIndustrialFishPond.run(); GregtechTieredChunkloaders.run(); GregtechIndustrialExtruder.run(); @@ -116,6 +116,7 @@ public class COMPAT_HANDLER { GregtechAmazonWarehouse.run(); GregtechIndustrialCryogenicFreezer.run(); GregtechThaumcraftDevices.run(); + GregtechThreadedBuffers.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java index 0c752c20e0..52316c8a43 100644 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -8,13 +8,13 @@ import gtPlusPlus.api.objects.data.AutoMap; public class ArrayUtils { - public static Object[] expandArray(final Object[] someArray, final Object newValueToAdd) { - Object[] series = someArray; + public static <V> V[] expandArray(final V[] someArray, final V newValueToAdd) { + V[] series = someArray; series = addElement(series, newValueToAdd); return series; } - private static Object[] addElement(Object[] series, final Object newValueToAdd) { + private static <V> V[] addElement(V[] series, final V newValueToAdd) { series = Arrays.copyOf(series, series.length + 1); series[series.length - 1] = newValueToAdd; return series; diff --git a/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java b/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java index ba834e345e..ea87677ee2 100644 --- a/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java +++ b/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java @@ -7,17 +7,33 @@ import net.minecraft.client.Minecraft; public class KeyboardUtils { public static boolean isCtrlKeyDown(){ - // prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the OPTION key on Mac) - boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); - if (!isCtrlKeyDown && Minecraft.isRunningOnMac) - isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA); - - return isCtrlKeyDown; + try { + if (!Keyboard.isCreated()) { + return false; + } + // prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the OPTION key on Mac) + boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); + if (!isCtrlKeyDown && Minecraft.isRunningOnMac) + isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA); + + return isCtrlKeyDown; + } + catch (Throwable t) { + return false; + } } public static boolean isShiftKeyDown(){ - return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - + try { + if (!Keyboard.isCreated()) { + return false; + } + return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + } + catch (Throwable t) { + return false; + } + } - + } diff --git a/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java b/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java index efcfaf8d04..2788ba688e 100644 --- a/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java +++ b/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java @@ -14,6 +14,19 @@ public class SystemUtils { } } + /** + * Try invoke the runtime's Garbage Collector. + */ + public static void invokeGC() { + try { + Runtime r = Runtime.getRuntime(); + r.gc(); + } + catch (Throwable t) { + //Do nothing. + } + } + public static boolean isWindows() { return (getOSString().indexOf("win") >= 0); } |