Update GT_MetaTileEntity_AssemblyLine.java

This commit is contained in:
Antifluxfield 2017-06-30 04:43:48 +08:00 committed by GitHub
parent 5294b864bd
commit a0a596e387

View file

@ -71,53 +71,76 @@ public class GT_MetaTileEntity_AssemblyLine
public boolean checkRecipe(ItemStack aStack) { public boolean checkRecipe(ItemStack aStack) {
if(GT_Values.D1)System.out.println("Start ALine recipe check"); if(GT_Values.D1)System.out.println("Start ALine recipe check");
if (!GT_Utility.isStackValid(mInventory[1]) || !ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) ArrayList<ItemStack> tDataStickList = getDataItems((byte) 1);
return false; if (tDataStickList.size() == 0) return false;
if(GT_Values.D1)System.out.println("Stick accepted"); if(GT_Values.D1)System.out.println("Stick accepted");
NBTTagCompound tTag = mInventory[1].getTagCompound();
if (tTag == null) return false;
ItemStack tStack[] = new ItemStack[15]; ItemStack tStack[] = new ItemStack[15];
for (int i = 0; i < 15; i++) { FluidStack[] tFluids = new FluidStack[4];
if (!tTag.hasKey("" + i)) continue; boolean recipeNA = false;
if (mInputBusses.get(i) == null) return false; boolean findRecipe = false;
tStack[i] = GT_Utility.loadItem(tTag, "" + i); for (ItemStack tDataStick : tDataStickList){
if (tStack[i] == null) continue; recipeNA = false;
if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); NBTTagCompound tTag = tDataStick.getTagCompound();
ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); if (tTag == null) continue;
if (!GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) || tStack[i].stackSize > stackInSlot.stackSize) { for (int i = 0; i < 15; i++) {
if(GT_Values.D1)System.out.println(i +" not accepted"); if (!tTag.hasKey("" + i)) continue;
return false; if (mInputBusses.get(i) == null) {
recipeNA = true;
break;
}
tStack[i] = GT_Utility.loadItem(tTag, "" + i);
if (tStack[i] == null) continue;
if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
if (!GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) || tStack[i].stackSize > stackInSlot.stackSize) {
if(GT_Values.D1)System.out.println(i +" not accepted");
recipeNA = true;
break;
}
if(GT_Values.D1)System.out.println(i+" accepted");
} }
if(GT_Values.D1)System.out.println(i+" accepted"); if (recipeNA) continue;
}
if(GT_Values.D1)System.out.println("All Items done, start fluid check"); if(GT_Values.D1)System.out.println("All Items done, start fluid check");
FluidStack[] tFluids = new FluidStack[4]; for (int i = 0; i < 4; i++) {
for (int i = 0; i < 4; i++) { if (!tTag.hasKey("f" + i)) continue;
if (!tTag.hasKey("f" + i)) continue; tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); if (tFluids[i] == null) continue;
if (tFluids[i] == null) continue; if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); if (mInputHatches.get(i) == null) {
if (mInputHatches.get(i) == null) return false; recipeNA = true;
FluidStack fluidInHatch = mInputHatches.get(i).mFluid; break;
if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { }
if(GT_Values.D1)System.out.println(i+" not accepted"); FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
return false; if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
if(GT_Values.D1)System.out.println(i+" not accepted");
recipeNA = true;
break;
}
if(GT_Values.D1)System.out.println(i+" accepted");
} }
if(GT_Values.D1)System.out.println(i+" accepted"); if (recipeNA) continue;
}
if(GT_Values.D1)System.out.println("Input accepted, check other values"); if(GT_Values.D1)System.out.println("Input accepted, check other values");
if (!tTag.hasKey("output")) return false; if (!tTag.hasKey("output")) continue;
mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
return false; continue;
if (!tTag.hasKey("time")) continue;
mMaxProgresstime = tTag.getInteger("time");
if (mMaxProgresstime <= 0) continue;
if (!tTag.hasKey("eu")) continue;
mEUt = tTag.getInteger("eu");
if(GT_Values.D1)System.out.println("Find avaiable recipe");
findRecipe = true;
break;
}
if (!findRecipe) return false;
if (!tTag.hasKey("time")) return false;
mMaxProgresstime = tTag.getInteger("time");
if (mMaxProgresstime <= 0) return false;
if (!tTag.hasKey("eu")) return false;
mEUt = tTag.getInteger("eu");
if(GT_Values.D1)System.out.println("All checked start consuming inputs"); if(GT_Values.D1)System.out.println("All checked start consuming inputs");
for (int i = 0; i < 15; i++) { for (int i = 0; i < 15; i++) {
if (tStack[i] == null) continue; if (tStack[i] == null) continue;