From acf7193504fba4a7165d2ba5732cc9ce5f35ec55 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sat, 4 Apr 2020 16:57:56 +0100 Subject: + Added a new base bus type. + Added the Ball Housing bus. + Added the Catalyst Housing bus. + Added the Reinforced Engine Casing. + Made the Flotation Cell Regulator actually load. $ Fixed Tooltips on Milling Balls & Catalysts. $ Added improved item handling for Milling Balls. $ Added improved item handling for Catalysts. --- src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java | 9 +++++---- .../gtPlusPlus/core/util/reflect/ReflectionUtils.java | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/Java/gtPlusPlus/core/util') diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 3e536ec8d0..3cb2d4cec3 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -1243,10 +1243,11 @@ public class ItemUtils { public static ItemStack depleteStack(ItemStack aStack, int aAmount) { final int cap = aStack.stackSize; - if (cap > 1 && cap > aAmount) { - aStack.stackSize = (MathUtils.balance((aStack.stackSize - 1), 0, 64)); - if (aStack.stackSize > 0) { - return aStack; + if (cap >= 1 && cap >= aAmount) { + ItemStack aDepStack = aStack.copy(); + aDepStack.stackSize = (MathUtils.balance((aDepStack.stackSize - 1), 0, 64)); + if (aDepStack.stackSize > 0) { + return aDepStack; } } return getNullStack(); diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index e45d27b926..59d20835ae 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -22,6 +22,7 @@ import com.google.common.reflect.ClassPath; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.data.StringUtils; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; public class ReflectionUtils { @@ -1035,5 +1036,19 @@ public class ReflectionUtils { return null; } + public static T createNewInstanceFromConstructor(Constructor aConstructor, Object[] aArgs) { + T aInstance; + try { + aInstance = (T) aConstructor.newInstance(aArgs); + if (aInstance != null) { + return aInstance; + } + } + catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + return null; + } + } -- cgit