From 3f385ab38271f2b950d70a07899f80587835887f Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 17 Sep 2017 11:14:02 +1000 Subject: $ Fixed an issue where Multi-block recipe changes affected the actual GT recipes. % Updated tooltips to reflect time bonuses. --- .../base/GregtechMeta_MultiBlockBase.java | 33 ++++++++++++++++++++++ ...regtechMetaTileEntity_IndustrialCentrifuge.java | 5 ++-- ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 5 ++-- ...GregtechMetaTileEntity_IndustrialMacerator.java | 5 ++-- .../GregtechMetaTileEntity_IndustrialWireMill.java | 5 ++-- 5 files changed, 45 insertions(+), 8 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech') 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; + + + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index 099c295315..7a35f63605 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -57,6 +57,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Centrifuge", + "40% faster than using single block machines of the same voltage", "Size: 3x3x3 (Hollow)", "Controller (Front Center) [Orange]", "1x Maintenance Hatch (Rear Center) [Green]", @@ -117,8 +118,8 @@ extends GregtechMeta_MultiBlockBase { final ArrayList tFluidList = this.getStoredFluids(); final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); if ((tInputList.size() > 0) || (tFluids.length > 0)) { - final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); + GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F); if (tRecipe != null) { Utils.LOG_WARNING("Recipe was not invalid"); this.mLastRecipe = tRecipe; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 5d30bfd91b..82f7fc3e78 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -45,6 +45,7 @@ extends GregtechMeta_MultiBlockBase { @Override public String[] getDescription() { return new String[]{"Controller Block for the Industrial Electrolyzer", + "40% faster than using single block machines of the same voltage", "Size: 3x3x3 (Hollow)", "Controller (front centered)", "1x Input Bus (anywhere)", @@ -123,8 +124,8 @@ extends GregtechMeta_MultiBlockBase { if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { final long tVoltage = this.getMaxInputVoltage(); final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 40F); if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java index 443be193be..48d5ee7452 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java @@ -48,6 +48,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Maceration Stack", + "60% faster than using single block machines of the same voltage", "Processes material several factors faster than single block macerators", "Has extra chances on bonus outputs", "Processes 8*tier materials at a time", @@ -142,8 +143,8 @@ extends GregtechMeta_MultiBlockBase { } for (int rx=0;rx