aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-16 20:05:12 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-16 20:05:12 +1000
commitee1f3d7352ff479c697ebfa10a4ecfd14acc4c91 (patch)
tree3d518242c2bafb206b82cfdda2d0015d6bf159e3 /src/Java/gtPlusPlus/xmod/gregtech
parentdd884036eb476a301d681d7f9736d51e9b8390ce (diff)
downloadGT5-Unofficial-ee1f3d7352ff479c697ebfa10a4ecfd14acc4c91.tar.gz
GT5-Unofficial-ee1f3d7352ff479c697ebfa10a4ecfd14acc4c91.tar.bz2
GT5-Unofficial-ee1f3d7352ff479c697ebfa10a4ecfd14acc4c91.zip
$ Attempted fix 1 to Wash Plant recipe handling.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java96
1 files changed, 95 insertions, 1 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
index 004af62262..7727b02a16 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -1,6 +1,10 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -10,6 +14,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -27,6 +32,9 @@ import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntity_IndustrialWashPlant
extends GregtechMeta_MultiBlockBase {
+
+ public GT_Recipe mLastRecipe;
+
public GregtechMetaTileEntity_IndustrialWashPlant(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -46,6 +54,9 @@ extends GregtechMeta_MultiBlockBase {
"Controller Block for the Industrial Ore Washing Plant",
"60% faster than using single block machines of the same voltage",
"Size: 7x2x5 [WxHxL] (open)",
+ "X X",
+ "X X",
+ "XXXXX",
"Controller (front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
@@ -79,7 +90,7 @@ extends GregtechMeta_MultiBlockBase {
return aFacing > 1;
}
- @Override
+ /*@Override
public boolean checkRecipe(final ItemStack aStack) {
if (!checkForWater()){
@@ -126,6 +137,89 @@ extends GregtechMeta_MultiBlockBase {
}
}
return false;
+ }*/
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ ArrayList<FluidStack> tFluidInputs = getStoredFluids();
+ Utils.LOG_INFO("1");
+ for (ItemStack tInput : tInputList) {
+ Utils.LOG_INFO("2");
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs.isEmpty() ? null : new FluidStack[]{tFluidInputs.get(0)}, new ItemStack[]{tInput});
+
+ if ((tRecipe == null && !mRunningOnLoad)) {
+ this.mLastRecipe = null;
+ return false;
+ }
+
+ if (tRecipe != null) {
+ Utils.LOG_INFO("3");
+ FluidStack[] mFluidInputList = new FluidStack[tFluidInputs.size()];
+ int tri = 0;
+ for (FluidStack f : tFluidInputs){
+ mFluidInputList[tri] = f;
+ tri++;
+ }
+ if (tRecipe.isRecipeInputEqual(true, mFluidInputList, tInput)) {
+ Utils.LOG_INFO("4");
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ Utils.LOG_INFO("EU/T: "+tRecipe.mEUt);
+ this.mEUt = tRecipe.mEUt;
+ Utils.LOG_INFO("EU/T: "+this.mEUt);
+ if (tRecipe.mEUt <= 16) {
+ Utils.LOG_INFO("4.1");
+ this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
+ } else {
+ Utils.LOG_INFO("4.2");
+ this.mEUt = tRecipe.mEUt;
+ this.mMaxProgresstime = tRecipe.mDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = mMaxProgresstime / 4;
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, mFluidInputList, new ItemStack[]{tInput})) {
+ this.mLastRecipe = tRecipe;
+ this.mEUt = this.mLastRecipe.mEUt;
+ this.mMaxProgresstime = this.mLastRecipe.mDuration;
+ this.mEfficiencyIncrease = 10000;
+ this.addOutput(tRecipe.getOutput(0));
+ this.addOutput(tRecipe.getOutput(1));
+ mRunningOnLoad = false;
+ return true;
+ }
+
+ /*if (tRecipe.mOutputs.length > 0) {
+ //this.mOutputItems = tRecipe.mOutputs.clone();
+ Utils.LOG_INFO("mRuntime: "+this.mRuntime);
+ Utils.LOG_INFO("mProgresstime: "+this.mProgresstime);
+ Utils.LOG_INFO("mEfficiency: "+this.mEfficiency);
+ Utils.LOG_INFO("mEfficiencyIncrease: "+this.mEfficiencyIncrease);
+ Utils.LOG_INFO("mEUt: "+this.mEUt);
+ Utils.LOG_INFO("mMaxProgresstime: "+this.mMaxProgresstime);
+ //Utils.LOG_INFO("mOutputItems: "+this.mOutputItems.length);
+ //Utils.LOG_INFO("tRecipe: "+tRecipe.mOutputs.clone().length);
+ }*/
+
+ updateSlots();
+ Utils.LOG_INFO("return");
+ return true;
+ }
+ }
+ }
+ return false;
}
@Override