aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-19 07:16:30 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-19 07:16:30 +1000
commit98d4998aafa2f5b6f1ad518b6effe52b6a7c7c18 (patch)
tree7fd4e6e103ec937347f2bfa88e0b06534b9d2d7b /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
parentedb43bce755587ce57142ae7bb5a67f56c5f09cd (diff)
downloadGT5-Unofficial-98d4998aafa2f5b6f1ad518b6effe52b6a7c7c18.tar.gz
GT5-Unofficial-98d4998aafa2f5b6f1ad518b6effe52b6a7c7c18.tar.bz2
GT5-Unofficial-98d4998aafa2f5b6f1ad518b6effe52b6a7c7c18.zip
% Changed Wash Plant recipe handling.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java84
1 files changed, 52 insertions, 32 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 911ba9a88e..fa551407ce 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
@@ -937,38 +937,58 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity {
}
public int getValidOutputSlots(final IGregTechTileEntity machineCalling, final GT_Recipe sRecipes, final ItemStack[] sInputs){
- Utils.LOG_WARNING("Finding valid output slots for "+machineCalling.getInventoryName());
- final ArrayList<ItemStack> tInputList = this.getStoredInputs();
- final GT_Recipe tRecipe = sRecipes;
- final int outputItemCount = tRecipe.mOutputs.length;
- int tValidOutputHatches = 0;
-
- for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tHatch)) continue;
-
- int tEmptySlots = 0;
- boolean foundRoom = false;
- final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
- for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i)
- {
- if(tHatchInv.getStackInSlot(i) != null) continue;
-
- tEmptySlots++;
- if(tEmptySlots < outputItemCount) continue;
-
- tValidOutputHatches++;
- foundRoom = true;
- }
- }
-
- return tValidOutputHatches;
- }
-
+ Utils.LOG_INFO("Finding valid output slots for "+machineCalling.getInventoryName());
+
+ try{
+
+ if (sRecipes == null){
+ return 0;
+ }
+
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ final GT_Recipe tRecipe = sRecipes;
+ final int outputItemCount;
+ if (tRecipe.mOutputs != null){
+ outputItemCount= tRecipe.mOutputs.length;
+ }
+ else {
+ outputItemCount= 0;
+ }
+ int tValidOutputHatches = 0;
+
+ for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
+ if (!isValidMetaTileEntity(tHatch)) continue;
+
+ int tEmptySlots = 0;
+ boolean foundRoom = false;
+ final IInventory tHatchInv = tHatch.getBaseMetaTileEntity();
+ for(int i = 0; i < tHatchInv.getSizeInventory() && !foundRoom; ++i)
+ {
+ if(tHatchInv.getStackInSlot(i) != null) continue;
+
+ tEmptySlots++;
+ if(tEmptySlots < outputItemCount) continue;
+
+ tValidOutputHatches++;
+ foundRoom = true;
+ }
+ }
+ if (tValidOutputHatches < 0){
+ tValidOutputHatches = 0;
+ }
+
+ return tValidOutputHatches;
+ } catch (Throwable t){
+ t.printStackTrace();
+ return 0;
+ }
+ }
+
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();
@@ -978,7 +998,7 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity {
cloneTime = baseRecipe.mDuration;
Utils.LOG_WARNING("Setting Time");
}
-
+
if (cloneRecipe.mDuration > 0){
int originalTime = cloneRecipe.mDuration;
int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, (100-percentage));
@@ -991,9 +1011,9 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity {
}
}
return null;
-
-
-
+
+
+
}