Fix some recipes not working in proc array BloodASP

This commit is contained in:
Blood-Asp 2016-10-22 14:01:59 +02:00 committed by Technus
parent 933d940226
commit 6e1a11cc9a

View file

@ -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 {
@ -281,9 +283,11 @@ 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++) {
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();
for (int f = 0; f < tOut.length; f++) {
@ -298,16 +302,20 @@ 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) {
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) {
ItemStack[] tmp = new ItemStack[overStacks.size()];
tmp = overStacks.toArray(tmp);
@ -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;