aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorBlood-Asp <bloodasphendrik@gmail.com>2016-10-22 14:01:59 +0200
committerTechnus <daniel112092@gmail.com>2016-10-23 10:38:24 +0200
commit6e1a11cc9afaced08dac8313e516202eb7d8b659 (patch)
tree9a0894aad42f9ea88856e882c350bca6a8fd6094 /src/main/java
parent933d94022618584bd5503ccbf07f1ec56b6cc847 (diff)
downloadGT5-Unofficial-6e1a11cc9afaced08dac8313e516202eb7d8b659.tar.gz
GT5-Unofficial-6e1a11cc9afaced08dac8313e516202eb7d8b659.tar.bz2
GT5-Unofficial-6e1a11cc9afaced08dac8313e516202eb7d8b659.zip
Fix some recipes not working in proc array BloodASP
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 3bc1edaccf..2b21748153 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -19,6 +19,8 @@ import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.ArrayUtils;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase {
@@ -204,9 +206,9 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
tTier = 9;
mMult=4;//u need 16x less machines and they will use 16x less power
}else if (mInventory[1].getUnlocalizedName().endsWith("12") ||
- mInventory[1].getUnlocalizedName().endsWith("13") ||
- mInventory[1].getUnlocalizedName().endsWith("14") ||
- mInventory[1].getUnlocalizedName().endsWith("15")) {
+ mInventory[1].getUnlocalizedName().endsWith("13") ||
+ mInventory[1].getUnlocalizedName().endsWith("14") ||
+ mInventory[1].getUnlocalizedName().endsWith("15")) {
tTier = 9;
mMult=6;//u need 64x less machines and they will use 64x less power
}else if (mInventory[1].getUnlocalizedName().endsWith("1")) {
@@ -281,8 +283,10 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
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;
+ if(tRecipe.getOutput(h)!=null){
+ tOut[h] = tRecipe.getOutput(h).copy();
+ tOut[h].stackSize = 0;
+ }
}
FluidStack tFOut = null;
if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy();
@@ -298,14 +302,18 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
int tSize = tFOut.amount;
tFOut.amount = tSize * i;
}
+
+ tOut= clean(tOut);
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
List<ItemStack> overStacks = new ArrayList<ItemStack>();
for (int f = 0; f < tOut.length; f++) {
while (tOut[f].getMaxStackSize() < tOut[f].stackSize) {
- ItemStack tmp = tOut[f].copy();
- tmp.stackSize = tmp.getMaxStackSize();
- tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize();
- overStacks.add(tmp);
+ if(tOut[f]!=null) {
+ ItemStack tmp = tOut[f].copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize();
+ overStacks.add(tmp);
+ }
}
}
if (overStacks.size() > 0) {
@@ -329,6 +337,12 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
return false;
}
+ public static ItemStack[] clean(final ItemStack[] v){
+ List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v));
+ list.removeAll(Collections.singleton(null));
+ return list.toArray(new ItemStack[list.size()]);
+ }
+
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;