From 99ebf8e09d19c949af4986fa20459c8f87c455ea Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 10 Jul 2017 00:22:21 +1000 Subject: $ Fixed .09 features trying to work in .08. + Moved lots of things to reflection again. --- .../core/util/gregtech/recipehandlers/GregtechRecipe.java | 14 +------------- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'src/Java/gtPlusPlus/core/util') diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java index 0c98751398..8ba355d57f 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java @@ -71,16 +71,4 @@ class LibProxy2 extends LibraryProxy { throw new RuntimeException(e); } } -} - -/*class Lib { // v1 - public static void addRecipe(ItemStack aInput, ItemStack aOutput) { - System.out.println("shit totally happened v1"); - } -} - -class Lib2 { // v2 - public static void addRecipe(ItemStack aInput, ItemStack aOutput, boolean hidden) { - System.out.println("shit totally happened v2"); - } -}*/ \ No newline at end of file +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 7ed15ec27b..a46bd8c61d 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.util.math; import java.util.Map; import java.util.Random; +import gregtech.api.enums.GT_Values; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.objects.XSTR; @@ -96,7 +97,7 @@ public class MathUtils { } while (((bits-val)+(n-1)) < 0L); return val; } - + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -359,4 +360,12 @@ public class MathUtils { } } + public static int safeInt(long number, int margin){ + return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; + } + + public static int safeInt(long number){ + return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number