aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-09 08:38:56 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-09 08:38:56 +1000
commit83118f1cf7856996c4c8b520aaed247188acc4ca (patch)
treeeedd5c5e3faf81f82a4f83b0a38ebc972ce9d1be /src
parent756d89d83a237d23c0b372d33c9dd6fcc599eab7 (diff)
downloadGT5-Unofficial-83118f1cf7856996c4c8b520aaed247188acc4ca.tar.gz
GT5-Unofficial-83118f1cf7856996c4c8b520aaed247188acc4ca.tar.bz2
GT5-Unofficial-83118f1cf7856996c4c8b520aaed247188acc4ca.zip
$ Redid multiblock recipe handling again.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java101
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java2
4 files changed, 69 insertions, 38 deletions
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 c436b7ee38..099c295315 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
@@ -19,6 +19,7 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
@@ -117,6 +118,7 @@ extends GregtechMeta_MultiBlockBase {
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);
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 607346346a..5d30bfd91b 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
@@ -18,6 +18,7 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
@@ -123,6 +124,7 @@ 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.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+ tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80);
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 305e9a3a85..443be193be 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
@@ -12,11 +12,13 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -46,6 +48,11 @@ extends GregtechMeta_MultiBlockBase {
public String[] getDescription() {
return new String[]{
"Controller Block for the Industrial Maceration Stack",
+ "Processes material several factors faster than single block macerators",
+ "Has extra chances on bonus outputs",
+ "Processes 8*tier materials at a time",
+ "ULV = Tier 0, LV = Tier 1, etc.",
+ "-------------------------------------------------------",
"Size[WxHxL]: 3x6x3 (Hollow)",
"Controller (Center Bottom)",
"1x Input Bus (Any bottom layer casing)",
@@ -108,7 +115,9 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(final ItemStack aStack) {
-
+ byte tTier = (byte)Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ //int processing = 8*tTier;
+ int processing = 1;
//Get inputs.
final ArrayList<ItemStack> tInputList = this.getStoredInputs();
for (int i = 0; i < (tInputList.size() - 1); i++) {
@@ -131,46 +140,36 @@ extends GregtechMeta_MultiBlockBase {
if (this.mOutputBusses.size() != 5){
return false;
}
-
- //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);
-
-
- final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs);
- Utils.LOG_WARNING("Maceration Stack - Valid Output Hatches: "+tValidOutputSlots);
-
- //More than or one input
- if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
- if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) {
- Utils.LOG_WARNING("Valid Recipe found - size "+tRecipe.mOutputs.length);
- this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
- this.mEfficiencyIncrease = 10000;
-
-
- this.mEUt = (-tRecipe.mEUt);
- this.mMaxProgresstime = Math.max(1, (tRecipe.mDuration/5));
- final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length];
- for (int i = 0; i < tRecipe.mOutputs.length; i++){
- if (i==0) {
- Utils.LOG_WARNING("Adding the default output");
- outputs[0] = tRecipe.getOutput(i);
- }
- else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){
- Utils.LOG_WARNING("Adding a bonus output");
- outputs[i] = tRecipe.getOutput(i);
- }
- else {
- Utils.LOG_WARNING("Adding null output");
- outputs[i] = null;
+ 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);
+
+ final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs);
+ Utils.LOG_WARNING("Maceration Stack - Valid Output Hatches: "+tValidOutputSlots);
+
+ //More than or one input
+ if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
+ if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) {
+ if (processRecipeXTimes(processing, tRecipe)){
+
+ //final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length];
+
+
+
+ //this.mOutputItems = outputs;
+ this.mEfficiency = (10000 - ((getIdealStatus() - getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+
+ this.mEUt = (-4 * (1 << tTier - 1) * (1 << tTier - 1) * tTier / 2);
+ this.mMaxProgresstime = Math.max(1, 256 / (1 << tTier - 1));
}
+ //this.mMaxProgresstime = Math.max(1, (tRecipe.mDuration));
+ this.sendLoopStart((byte) 20);
+ this.updateSlots();
}
-
- this.mOutputItems = outputs;
- this.sendLoopStart((byte) 20);
- this.updateSlots();
- return true;
}
- }
+ }
return false;
}
@@ -261,4 +260,30 @@ extends GregtechMeta_MultiBlockBase {
public boolean isOverclockerUpgradable() {
return true;
}
+
+ private boolean processRecipeXTimes(int times, GT_Recipe tRecipe){
+
+ byte tTier = (byte)Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ int j = 0;
+ this.mOutputItems = new ItemStack[8 * tTier];
+
+ for (int i = 0; (i < 256) && (j < this.mOutputItems.length); ++i) {
+ if (i==0) {
+ Utils.LOG_WARNING("Adding the default output");
+ this.mOutputItems[0] = tRecipe.getOutput(0);
+ Utils.LOG_INFO("Ading output. "+i+" | "+tRecipe.mOutputs.length + " | "+this.mOutputItems[0].stackSize+" | "+tRecipe.getOutput(0).stackSize);
+ }
+ else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){
+ Utils.LOG_WARNING("Adding a bonus output");
+ this.mOutputItems[i] = tRecipe.getOutput(i);
+ }
+ else {
+ Utils.LOG_WARNING("Adding null output");
+ this.mOutputItems[i] = null;
+ }
+ ++j;
+ }
+ updateSlots();
+ return true;
+ }
} \ No newline at end of file
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 68fb3ec10c..a92275a11b 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
@@ -15,6 +15,7 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
@@ -81,6 +82,7 @@ extends GregtechMeta_MultiBlockBase {
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);
if (tRecipe != null) {
final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, new ItemStack[]{tInput});