aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWashPlant.java143
1 files changed, 111 insertions, 32 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 a0f244ade3..b1da555095 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;
@@ -50,7 +54,6 @@ extends GregtechMeta_MultiBlockBase {
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
"1x Maintenance Hatch (Any casing)",
- "1x Muffler Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
CORE.GT_Tooltip
@@ -84,46 +87,122 @@ extends GregtechMeta_MultiBlockBase {
public boolean checkRecipe(final ItemStack aStack) {
if (!checkForWater()){
+ Utils.LOG_INFO("Did not find enough cleaning solution.");
return false;
}
-
final ArrayList<ItemStack> tInputList = this.getStoredInputs();
- for (final ItemStack tInput : tInputList) {
+ for (int i = 0; i < (tInputList.size() - 1); i++) {
+ for (int j = i + 1; j < tInputList.size(); j++) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ } else {
+ tInputList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
+
+ final ArrayList<FluidStack> tFluidList = this.getStoredFluids();
+ for (int i = 0; i < (tFluidList.size() - 1); i++) {
+ for (int j = i + 1; j < tFluidList.size(); j++) {
+ if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ } else {
+ tFluidList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+ final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
+
+ Utils.LOG_INFO("0");
+ final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[(byte) Math.max(1, GT_Utility.getTier(this.getMaxInputVoltage()))], tFluids, tInputs), tInputs);
+ Utils.LOG_INFO("Valid Output Slots: "+tValidOutputSlots);
+
+ //More than or one input
+ if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
+ Utils.LOG_INFO("1");
final long tVoltage = this.getMaxInputVoltage();
final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.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;
+ if (tRecipe.mEUt <= 16) {
+ this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
+ this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
+ } else {
+ 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 = Math.max(1, this.mMaxProgresstime);
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.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});
- Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots);
- //More than or one input
- if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
-
- if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) {
- this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
- this.mEfficiencyIncrease = 10000;
- if (tRecipe.mEUt <= 16) {
- this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1)));
- this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1)));
- } else {
- 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;
+ ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ tOut[h] = tRecipe.getOutput(h).copy();
+ tOut[h].stackSize = 0;
+ }
+ FluidStack tFOut = null;
+ if (tRecipe.getFluidOutput(0) != null) {
+ tFOut = tRecipe.getFluidOutput(0).copy();
+ }
+ for (int f = 0; f < tOut.length; f++) {
+ if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) {
+ for (int g = 0; g < 1; g++) {
+ if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) {
+ tOut[f].stackSize += tRecipe.mOutputs[f].stackSize;
}
}
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
+ }
+ }
+ if (tFOut != null) {
+ final int tSize = tFOut.amount;
+ tFOut.amount = tSize * 1;
+ }
+
+ final List<ItemStack> overStacks = new ArrayList<>();
+ for (int f = 0; f < tOut.length; f++) {
+ if (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ while (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
+ final ItemStack tmp = tOut[f].copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize();
+ overStacks.add(tmp);
}
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
- this.updateSlots();
- return true;
}
}
+ if (overStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[overStacks.size()];
+ tmp = overStacks.toArray(tmp);
+ tOut = ArrayUtils.addAll(tOut, tmp);
+ }
+ final List<ItemStack> tSList = new ArrayList<>();
+ for (final ItemStack tS : tOut) {
+ if (tS.stackSize > 0) {
+ tSList.add(tS);
+ }
+ }
+ tOut = tSList.toArray(new ItemStack[tSList.size()]);
+ this.mOutputItems = tOut;
+ this.mOutputFluids = new FluidStack[]{tFOut};
+ this.updateSlots();
+
+ /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)};
+ updateSlots();*/
+ return true;
}
}
return false;
@@ -351,13 +430,13 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- if ((tAmount == 45)){
+ if ((tAmount >= 45)){
Utils.LOG_WARNING("Filled structure.");
}
else {
Utils.LOG_WARNING("Did not fill structure.");
}
- return (tAmount == 45);
+ return (tAmount >= 45);
}
} \ No newline at end of file