aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-17 11:14:02 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-17 11:14:02 +1000
commit3f385ab38271f2b950d70a07899f80587835887f (patch)
treeb55dfc08e1bde0d4549f84674c8a05651bac0843 /src/Java/gtPlusPlus/xmod/gregtech/api
parent6073fddf0bf0bf731f5120b4fe028f02dbd3a371 (diff)
downloadGT5-Unofficial-3f385ab38271f2b950d70a07899f80587835887f.tar.gz
GT5-Unofficial-3f385ab38271f2b950d70a07899f80587835887f.tar.bz2
GT5-Unofficial-3f385ab38271f2b950d70a07899f80587835887f.zip
$ Fixed an issue where Multi-block recipe changes affected the actual GT recipes.
% Updated tooltips to reflect time bonuses.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 9f9d4a17af..911ba9a88e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -19,6 +19,7 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.array.Pair;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import net.minecraft.entity.player.EntityPlayer;
@@ -962,6 +963,38 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity {
return tValidOutputHatches;
}
+
+ public GT_Recipe reduceRecipeTimeByPercentage(GT_Recipe tRecipe, float percentage){
+ int cloneTime = 0;
+ GT_Recipe baseRecipe;
+ GT_Recipe cloneRecipe = null;
+
+ baseRecipe = tRecipe.copy();
+ if (cloneRecipe != baseRecipe || cloneRecipe == null){
+ cloneRecipe = baseRecipe.copy();
+ Utils.LOG_WARNING("Setting Recipe");
+ }
+ if (cloneTime != baseRecipe.mDuration || cloneTime == 0){
+ cloneTime = baseRecipe.mDuration;
+ Utils.LOG_WARNING("Setting Time");
+ }
+
+ if (cloneRecipe.mDuration > 0){
+ int originalTime = cloneRecipe.mDuration;
+ int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, (100-percentage));
+ cloneRecipe.mDuration = tempTime;
+ if (cloneRecipe.mDuration < originalTime){
+ return cloneRecipe;
+ }
+ else {
+ return tRecipe;
+ }
+ }
+ return null;
+
+
+
+ }
}