diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-01-11 13:08:17 +0000 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-01-11 13:08:17 +0000 |
| commit | 4a8ccf527325b4dd101cb933da31c870c41abf27 (patch) | |
| tree | d7b31113bd88af75bf18652a91c037961e056ff6 /src/Java | |
| parent | 5290f9e58b8260f30a1578d02a4b5e70f94e9204 (diff) | |
| download | GT5-Unofficial-4a8ccf527325b4dd101cb933da31c870c41abf27.tar.gz GT5-Unofficial-4a8ccf527325b4dd101cb933da31c870c41abf27.tar.bz2 GT5-Unofficial-4a8ccf527325b4dd101cb933da31c870c41abf27.zip | |
% Updated Scanner/NC2 Panel info for all Multis. Closes #384.
% Formatting.
% Reverted structure code for LFTR and Large Electrolyzer.
% Improved tooltip of Matter Fabricator.
% Adjusted parallelism for Matter Fabricator.
Diffstat (limited to 'src/Java')
36 files changed, 1586 insertions, 1164 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 383522cb7f..983c9d0936 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 @@ -13,6 +13,7 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.ArrayUtils; import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -57,6 +58,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; public abstract class GregtechMeta_MultiBlockBase @@ -67,14 +69,14 @@ GT_MetaTileEntity_MultiBlockBase { static { - + Method a08 = findRecipe08 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class); Method a09 = findRecipe09 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class); Logger.INFO("Found .08 findRecipe method? "+(a08 != null)); Logger.INFO("Found .09 findRecipe method? "+(a09 != null)); - + //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) - + } //Find Recipe Methods @@ -179,908 +181,964 @@ GT_MetaTileEntity_MultiBlockBase { long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); + int mPollutionReduction=0; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + } + } + + long storedEnergy=0; + long maxEnergy=0; + for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + + int tTier = this.getControlCoreTier(); + mInfo.add(getMachineTooltip()); - mInfo.add("Progress: " + Integer.toString((this.mProgresstime / 20)) +" / "+ Integer.toString((this.mMaxProgresstime / 20)) + " secs"); - mInfo.add("Efficiency: " + Float.toString((this.mEfficiency / 100.0F)) + "%"); - mInfo.add("Problems: " + Integer.toString((this.getIdealStatus() - this.getRepairStatus()))); - mInfo.add("Pollution: "+this.getPollutionPerTick(null)*20+"/second"); - mInfo.add("Total Time Since Built: " + Integer.toString(weeks)+" Weeks, " + Integer.toString(days) + " Days, "); - mInfo.add(Long.toString(hours) + " Hours, " + Long.toString(minutes) + " Minutes, " + Long.toString(second) + " Seconds."); - mInfo.add("Total Time in ticks: " + Long.toString(this.mTotalRunTime)); - String[] mInfo2 = new String[mInfo.size()]; - mInfo.toArray(mInfo2); - return mInfo2; + //Lets borrow the GTNH handling - } + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.Progress")+": "+ + EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ + EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s"); - @Override - public boolean isGivingInformation() { - return true; - } + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU"); - private String[] aCachedToolTip; - - @Override - public final String[] getDescription() { - if (aCachedToolTip != null) { - return aCachedToolTip; - } - String[] x = getTooltip(); - //Add Stock Tooltip to bottom of list - String[] z; - if (getPollutionPerTick(null) > 0) { - z = new String[] { - getPollutionTooltip(), - getMachineTooltip(), - CORE.GT_Tooltip}; - } - else { - z = new String[] { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ + EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t"); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ + EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.problems")+": "+ + EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ + " "+StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ + EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + this.getPollutionPerTick(null)*20+ EnumChatFormatting.RESET+"/sec"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"); + + + mInfo.add(StatCollector.translateToLocal("GTPP.CC.machinetier")+": "+ + EnumChatFormatting.GREEN+tTier+EnumChatFormatting.RESET); + + mInfo.add(StatCollector.translateToLocal("GTPP.CC.discount")+": "+ + EnumChatFormatting.GREEN+(getEuDiscountForParallelism())+EnumChatFormatting.RESET + "%"); + + mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(getMaxParallelRecipes())+EnumChatFormatting.RESET); + + + mInfo.add("Total Time Since Built: " + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks, " + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days, "); + mInfo.add(EnumChatFormatting.DARK_GREEN + Long.toString(hours) +EnumChatFormatting.RESET + " Hours, " + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes, " + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds."); + mInfo.add("Total Time in ticks: " + EnumChatFormatting.DARK_GREEN + Long.toString(this.mTotalRunTime)); + + + String[] mInfo2 = new String[mInfo.size()]; + mInfo.toArray(mInfo2); + return mInfo2; + + + +} + +@Override +public boolean isGivingInformation() { + return true; +} + +private String[] aCachedToolTip; + +@Override +public final String[] getDescription() { + if (aCachedToolTip != null) { + return aCachedToolTip; + } + String[] x = getTooltip(); + //Add Stock Tooltip to bottom of list + String[] z; + if (getPollutionPerTick(null) > 0) { + z = new String[] { + getPollutionTooltip(), + getMachineTooltip(), + CORE.GT_Tooltip}; + } + else { + z = new String[] { getMachineTooltip(), CORE.GT_Tooltip}; - } - - int a2, a3; - a2 = x != null ? x.length : 0; - a3 = z != null ? z.length : 0; - String[] aToolTip = new String[(a2 + a3)]; - aToolTip = ArrayUtils.addAll(aToolTip, x); - aToolTip = ArrayUtils.addAll(aToolTip, z); - aCachedToolTip = aToolTip; - return aToolTip; } - - public abstract String[] getTooltip(); - public synchronized final MultiblockRequirements getRequirements() { - return mRequirements; - } + int a2, a3; + a2 = x != null ? x.length : 0; + a3 = z != null ? z.length : 0; + String[] aToolTip = new String[(a2 + a3)]; + aToolTip = ArrayUtils.addAll(aToolTip, x); + aToolTip = ArrayUtils.addAll(aToolTip, z); + aCachedToolTip = aToolTip; + return aToolTip; +} - //public abstract MultiblockRequirements setRequirements(); - - public synchronized final void setRequirementsInternal() { - //this.mRequirements = setRequirements(); - this.mRequirements = null; - } +public abstract String[] getTooltip(); - public int getAmountOfOutputs() { - return 1; - } +public synchronized final MultiblockRequirements getRequirements() { + return mRequirements; +} - @Override - public boolean isCorrectMachinePart(final ItemStack paramItemStack) { - return true; - } +//public abstract MultiblockRequirements setRequirements(); - @Override - public int getDamageToComponent(final ItemStack paramItemStack) { - return 0; - } +public synchronized final void setRequirementsInternal() { + //this.mRequirements = setRequirements(); + this.mRequirements = null; +} - @Override - public boolean explodesOnComponentBreak(ItemStack p0) { - return false; - } +public int getAmountOfOutputs() { + return 1; +} - @Override - public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 1) { - GT_Utility.doSoundAtClient(getSound(), 10, 1.0F, aX, aY, aZ); - } - } +public abstract int getMaxParallelRecipes(); +public abstract int getEuDiscountForParallelism(); + +@Override +public boolean isCorrectMachinePart(final ItemStack paramItemStack) { + return true; +} + +@Override +public int getDamageToComponent(final ItemStack paramItemStack) { + return 0; +} + +@Override +public boolean explodesOnComponentBreak(ItemStack p0) { + return false; +} - public void startProcess() { - if(GT_Utility.isStringValid(getSound())) this.sendLoopStart((byte) 1); +@Override +public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 1) { + GT_Utility.doSoundAtClient(getSound(), 10, 1.0F, aX, aY, aZ); } +} - public String getSound() { return ""; } +public void startProcess() { + if(GT_Utility.isStringValid(getSound())) this.sendLoopStart((byte) 1); +} - public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { - if (aRecipe.mOutputs.length > 16) { - // Gendustry custom comb with a billion centrifuge outputs? Do it anyway. - return true; - } +public String getSound() { return ""; } - // Count slots available in output buses - ArrayList<ItemStack> tBusStacks = new ArrayList<>(); +public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { + if (aRecipe.mOutputs.length > 16) { + // Gendustry custom comb with a billion centrifuge outputs? Do it anyway. + return true; + } + + // Count slots available in output buses + ArrayList<ItemStack> tBusStacks = new ArrayList<>(); - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; + int tEmptySlots = 0; + for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + final IInventory tBusInv = tBus.getBaseMetaTileEntity(); + for (int i = 0; i < tBusInv.getSizeInventory(); i++) { + if (tBus.getStackInSlot(i) == null) { + tEmptySlots++; } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; - } - else { - tBusStacks.add(tBus.getStackInSlot(i)); - } + else { + tBusStacks.add(tBus.getStackInSlot(i)); } } + } - int slotsNeeded = aRecipe.mOutputs.length; - for (final ItemStack tRecipeOutput: aRecipe.mOutputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; - } + int slotsNeeded = aRecipe.mOutputs.length; + for (final ItemStack tRecipeOutput: aRecipe.mOutputs) { + if (tRecipeOutput == null) continue; + int amount = tRecipeOutput.stackSize * aParallelRecipes; + for (final ItemStack tBusStack : tBusStacks) { + if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { + if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { + slotsNeeded--; + break; } } } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - - // For each output fluid, make sure an output hatch can accept it. - for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) { - if (tRecipeFluid == null) continue; - boolean tCanBufferFluid = false; - int tRecipeAmount = tRecipeFluid.amount; - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - FluidStack tHatchFluid = tHatch.getFluid(); - if (tHatchFluid == null) { - if(tHatch.getCapacity() > tRecipeAmount) { - tCanBufferFluid = true; - break; - } - } - else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) { + } + // Enough open slots? + if (tEmptySlots < slotsNeeded) return false; + + // For each output fluid, make sure an output hatch can accept it. + for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) { + if (tRecipeFluid == null) continue; + boolean tCanBufferFluid = false; + int tRecipeAmount = tRecipeFluid.amount; + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + FluidStack tHatchFluid = tHatch.getFluid(); + if (tHatchFluid == null) { + if(tHatch.getCapacity() > tRecipeAmount) { tCanBufferFluid = true; break; } } - if (!tCanBufferFluid) return false; + else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) { + tCanBufferFluid = true; + break; + } } - return true; + if (!tCanBufferFluid) return false; } + return true; +} - /** - * A Static {@link Method} object which holds the current status of logging. - */ - public static Method aLogger = null; +/** + * A Static {@link Method} object which holds the current status of logging. + */ +public static Method aLogger = null; - public void log(String s) { - boolean isDebugLogging = CORE.DEBUG || true; - boolean reset = true; - if (aLogger == null || reset) { - if (isDebugLogging) { - try { - aLogger = Logger.class.getMethod("INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} - } - else { - try { - aLogger = Logger.class.getMethod("MACHINE_INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} - } +public void log(String s) { + boolean isDebugLogging = CORE.DEBUG || true; + boolean reset = true; + if (aLogger == null || reset) { + if (isDebugLogging) { + try { + aLogger = Logger.class.getMethod("INFO", String.class); + } catch (NoSuchMethodException | SecurityException e) {} + } + else { + try { + aLogger = Logger.class.getMethod("MACHINE_INFO", String.class); + } catch (NoSuchMethodException | SecurityException e) {} } - try { - aLogger.invoke(null, s); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - } + try { + aLogger.invoke(null, s); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - public boolean checkRecipeGeneric() { - return checkRecipeGeneric(1, 100, 0); - } +} - public boolean checkRecipeGeneric(int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent) { - return checkRecipeGeneric(aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, 10000); - } +public boolean checkRecipeGeneric() { + return checkRecipeGeneric(1, 100, 0); +} - public boolean checkRecipeGeneric(int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { - ArrayList<ItemStack> tItems = getStoredInputs(); - ArrayList<FluidStack> tFluids = getStoredFluids(); - ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); - FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); - } +public boolean checkRecipeGeneric(int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent) { + return checkRecipeGeneric(aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, 10000); +} +public boolean checkRecipeGeneric(int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + ArrayList<ItemStack> tItems = getStoredInputs(); + ArrayList<FluidStack> tFluids = getStoredFluids(); + ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); + FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); + return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); +} - public boolean checkRecipeGeneric(GT_Recipe aRecipe, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - if (aRecipe == null) { - return false; - } - ArrayList<ItemStack> tItems = getStoredInputs(); - ArrayList<FluidStack> tFluids = getStoredFluids(); - ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); - FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); - } - - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null); - } - - - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - // Based on the Processing Array. A bit overkill, but very flexible. - - - //Control Core to control the Multiblocks behaviour. - int aControlCoreTier = getControlCoreTier(); - - //If no core, return false; - if (aControlCoreTier == 0) { - log("No control core found."); - return false; - } +public boolean checkRecipeGeneric(GT_Recipe aRecipe, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll) { + if (aRecipe == null) { + return false; + } + ArrayList<ItemStack> tItems = getStoredInputs(); + ArrayList<FluidStack> tFluids = getStoredFluids(); + ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); + FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); + return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); +} - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; +public boolean checkRecipeGeneric( + ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll) { + return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null); +} - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - log("Running checkRecipeGeneric(0)"); - //Check to see if Voltage Tier > Control Core Tier - if (tTier > aControlCoreTier) { - log("Control core found is lower tier than power tier."); - return false; - } +public boolean checkRecipeGeneric( + ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { + // Based on the Processing Array. A bit overkill, but very flexible. - GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( - getBaseMetaTileEntity(), mLastRecipe, false, - gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + //Control Core to control the Multiblocks behaviour. + int aControlCoreTier = getControlCoreTier(); - log("Running checkRecipeGeneric(1)"); - // Remember last recipe - an optimization for findRecipe() - this.mLastRecipe = tRecipe; + //If no core, return false; + if (aControlCoreTier == 0) { + log("No control core found."); + return false; + } - if (tRecipe == null) { - log("BAD RETURN - 1"); - return false; - } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { - log("BAD RETURN - 2"); - return false; - } + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; - // EU discount - float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; - float tTotalEUt = 0.0f; - - int parallelRecipes = 0; - - log("parallelRecipes: "+parallelRecipes); - log("aMaxParallelRecipes: "+aMaxParallelRecipes); - log("tTotalEUt: "+tTotalEUt); - log("tVoltage: "+tVoltage); - log("tRecipeEUt: "+tRecipeEUt); - // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { - if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { - log("Broke at "+parallelRecipes+"."); - break; - } - log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); - tTotalEUt += tRecipeEUt; - } + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + log("Running checkRecipeGeneric(0)"); - if (parallelRecipes == 0) { - log("BAD RETURN - 3"); - return |
