diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-09-17 11:14:02 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-09-17 11:14:02 +1000 |
commit | 3f385ab38271f2b950d70a07899f80587835887f (patch) | |
tree | b55dfc08e1bde0d4549f84674c8a05651bac0843 /src/Java/gtPlusPlus/xmod | |
parent | 6073fddf0bf0bf731f5120b4fe028f02dbd3a371 (diff) | |
download | GT5-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')
5 files changed, 45 insertions, 8 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; + + + + } } 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<FluidStack> 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<processing;rx++){ //Make a recipe instance for the rest of the method. - final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); - tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 60); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F); final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs); Utils.LOG_WARNING("Maceration Stack - Valid Output Hatches: "+tValidOutputSlots); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java index a92275a11b..50dbed4fb9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java @@ -41,6 +41,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Wire Factory", + "60% faster than using single block machines of the same voltage", "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", "2x Output Bus (side centered)", @@ -81,8 +82,8 @@ extends GregtechMeta_MultiBlockBase { 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.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); - tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + tRecipe = this.reduceRecipeTimeByPercentage(tRecipe, 60F); if (tRecipe != null) { final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, new ItemStack[]{tInput}); |