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 | |
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.
37 files changed, 1605 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 false; - } + //Check to see if Voltage Tier > Control Core Tier + if (tTier > aControlCoreTier) { + log("Control core found is lower tier than power tier."); + return false; + } - // -- Try not to fail after this point - inputs have already been consumed! -- + GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( + getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); - // Convert speed bonus to duration multiplier - // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. - aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); - float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); - this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; - this.mEUt = (int)Math.ceil(tTotalEUt); + if (tRecipe == null) { + log("BAD RETURN - 1"); + return false; + } - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + log("BAD RETURN - 2"); + return false; + } + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; - //Only Overclock as high as the control circuit. - byte tTierOld = tTier; - tTier = (byte) aControlCoreTier; + int parallelRecipes = 0; - // Overclock - if (this.mEUt <= 16) { - this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); - } else { - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } + 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; + } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + // -- Try not to fail after this point - inputs have already been consumed! -- - // Collect fluid outputs - FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; - for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { - if (tRecipe.getFluidOutput(h) != null) { - tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); - tOutputFluids[h].amount *= parallelRecipes; - } - } - // Collect output item types - ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - if (tRecipe.getOutput(h) != null) { - tOutputItems[h] = tRecipe.getOutput(h).copy(); - tOutputItems[h].stackSize = 0; - } - } + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); - // Set output item stack sizes (taking output chance into account) - for (int f = 0; f < tOutputItems.length; f++) { - if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { - for (int g = 0; g < parallelRecipes; g++) { - if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) - tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; - } - } - } + this.mEUt = (int)Math.ceil(tTotalEUt); - tOutputItems = removeNulls(tOutputItems); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; - // Sanitize item stack size, splitting any stacks greater than max stack size - List<ItemStack> splitStacks = new ArrayList<ItemStack>(); - for (ItemStack tItem : tOutputItems) { - while (tItem.getMaxStackSize() < tItem.stackSize) { - ItemStack tmp = tItem.copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); - splitStacks.add(tmp); - } - } - if (splitStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[splitStacks.size()]; - tmp = splitStacks.toArray(tmp); - tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); - } + //Only Overclock as high as the control circuit. + byte tTierOld = tTier; + tTier = (byte) aControlCoreTier; - // Strip empty stacks - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOutputItems) { - if (tS.stackSize > 0) tSList.add(tS); + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; } - tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); - - // Commit outputs - this.mOutputItems = tOutputItems; - this.mOutputFluids = tOutputFluids; - updateSlots(); - - // Play sounds (GT++ addition - GT multiblocks play no sounds) - startProcess(); + } - log("GOOD RETURN - 1"); - return true; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); } - public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe, - final float percentage) { - int cloneTime = 0; - GT_Recipe baseRecipe; - GT_Recipe cloneRecipe = null; + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - baseRecipe = tRecipe.copy(); - if ((baseRecipe != null) && ((cloneRecipe != baseRecipe) || (cloneRecipe == null))) { - cloneRecipe = baseRecipe.copy(); - log("Setting Recipe"); - } - if ((baseRecipe != null) && ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0))) { - cloneTime = baseRecipe.mDuration; - log("Setting Time"); + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; } + } - if ((cloneRecipe != null) && cloneRecipe.mDuration > 0) { - final int originalTime = cloneRecipe.mDuration; - final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, - (100 - percentage)); - cloneRecipe.mDuration = tempTime; - if (cloneRecipe.mDuration < originalTime) { - log("Generated recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return cloneRecipe; - } else { - log("Did not generate recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return tRecipe; - } + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; } - log("Error generating recipe, returning null."); - return null; } - public boolean isMachineRunning() { - boolean aRunning = this.getBaseMetaTileEntity().isActive(); - Logger.INFO("Queried Multiblock is currently running: "+aRunning); - return aRunning; + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } } - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, - final long aTick) { + tOutputItems = removeNulls(tOutputItems); - //Time Counter - if (aBaseMetaTileEntity.isServerSide()){ - this.mTotalRunTime++; + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); } + } - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mChargeHatches.clear(); - this.mDischargeHatches.clear(); - this.mControlCoreBus.clear(); - this.mMultiDynamoHatches.clear(); - } - } - + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } - super.onPostTick(aBaseMetaTileEntity, aTick); + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); - @Override - public void explodeMultiblock() { - MetaTileEntity tTileEntity; - for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches - .iterator(); localIterator.hasNext(); tTileEntity - .getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches - .iterator(); localIterator.hasNext(); tTileEntity - .getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); - } - tTileEntity = null; - for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mMultiDynamoHatches - .iterator(); localIterator.hasNext(); tTileEntity - .getBaseMetaTileEntity() - .doExplosion(gregtech.api.enums.GT_Values.V[8])) { - tTileEntity = localIterator.next(); + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + log("GOOD RETURN - 1"); + return true; +} + +public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe, + final float percentage) { + int cloneTime = 0; + GT_Recipe baseRecipe; + GT_Recipe cloneRecipe = null; + + baseRecipe = tRecipe.copy(); + if ((baseRecipe != null) && ((cloneRecipe != baseRecipe) || (cloneRecipe == null))) { + cloneRecipe = baseRecipe.copy(); + log("Setting Recipe"); + } + if ((baseRecipe != null) && ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0))) { + cloneTime = baseRecipe.mDuration; + log("Setting Time"); + } + + if ((cloneRecipe != null) && cloneRecipe.mDuration > 0) { + final int originalTime = cloneRecipe.mDuration; + final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, + (100 - percentage)); + cloneRecipe.mDuration = tempTime; + if (cloneRecipe.mDuration < originalTime) { + log("Generated recipe with a smaller time. | " + + originalTime + " | " + cloneRecipe.mDuration + " |"); + return cloneRecipe; + } else { + log("Did not generate recipe with a smaller time. | " + + originalTime + " | " + cloneRecipe.mDuration + " |"); + return tRecipe; } + } + log("Error generating recipe, returning null."); + return null; +} +public boolean isMachineRunning() { + boolean aRunning = this.getBaseMetaTileEntity().isActive(); + Logger.INFO("Queried Multiblock is currently running: "+aRunning); + return aRunning; +} +@Override +public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, + final long aTick) { - super.explodeMultiblock(); + //Time Counter + if (aBaseMetaTileEntity.isServerSide()){ + this.mTotalRunTime++; } - protected int getGUICircuit(ItemStack[] t) { - Item g = CI.getNumberedCircuit(0).getItem(); - ItemStack guiSlot = this.mInventory[1]; - int mMode = -1; - if (guiSlot != null && guiSlot.getItem() == g) { - this.mInternalCircuit = true; - return guiSlot.getItemDamage(); - } - else { - this.mInternalCircuit = false; + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mUpdate == 1 || this.mStartUpCheck == 1) { + this.mChargeHatches.clear(); + this.mDischargeHatches.clear(); + this.mControlCoreBus.clear(); + this.mMultiDynamoHatches.clear(); } + } - if (!this.mInternalCircuit) { - for (ItemStack j : t) { - if (j.getItem() == g) { - mMode = j.getItemDamage(); - break; - } - } - } - return mMode; + + super.onPostTick(aBaseMetaTileEntity, aTick); +} + +@Override +public void explodeMultiblock() { + MetaTileEntity tTileEntity; + for (final Iterator<GT_MetaTileEntity_Hatch_InputBattery> localIterator = this.mChargeHatches + .iterator(); localIterator.hasNext(); tTileEntity + .getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { + tTileEntity = localIterator.next(); + } + tTileEntity = null; + for (final Iterator<GT_MetaTileEntity_Hatch_OutputBattery> localIterator = this.mDischargeHatches + .iterator(); localIterator.hasNext(); tTileEntity + .getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { + tTileEntity = localIterator.next(); } + tTileEntity = null; + for (final Iterator<GT_MetaTileEntity_Hatch> localIterator = this.mMultiDynamoHatches + .iterator(); localIterator.hasNext(); tTileEntity + .getBaseMetaTileEntity() + .doExplosion(gregtech.api.enums.GT_Values.V[8])) { + tTileEntity = localIterator.next(); + } + + - protected ItemStack getGUIItemStack() { - ItemStack guiSlot = this.mInventory[1]; - return guiSlot; + super.explodeMultiblock(); +} + +protected int getGUICircuit(ItemStack[] t) { + Item g = CI.getNumberedCircuit(0).getItem(); + ItemStack guiSlot = this.mInventory[1]; + int mMode = -1; + if (guiSlot != null && guiSlot.getItem() == g) { + this.mInternalCircuit = true; + return guiSlot.getItemDamage(); + } + else { + this.mInternalCircuit = false; } - @Override - public void updateSlots() { - for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) { - if (isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); - } - } - for (final GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) { - if (isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); + if (!this.mInternalCircuit) { + for (ItemStack j : t) { + if (j.getItem() == g) { + mMode = j.getItemDamage(); + break; } } - super.updateSlots(); } + return mMode; +} - public boolean isToolCreative(ItemStack mStack){ - Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(mStack); - Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(mStack); - if (t1 == Materials._NULL && t2 == Materials._NULL){ - return true; - } - return false; - } +protected ItemStack getGUIItemStack() { + ItemStack guiSlot = this.mInventory[1]; + return guiSlot; +} - /** - * Causes a Random Maint. Issue. - * @return {@link boolean} - Returns whether or not an issue was caused, should always be true. - */ - public boolean causeMaintenanceIssue() { - boolean b = false; - switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0 : { - this.mWrench = false; - b = true; - break; - } - case 1 : { - this.mScrewdriver = false; - b = true; - break; - } - case 2 : { - this.mSoftHammer = false; - b = true; - break; - } - case 3 : { - this.mHardHammer = false; - b = true; - break; - } - case 4 : { - this.mSolderingTool = false; - b = true; - break; - } - case 5 : { - this.mCrowbar = false; - b = true; - break; +@Override +public void updateSlots() { + for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); } + } + for (final GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); } - return b; } + super.updateSlots(); +} + +public boolean isToolCreative(ItemStack mStack){ + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(mStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(mStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + return true; + } + return false; +} +/** + * Causes a Random Maint. Issue. + * @return {@link boolean} - Returns whether or not an issue was caused, should always be true. + */ +public boolean causeMaintenanceIssue() { + boolean b = false; + switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { + case 0 : { + this.mWrench = false; + b = true; + break; + } + case 1 : { + this.mScrewdriver = false; + b = true; + break; + } + case 2 : { + this.mSoftHammer = false; + b = true; + break; + } + case 3 : { + this.mHardHammer = false; + b = true; + break; + } + case 4 : { + this.mSolderingTool = false; + b = true; + break; + } + case 5 : { + this.mCrowbar = false; + b = true; + break; + } + } + return b; +} - public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, - final int aBaseCasingIndex) { - if (aList.isEmpty()) { - if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - log("Adding " + aTileEntity.getInventoryName() + " at " + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); - updateTexture(aTileEntity, aBaseCasingIndex); - return aList.add((E) aTileEntity); - } - } else { - IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity(); - BlockPos aCurPos = new BlockPos(aCur); - boolean aExists = false; - for (E m : aList) { - IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); - BlockPos aPos = new BlockPos(b); - if (b != null && aPos != null) { - if (aCurPos.equals(aPos)) { - log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); - return false; - } + +public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, + final int aBaseCasingIndex) { + if (aList.isEmpty()) { + if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { + log("Adding " + aTileEntity.getInventoryName() + " at " + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); + updateTexture(aTileEntity, aBaseCasingIndex); + return aList.add((E) aTileEntity); + } + } else { + IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity(); + BlockPos aCurPos = new BlockPos(aCur); + boolean aExists = false; + for (E m : aList) { + IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); + BlockPos aPos = new BlockPos(b); + if (b != null && aPos != null) { + if (aCurPos.equals(aPos)) { + log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + return false; } } - if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - log("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString()); - updateTexture(aTileEntity, aBaseCasingIndex); - return aList.add((E) aTileEntity); - } } - return false; - } - - public int getControlCoreTier() { - if (mControlCoreBus.isEmpty()) { - log("No Control Core Modules Found."); - return 0; - } - GT_MetaTileEntity_Hatch_ControlCore i = getControlCoreBus(); - if (i != null) { - ItemStack x = i.mInventory[0]; - if (x != null) { - return x.getItemDamage(); - } + if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { + log("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString()); + updateTexture(aTileEntity, aBaseCasingIndex); + return aList.add((E) aTileEntity); } - log("Control Core Module was null."); - return 0; } + return false; +} - public GT_MetaTileEntity_Hatch_ControlCore getControlCoreBus() { - GT_MetaTileEntity_Hatch_ControlCore x = this.mControlCoreBus.get(0); +public int getControlCoreTier() { + if (mControlCoreBus.isEmpty()) { + log("No Control Core Modules Found."); + return 0; + } + GT_MetaTileEntity_Hatch_ControlCore i = getControlCoreBus(); + if (i != null) { + ItemStack x = i.mInventory[0]; if (x != null) { - log("getControlCore(ok)"); - return x; + return x.getItemDamage(); } - log("getControlCore(bad)"); - return null; } + log("Control Core Module was null."); + return 0; +} - //mControlCoreBus - public boolean addControlCoreToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - log("Tried to add null module entity."); - return false; - } - if (!mControlCoreBus.isEmpty()) { - log("Tried to add a secondary control core module."); - return false; - } +public GT_MetaTileEntity_Hatch_ControlCore getControlCoreBus() { + GT_MetaTileEntity_Hatch_ControlCore x = this.mControlCoreBus.get(0); + if (x != null) { + log("getControlCore(ok)"); + return x; + } + log("getControlCore(bad)"); + return null; +} - log("Adding control core module."); - return addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); +//mControlCoreBus +public boolean addControlCoreToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + log("Tried to add null module entity."); + return false; + } + if (!mControlCoreBus.isEmpty()) { + log("Tried to add a secondary control core module."); + return false; } - @Override - public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } + log("Adding control core module."); + return addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); +} - //Use this to determine the correct value, then update the hatch texture after. - boolean aDidAdd = false; +@Override +public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } - //Handle Custom Hustoms - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ControlCore) { - log("Found GT_MetaTileEntity_Hatch_ControlCore"); - aDidAdd = addControlCoreToMachineList(aTileEntity, aBaseCasingIndex); - } - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { - log("Found GT_MetaTileEntity_Hatch_InputBattery"); - aDidAdd = addToMachineListInternal(mChargeHatches, aMetaTileEntity, aBaseCasingIndex); - } - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { - log("Found GT_MetaTileEntity_Hatch_OutputBattery"); - aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex); - } + //Use this to determine the correct value, then update the hatch texture after. + boolean aDidAdd = false; + + //Handle Custom Hustoms + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ControlCore) { + log("Found GT_MetaTileEntity_Hatch_ControlCore"); + aDidAdd = addControlCoreToMachineList(aTileEntity, aBaseCasingIndex); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { + log("Found GT_MetaTileEntity_Hatch_InputBattery"); + aDidAdd = addToMachineListInternal(mChargeHatches, aMetaTileEntity, aBaseCasingIndex); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { + log("Found GT_MetaTileEntity_Hatch_OutputBattery"); + aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex); + } + + //Handle TT Multi-A Dynamos + else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) { + log("Found isThisHatchMultiDynamo"); + aDidAdd = addToMachineListInternal(mMultiDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + } + + //Handle Fluid Hatches using seperate logic + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) + aDidAdd = addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) + aDidAdd = addToMachineListInternal(mOutputHatches, aMetaTileEntity, aBaseCasingIndex); + + //Process Remaining hatches using Vanilla GT Logic + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + aDidAdd = addToMachineListInternal(mInputBusses, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) + aDidAdd = addToMachineListInternal(mOutputBusses, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) + aDidAdd = addToMachineListInternal(mEnergyHatches, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) + aDidAdd = addToMachineListInternal(mDynamoHatches, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) + aDidAdd = addToMachineListInternal(mMaintenanceHatches, aMetaTileEntity, aBaseCasingIndex); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) + aDidAdd = addToMachineListInternal(mMufflerHatches, aMetaTileEntity, aBaseCasingIndex); + + //return super.addToMachineList(aTileEntity, aBaseCasingIndex); + return aDidAdd; +} - //Handle TT Multi-A Dynamos - else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) { - log("Found isThisHatchMultiDynamo"); - aDidAdd = addToMachineListInternal(mMultiDynamoHatches, aMetaTileEntity, aBaseCasingIndex); - } - //Handle Fluid Hatches using seperate logic - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - aDidAdd = addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - aDidAdd = addToMachineListInternal(mOutputHatches, aMetaTileEntity, aBaseCasingIndex); - //Process Remaining hatches using Vanilla GT Logic - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - aDidAdd = addToMachineListInternal(mInputBusses, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - aDidAdd = addToMachineListInternal(mOutputBusses, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - aDidAdd = addToMachineListInternal(mEnergyHatches, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - aDidAdd = addToMachineListInternal(mDynamoHatches, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - aDidAdd = addToMachineListInternal(mMaintenanceHatches, aMetaTileEntity, aBaseCasingIndex); - else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - aDidAdd = addToMachineListInternal(mMufflerHatches, aMetaTileEntity, aBaseCasingIndex); +@Override +public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return addToMachineList(aTileEntity, aBaseCasingIndex); +} - //return super.addToMachineList(aTileEntity, aBaseCasingIndex); - return aDidAdd; - } +@Override +public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return addToMachineList(aTileEntity, aBaseCasingIndex); +} +@Override +public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return addToMachineList(aTileEntity, aBaseCasingIndex); +} +@Override +public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return addToMachineList(aTileEntity, aBaseCasingIndex); +} - @Override - public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addToMachineList(aTileEntity, aBaseCasingIndex); +public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; } - - @Override - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addToMachineList(aTileEntity, aBaseCasingIndex); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; } + return addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex); +} - @Override - public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addToMachineList(aTileEntity, aBaseCasingIndex); +public boolean addFluidInputToMachineList(final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; } - - @Override - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addToMachineList(aTileEntity, aBaseCasingIndex); + final IMetaTileEntity aMetaTileEntity = aTileEntity; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex); } + return false; +} - public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - return addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex); - } +public boolean resetRecipeMapForAllInputHatches() { + return resetRecipeMapForAllInputHatches(this.getRecipeMap()); +} - public boolean addFluidInputToMachineList(final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; +public boolean resetRecipeMapForAllInputHatches(GT_Recipe_Map aMap) { + int cleared = 0; + for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) { + if (resetRecipeMapForHatch(g, aMap)) { + cleared++; } - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); - return addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex); + } + for (GT_MetaTileEntity_Hatch_InputBus g : this.mInputBusses) { + if (resetRecipeMapForHatch(g, aMap)) { + cleared++; } + } + return cleared > 0; +} +public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, GT_Recipe_Map aMap) { + if (aTileEntity == null) { return false; } - - public boolean resetRecipeMapForAllInputHatches() { - return resetRecipeMapForAllInputHatches(this.getRecipeMap()); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();; + if (aMetaTileEntity == null) { + return false; } - - public boolean resetRecipeMapForAllInputHatches(GT_Recipe_Map aMap) { - int cleared = 0; - for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) { - if (resetRecipeMapForHatch(g, aMap)) { - cleared++; - } - } - for (GT_MetaTileEntity_Hatch_InputBus g : this.mInputBusses) { - if (resetRecipeMapForHatch(g, aMap)) { - cleared++; - } - } - return cleared > 0; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap); } - public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, GT_Recipe_Map aMap) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();; - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap); - } - else { - return false; - } + else { + return false; } +} - public boolean resetRecipeMapForHatch(GT_MetaTileEntity_Hatch aTileEntity, GT_Recipe_Map aMap) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){ - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap; - } - else { - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap; - } - return true; +public boolean resetRecipeMapForHatch(GT_MetaTileEntity_Hatch aTileEntity, GT_Recipe_Map aMap) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){ + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap; } - else { - return false; + else { + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap; } + return true; } - - @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - resetRecipeMapForAllInputHatches(); - onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ); - } - - public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - + else { + return false; } +} - - - +@Override +public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + resetRecipeMapForAllInputHatches(); + onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ); +} - /** - * Enable Texture Casing Support if found in GT 5.09 - */ +public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - @SuppressWarnings("deprecation") - public boolean updateTexture(final IGregTechTileEntity aTileEntity, int aCasingID){ - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - return updateTexture(aMetaTileEntity, aCasingID); - } +} - /** - * Enable Texture Casing Support if found in GT 5.09 - */ - @SuppressWarnings("deprecation") - public boolean updateTexture(final IMetaTileEntity aTileEntity, int aCasingID){ - try { //gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int) - final IMetaTileEntity aMetaTileEntity = aTileEntity; - if (aMetaTileEntity == null) { - return false; - } - Method mProper = Class.forName("gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch").getDeclaredMethod("updateTexture", int.class); - if (mProper != null){ - if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){ - mProper.setAccessible(true); - mProper.invoke(aMetaTileEntity, aCasingID); - log("Good Method Call for updateTexture."); - return true; - } + +/** + * Enable Texture Casing Support if found in GT 5.09 + */ + +@SuppressWarnings("deprecation") +public boolean updateTexture(final IGregTechTileEntity aTileEntity, int aCasingID){ + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + return updateTexture(aMetaTileEntity, aCasingID); +} + +/** + * Enable Texture Casing Support if found in GT 5.09 + */ + +@SuppressWarnings("deprecation") +public boolean updateTexture(final IMetaTileEntity aTileEntity, int aCasingID){ + try { //gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int) + + final IMetaTileEntity aMetaTileEntity = aTileEntity; + if (aMetaTileEntity == null) { + return false; + } + Method mProper = Class.forName("gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch").getDeclaredMethod("updateTexture", int.class); + if (mProper != null){ + if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){ + mProper.setAccessible(true); + mProper.invoke(aMetaTileEntity, aCasingID); + log("Good Method Call for updateTexture."); + return true; } - else { - log("Bad Method Call for updateTexture."); - if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){ - if (aCasingID <= Byte.MAX_VALUE) { - ((GT_MetaTileEntity_Hatch) aTileEntity).mMachineBlock = (byte) aCasingID; - log("Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128."); - return true; - } - else { - log("updateTexture returning false. 1.2"); - } + + } + else { + log("Bad Method Call for updateTexture."); + if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){ + if (aCasingID <= Byte.MAX_VALUE) { + ((GT_MetaTileEntity_Hatch) aTileEntity).mMachineBlock = (byte) aCasingID; + log("Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128."); + return true; } else { - log("updateTexture returning false. 1.3"); + log("updateTexture returning false. 1.2"); } } - log("updateTexture returning false. 1"); - return false; + else { + log("updateTexture returning false. 1.3"); + } } - catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - log("updateTexture returning false."); - log("updateTexture returning false. 2"); - e.printStackTrace(); - return false; - } - + log("updateTexture returning false. 1"); + return false; } + catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log("updateTexture returning false."); + log("updateTexture returning false. 2"); + e.printStackTrace(); + return false; + } +} @@ -1089,95 +1147,96 @@ GT_MetaTileEntity_MultiBlockBase { - /** - * TecTech Support - */ +/** + * TecTech Support + */ - /** - * This is the array Used to Store the Tectech Multi-Amp hatches. - */ - public ArrayList<GT_MetaTileEntity_Hatch> mMultiDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); +/** + * This is the array Used to Store the Tectech Multi-Amp hatches. + */ - /** - * TecTech Multi-Amp Dynamo Support - * @param aTileEntity - The Dynamo Hatch - * @param aBaseCasingIndex - Casing Texture - * @return - */ +public ArrayList<GT_MetaTileEntity_Hatch> mMultiDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); - public boolean addMultiAmpDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex){ - //GT_MetaTileEntity_Hatch_DynamoMulti - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (isThisHatchMultiDynamo(aTileEntity)) { - updateTexture(aTileEntity, aBaseCasingIndex); - return this.mMultiDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); - } +/** + * TecTech Multi-Amp Dynamo Support + * @param aTileEntity - The Dynamo Hatch + * @param aBaseCasingIndex - Casing Texture + * @return + */ + +public boolean addMultiAmpDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex){ + //GT_MetaTileEntity_Hatch_DynamoMulti + if (aTileEntity == null) { return false; } - - @SuppressWarnings("rawtypes") - public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ - Class mDynamoClass; - try { - mDynamoClass = Class.forName("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); - if (mDynamoClass != null){ - if (mDynamoClass.isInstance(aMetaTileEntity)){ - return true; - } - } - } - catch (ClassNotFoundException e) {} + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { return false; } + if (isThisHatchMultiDynamo(aTileEntity)) { + updateTexture(aTileEntity, aBaseCasingIndex); + return this.mMultiDynamoHatches.add((GT_MetaTileEntity_Hatch) aMetaTileEntity); + } + return false; +} - @Override - public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (LoadedMods.TecTech){ - if (isThisHatchMultiDynamo(aTileEntity)) { - addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); +@SuppressWarnings("rawtypes") +public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ + Class mDynamoClass; + try { + mDynamoClass = Class.forName("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(aMetaTileEntity)){ + return true; } + } + } + catch (ClassNotFoundException e) {} + return false; +} +@Override +public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (LoadedMods.TecTech){ + if (isThisHatchMultiDynamo(aTileEntity)) { + addMultiAmpDynamoToMachineList(aTileEntity, aBaseCasingIndex); } - return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); + } + return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); +} - /** - * Pollution Management - */ +/** + * Pollution Management + */ - public int getPollutionPerTick(ItemStack arg0) { - return 0; - } +public int getPollutionPerTick(ItemStack arg0) { + return 0; +} - public String getPollutionTooltip() { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - return "Causes " + 20 * this.getPollutionPerTick(null) + " Pollution per second"; - } - else { - return ""; - } +public String getPollutionTooltip() { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + return "Causes " + 20 * this.getPollutionPerTick(null) + " Pollution per second"; } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setLong("mTotalRunTime", this.mTotalRunTime); - super.saveNBTData(aNBT); + else { + return ""; } +} - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mTotalRunTime = aNBT.getLong("mTotalRunTime"); - super.loadNBTData(aNBT); - } +@Override +public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setLong("mTotalRunTime", this.mTotalRunTime); + super.saveNBTData(aNBT); +} + +@Override +public void loadNBTData(NBTTagCompound aNBT) { + this.mTotalRunTime = aNBT.getLong("mTotalRunTime"); + super.loadNBTData(aNBT); +} @@ -1191,210 +1250,210 @@ GT_MetaTileEntity_MultiBlockBase { - /** - * Custom Find Recipe with Debugging - */ +/** + * Custom Find Recipe with Debugging + */ - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, - final boolean aDontCheckStackSizes, final long aVoltage, final FluidStack[] aFluids, - final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, - (ItemStack) null, aInputs); - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, + final boolean aDontCheckStackSizes, final long aVoltage, final FluidStack[] aFluids, + final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, + (ItemStack) null, aInputs); +} - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, - final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, + final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); +} - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, - final FluidStack[] aFluids, final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, - (ItemStack) null, aInputs); - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, + final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, + (ItemStack) null, aInputs); +} - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, - final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, + final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, (ItemStack) null, aInputs); +} - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, - final ItemStack aSpecialSlot, final ItemStack... aInputs) { - return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, true, aVoltage, aFluids, aSpecialSlot, - aInputs); - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, + final ItemStack aSpecialSlot, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, true, aVoltage, aFluids, aSpecialSlot, + aInputs); +} - public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, - final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, - final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { - if (this.getRecipeMap().mRecipeList.isEmpty()) { - log("No Recipes in Map to search through."); - return null; - } - GT_Recipe mRecipeResult = null; - try { - if (GregTech_API.sPostloadFinished) { - if (this.getRecipeMap().mMinimalInputFluids > 0) { - if (aFluids == null) { - log("aFluids == null && minFluids > 0"); - return null; - } - int tAmount = 0; - for (final FluidStack aFluid : aFluids) { - if (aFluid != null) { - ++tAmount; - } - } - if (tAmount < this.getRecipeMap().mMinimalInputFluids) { - log("Not enough fluids?"); - return null; - } +public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, + final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage, + final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { + if (this.getRecipeMap().mRecipeList.isEmpty()) { + log("No Recipes in Map to search through."); + return null; + } + GT_Recipe mRecipeResult = null; + try { + if (GregTech_API.sPostloadFinished) { + if (this.getRecipeMap().mMinimalInputFluids > 0) { + if (aFluids == null) { + log("aFluids == null && minFluids > 0"); + return null; } - if (this.getRecipeMap().mMinimalInputItems > 0) { - if (aInputs == null) { - log("No inputs and minItems > 0"); - return null; - } - int tAmount = 0; - for (final ItemStack aInput : aInputs) { - if (aInput != null) { - ++tAmount; - } - } - if (tAmount < this.getRecipeMap().mMinimalInputItems) { - log("Not enough items?"); - return null; + int tAmount = 0; + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + ++tAmount; } } + if (tAmount < this.getRecipeMap().mMinimalInputFluids) { + log("Not enough fluids?"); + return null; + } } - else { - log("Game Not Loaded properly for recipe lookup."); - } - if (aNotUnificated) { - aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); - } - if (aRecipe != null && !aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered - && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (aRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt*/) ? aRecipe : null; - log("x) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); - if (mRecipeResult != null) { - return mRecipeResult; + if (this.getRecipeMap().mMinimalInputItems > 0) { + if (aInputs == null) { + log("No inputs and minItems > 0"); + return null; } + int tAmount = 0; + for (final ItemStack aInput : aInputs) { + if (aInput != null) { + ++tAmount; + } + } + if (tAmount < this.getRecipeMap().mMinimalInputItems) { + log("Not enough items?"); + return null; + } + } + } + else { + log("Game Not Loaded properly for recipe lookup."); + } + if (aNotUnificated) { + aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + } + if (aRecipe != null && !aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered + && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { + mRecipeResult = (aRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt*/) ? aRecipe : null; + log("x) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); + if (mRecipeResult != null) { + return mRecipeResult; } - if (mRecipeResult == null && this.getRecipeMap().mUsualInputCount >= 0 && aInputs != null && aInputs.length > 0) { - for (final ItemStack tStack : aInputs) { - if (tStack != null) { - Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeItemMap.get(new GT_ItemStack(tStack)); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; - log("1) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); - //return mRecipeResult; - } + } + if (mRecipeResult == null && this.getRecipeMap().mUsualInputCount >= 0 && aInputs != null && aInputs.length > 0) { + for (final ItemStack tStack : aInputs) { + if (tStack != null) { + Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeItemMap.get(new GT_ItemStack(tStack)); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { + mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) + ? tRecipe + : null; + log("1) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); + //return mRecipeResult; } } + } - //TODO - Investigate if this requires to be in it's own block - tRecipes = this.getRecipeMap().mRecipeItemMap - .get(new GT_ItemStack(GT_Utility.copyMetaData(32767L, new Object[]{tStack}))); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe - && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled /*&& aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; - log("2) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); - //return mRecipeResult; - } + //TODO - Investigate if this requires to be in it's own block + tRecipes = this.getRecipeMap().mRecipeItemMap + .get(new GT_ItemStack(GT_Utility.copyMetaData(32767L, new Object[]{tStack}))); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe + && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { + mRecipeResult = (tRecipe.mEnabled /*&& aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) + ? tRecipe + : null; + log("2) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); + //return mRecipeResult; } } } } } - if (mRecipeResult == null && this.getRecipeMap().mMinimalInputItems == 0 && aFluids != null && aFluids.length > 0) { - for (final FluidStack aFluid2 : aFluids) { - if (aFluid2 != null) { - final Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeFluidMap.get(aFluid2.getFluid()); - if (tRecipes != null) { - for (final GT_Recipe tRecipe : tRecipes) { - if (!tRecipe.mFakeRecipe - && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { - mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) - ? tRecipe - : null; - log("3) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); - //return mRecipeResult; - } + } + if (mRecipeResult == null && this.getRecipeMap().mMinimalInputItems == 0 && aFluids != null && aFluids.length > 0) { + for (final FluidStack aFluid2 : aFluids) { + if (aFluid2 != null) { + final Collection<GT_Recipe> tRecipes = this.getRecipeMap().mRecipeFluidMap.get(aFluid2.getFluid()); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe + && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) { + mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/) + ? tRecipe + : null; + log("3) Found Recipe? "+(mRecipeResult != null ? "true" : "false")); + //return mRecipeResult; } } } } } } - catch (Throwable t) { - log("Invalid recipe lookup."); - } + } + catch (Throwable t) { + log("Invalid recipe lookup."); + } - if (mRecipeResult == null) { - log("Invalid recipe, Fallback lookup. "+this.getRecipeMap().mRecipeList.size()+" | "+this.getRecipeMap().mNEIName); - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - try { - return (GT_Recipe) findRecipe08.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - else { - try { - return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } + if (mRecipeResult == null) { + log("Invalid recipe, Fallback lookup. "+this.getRecipeMap().mRecipeList.size()+" | "+this.getRecipeMap().mNEIName); + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + try { + return (GT_Recipe) findRecipe08.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + return null; } } else { - return mRecipeResult; + try { + return (GT_Recipe) findRecipe09.invoke(getRecipeMap(), aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + return null; + } } + } + else { + return mRecipeResult; + } - } +} - /** - * Custom Tool Handling - */ +/** + * Custom Tool Handling + */ - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, - float aY, float aZ) { - //Do Super - boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); - // Do Things - if (this.getBaseMetaTileEntity().isServerSide()) { - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) { +@Override +public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, + float aY, float aZ) { + //Do Super + boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + // Do Things + if (this.getBaseMetaTileEntity().isServerSide()) { + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem != null) { + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) { - } } } - return aSuper; } + return aSuper; +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index 9f23145b23..22e41dc3d9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -272,4 +272,14 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { return 2; } + @Override + public int getMaxParallelRecipes() { + return 9; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java index 983a8204ec..adaf0fa730 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java @@ -456,5 +456,15 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } + @Override + public int getMaxParallelRecipes() { + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java index 8b1a829061..5ad7e1af30 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java @@ -115,6 +115,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return this.checkRecipeGeneric(this.mSize * 8 * GT_Utility.getTier(this.getMaxInputVoltage()), 100, 250); } + + @Override + public int getMaxParallelRecipes() { + return (this.mSize * 8 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public void startProcess() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index e59b7f57e9..13d94f3355 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -103,6 +103,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric(6* GT_Utility.getTier(this.getMaxInputVoltage()), 90, 125); } + + @Override + public int getMaxParallelRecipes() { + return (6 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 90; + } public Block getCasingBlock() { return ModBlocks.blockCasingsMisc; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index 00a576f8c7..111ee89083 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -100,7 +100,17 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(this.mLevel * 12, (100-(GT_Utility.getTier(this.getMaxInputVoltage())*4)), 0); + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + } + + @Override + public int getMaxParallelRecipes() { + return this.mLevel * 12; + } + + @Override + public int getEuDiscountForParallelism() { + return (100-(GT_Utility.getTier(this.getMaxInputVoltage())*4)); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java index dc7cc659f9..c79260e9eb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java @@ -89,6 +89,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 200); } + + @Override + public int getMaxParallelRecipes() { + return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 75; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 7fc13c4ba5..1fb7f83428 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -121,10 +121,38 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - if (mBluePrint == null) { + /*if (mBluePrint == null) { mBluePrint = new Blueprint_Electrolyzer(); } - return mBluePrint.checkMachine(aBaseMetaTileEntity); + return mBluePrint.checkMachine(aBaseMetaTileEntity);*/ + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(5)))) { + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 10; + + } @Override @@ -146,4 +174,14 @@ extends GregtechMeta_MultiBlockBase { public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } + + @Override + public int getMaxParallelRecipes() { + return 2* GT_Utility.getTier(this.getMaxInputVoltage()); + } + + @Override + public int getEuDiscountForParallelism() { + return 90; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java index 8fc7d369bd..82714b4f73 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java @@ -124,6 +124,16 @@ extends GregtechMeta_MultiBlockBase { } return false; } + + @Override + public int getMaxParallelRecipes() { + return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public void startProcess() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java index e2a336f3d4..9798152b8d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java @@ -111,11 +111,19 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 60, 7500); + } + + @Override + public int getMaxParallelRecipes() { final long tVoltage = getMaxInputVoltage(); final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final int maxParallelRecipes = Math.max(1, 8 * tTier); + return Math.max(1, 8 * tTier); + } - return checkRecipeGeneric(maxParallelRecipes, 100, 60, 7500); + @Override + public int getEuDiscountForParallelism() { + return 100; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index 1891da25a4..d88c6a0a45 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -128,6 +128,16 @@ extends GregtechMeta_MultiBlockBase { } return false; } + + @Override + public int getMaxParallelRecipes() { + return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public void startProcess() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index c63b742718..827536694a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -156,6 +156,16 @@ extends GregtechMeta_MultiBlockBase { //return checkRecipeGeneric(2*GT_Utility.getTier(this.getMaxInputVoltage()), 90, 180); } + + @Override + public int getMaxParallelRecipes() { + return (2 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 80; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java index 751b74376b..9c1b53f29c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -115,6 +115,16 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu } return false; } + + @Override + public int getMaxParallelRecipes() { + return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public void startProcess() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index fec12c79e2..ae1baa6d4e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -118,6 +118,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 400, 8800); } + + @Override + public int getMaxParallelRecipes() { + return (4 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 75; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java index 52a6ad0172..1ad198f3ef 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java @@ -88,6 +88,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric((8* GT_Utility.getTier(this.getMaxInputVoltage())), 80, 150); } + + @Override + public int getMaxParallelRecipes() { + return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 80; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java index 189c9a62aa..a0e6ac85ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java @@ -12,6 +12,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import static gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map.*; @@ -123,6 +124,16 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta public boolean checkRecipe(final ItemStack aStack) { return this.checkRecipeGeneric(4, 100, 100); } + + @Override + public int getMaxParallelRecipes() { + return 4; + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { final int xDir = ForgeDirection.getOrientation((int) aBaseMetaTileEntity.getBackFacing()).offsetX; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java index 9218334b8a..4f872ab69a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -109,6 +109,16 @@ extends GregtechMeta_MultiBlockBase { } return false; } + + @Override + public int getMaxParallelRecipes() { + return (4* GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java index bca5eebf0a..ff0571969d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java @@ -94,6 +94,16 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric((4* GT_Utility.getTier(this.getMaxInputVoltage())), 75, 200); } + + @Override + public int getMaxParallelRecipes() { + return (4* GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 75; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 1c6d149c0e..6d2376fefa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -525,5 +525,15 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } super.onPostTick(aBaseMetaTileEntity, aTick); } + + @Override + public int getMaxParallelRecipes() { + return 8; + } + + @Override + public int getEuDiscountForParallelism() { + return 90; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java index 9c37c9384c..5d81c8693b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java @@ -147,4 +147,14 @@ extends GregtechMeta_MultiBlockBase { return false; } + @Override + public int getMaxParallelRecipes() { + return (GT_Utility.getTier(this.getMaxInputVoltage())/2+1); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index 135b31c616..535bfa6880 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -278,8 +278,18 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } else if (mMachineMode == MODE.CRAFTING) { return doCrafting(aStack); } else { - return super.checkRecipeGeneric(tTier * 2, 100, 200); + return super.checkRecipeGeneric(getMaxParallelRecipes(), 100, 200); } + } + + @Override + public int getMaxParallelRecipes() { + return 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage()))); + } + + @Override + public int getEuDiscountForParallelism() { + return 100; } public boolean doDisassembly() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index 45a8740ad1..b3a5358bf0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -120,6 +120,16 @@ extends GregtechMeta_MultiBlockBase this.mMaxProgresstime = 0; this.mEUt = 0; return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java index b8d4ba3092..f7871ed1f9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.item.ItemStack; @@ -86,6 +87,16 @@ extends GregtechMeta_MultiBlockBase //Stage 1 } return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } public boolean processing_Stage_1() { //Deplete Water, Add More Progress Time diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java index 24a5c9cea7..156e69ce03 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java @@ -116,6 +116,16 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(ItemStack aStack) { return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java index bcd1fe941b..984fc53604 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java @@ -18,6 +18,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; @@ -139,129 +140,120 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { private Blueprint_LFTR mBlueprint; @Override - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - - if (mBlueprint == null) { - mBlueprint = new Blueprint_LFTR(); - } - return mBlueprint.checkMachine(aBaseMetaTileEntity); - - - /* + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + // Life Lessons from Greg. + /** + [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3 + [23:41:26] <GregoriusTechneticies> thats you issue + [23:44:33] <Alkalus> mmm? + [23:44:49] <Alkalus> Should they be x3? + [23:44:50] <GregoriusTechneticies> you just do a x2, what is for a 5x5 multiblock + [23:45:01] <GregoriusTechneticies> x3 is for a 7x7 one + [23:45:06] <Alkalus> I have no idea what that value does, tbh.. + [23:45:15] <GregoriusTechneticies> its the offset + [23:45:23] <Alkalus> Debugging checkMachine has been a pain and I usually trash designs that don't work straight up.. + [23:45:28] <GregoriusTechneticies> it determines the horizontal middle of the multiblock + [23:45:47] <GregoriusTechneticies> which is in your case THREE blocks away from the controller + [23:45:51] <Alkalus> Ahh + [23:45:57] <GregoriusTechneticies> and not 2 + [23:46:06] <Alkalus> Noted, thanks :D + */ + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + + for (int i = -3; i <= 3; i++) { + for (int j = -3; j <= 3; j++) { + for (int h = 0; h < 4; h++) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + + // Reactor Floor/Roof inner 5x5 + if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { + + // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. + if ((h == 0) || (h == 3)) { + + //If not a hatch, continue, else add hatch and continue. + if ((!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); + return false; + } + } + } - + // Inside 2 layers, mostly air + else { - // Life Lessons from Greg. - *//** - [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3 - [23:41:26] <GregoriusTechneticies> thats you issue - [23:44:33] <Alkalus> mmm? - [23:44:49] <Alkalus> Should they be x3? - [23:44:50] <GregoriusTechneticies> you just do a x2, what is for a 5x5 multiblock - [23:45:01] <GregoriusTechneticies> x3 is for a 7x7 one - [23:45:06] <Alkalus> I have no idea what that value does, tbh.. - [23:45:15] <GregoriusTechneticies> its the offset - [23:45:23] <Alkalus> Debugging checkMachine has been a pain and I usually trash designs that don't work straight up.. - [23:45:28] <GregoriusTechneticies> it determines the horizontal middle of the multiblock - [23:45:47] <GregoriusTechneticies> which is in your case THREE blocks away from the controller - [23:45:51] <Alkalus> Ahh - [23:45:57] <GregoriusTechneticies> and not 2 - [23:46:06] <Alkalus> Noted, thanks :D - *//* - - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; - - for (int i = -3; i <= 3; i++) { - for (int j = -3; j <= 3; j++) { - for (int h = 0; h < 4; h++) { - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - - // Reactor Floor/Roof inner 5x5 - if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { - - // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. - if ((h == 0) || (h == 3)) { - - //If not a hatch, continue, else add hatch and continue. - if ((!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); + // Reactor Inner 5x5 + //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { + if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { + Logger.INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } - } - } - // Inside 2 layers, mostly air - else { - - // Reactor Inner 5x5 - //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { - if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Logger.INFO("Make sure the inner 3x3 of the Multiblock is Air."); - return false; } + //TODO - Add Carbon Moderation Rods + /* + else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + Utils.LOG_WARNING("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { + Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + return false; + } + }*/ + } - //TODO - Add Carbon Moderation Rods - - else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 + //Dealt with inner 5x5, now deal with the exterior. + else { + + //Deal with all 4 sides (Reactor walls) + if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); - Utils.LOG_WARNING("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) { + Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } } - } + //Deal with top and Bottom edges (Inner 5x5) + else if ((h == 0) || (h == 3)) { + if ((!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller - //Dealt with inner 5x5, now deal with the exterior. - else { - - //Deal with all 4 sides (Reactor walls) - if ((h == 1) || (h == 2)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) { - Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - } - - //Deal with top and Bottom edges (Inner 5x5) - else if ((h == 0) || (h == 3)) { - if ((!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { - if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller - - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); - Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - if (h ==0){ - if (tTileEntity instanceof GregtechMTE_NuclearReactor){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + if (h ==0){ + if (tTileEntity instanceof GregtechMTE_NuclearReactor){ + } + } + else { + return false; } - } - else { - return false; } } } @@ -270,69 +262,68 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { } } } - } - - if (this.mDynamoHatches != null) { - for (int i = 0; i < this.mDynamoHatches.size(); i++) { - if (this.mDynamoHatches.get(i).mTier < 5){ - Logger.INFO("You require at LEAST IV tier Dynamo Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - return false; + + if (this.mDynamoHatches != null) { + for (int i = 0; i < this.mDynamoHatches.size(); i++) { + if (this.mDynamoHatches.get(i).mTier < 5){ + Logger.INFO("You require at LEAST IV tier Dynamo Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + return false; + } } } - } - if (this.mOutputHatches != null) { - for (int i = 0; i < this.mOutputHatches.size(); i++) { - - if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Logger.INFO("You require at LEAST IV tier Output Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); - return false; + if (this.mOutputHatches != null) { + for (int i = 0; i < this.mOutputHatches.size(); i++) { + + if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + Logger.INFO("You require at LEAST IV tier Output Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + return false; + } } } - } - if (this.mInputHatches != null) { - for (int i = 0; i < this.mInputHatches.size(); i++) { - if (this.mInputHatches.get(i).mTier < 5){ - Logger.INFO("You require at LEAST IV tier Input Hatches."); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); - return false; + if (this.mInputHatches != null) { + for (int i = 0; i < this.mInputHatches.size(); i++) { + if (this.mInputHatches.get(i).mTier < 5){ + Logger.INFO("You require at LEAST IV tier Input Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + return false; + } } } - } - if (this.mMufflerHatches.size() != 4){ - Logger.INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); - return false; - } - if (this.mInputHatches.size() < 4){ - Logger.INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); - return false; - } - if (this.mOutputHatches.size() < 10){ - Logger.INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); - return false; - } - if (this.mDynamoHatches.size() != 4){ - Logger.INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); - return false; - } - if (this.mMaintenanceHatches.size() != 2){ - Logger.INFO("You require EXACTLY 2 Maint. hatches. TWO. You have "+this.mMaintenanceHatches.size()); - return false; - } - this.mWrench = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mHardHammer = true; - this.mSolderingTool = true; - this.mCrowbar = true; - this.turnCasingActive(false); - Logger.INFO("Multiblock Formed."); - return true; - */} + if (this.mMufflerHatches.size() != 4){ + Logger.INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); + return false; + } + if (this.mInputHatches.size() < 4){ + Logger.INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); + return false; + } + if (this.mOutputHatches.size() < 10){ + Logger.INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); + return false; + } + if (this.mDynamoHatches.size() != 4){ + Logger.INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); + return false; + } + if (this.mMaintenanceHatches.size() != 2){ + Logger.INFO("You require EXACTLY 2 Maint. hatches. TWO. You have "+this.mMaintenanceHatches.size()); + return false; + } + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + this.turnCasingActive(false); + Logger.INFO("Multiblock Formed."); + return true; + } @Override public boolean isCorrectMachinePart(final ItemStack aStack) { @@ -547,6 +538,16 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { this.mEUt = 0; this.mEfficiency = 0; return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java index 33f1b9dad7..7378c818f6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java @@ -259,4 +259,14 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc public int getAmountOfOutputs() { return 1; } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index af106951cf..769225ff46 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -10,6 +10,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.block.ModBlocks; @@ -261,6 +262,16 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase return true; } return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index 1a78824925..ccb16bc69c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -205,6 +205,16 @@ extends GregtechMeta_MultiBlockBase { } Logger.WARNING("Failed to find some Valid Inputs or Clientside."); return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index 2ef681de33..aead58574d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -355,6 +355,16 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } } return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java index 034ad323d9..3afa8d84c3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java @@ -139,6 +139,16 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M } return true; } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 100; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java index d4cd08cf44..d34355902a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java @@ -16,13 +16,11 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab; @@ -47,6 +45,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo private int mAmplifierProduced = 0; private int mScrapUsed = 0; private int mAmplifierUsed = 0; + + public static String mCasingName1 = "Matter Fabricator Casing"; + public static String mCasingName2 = "Containment Casing"; + public static String mCasingName3 = "Matter Generation Coil"; private int mMode = 0; @@ -56,7 +58,6 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo public static boolean sRequiresUUA = false; private static FluidStack[] mUU = new FluidStack[2]; private static ItemStack mScrap[] = new ItemStack[2]; - private static Block IC2Glass = Block.getBlockFromItem(ItemUtils.getItem("IC2:blockAlloyGlass")); public int getAmplifierUsed(){ return this.mAmplifierUsed; @@ -68,37 +69,49 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); + mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9); + mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15); + mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8); } public GregtechMetaTileEntity_MassFabricator(final String aName) { super(aName); + mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9); + mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15); + mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8); } @Override public String getMachineType() { - return "Mass Fabricator"; + return "Mass Fabricator / Recycler"; } @Override public String[] getTooltip() { + + if (mCasingName1.toLowerCase().contains(".name")) { + mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9); + } + if (mCasingName2.toLowerCase().contains(".name")) { + mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15); + } + if (mCasingName3.toLowerCase().contains(".name")) { + mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8); + } + return new String[]{ "Controller Block for the Matter Fabricator", - "Produces UU-Matter from UU-Amplifier", - "Use numbered circuits in GUI slot to change mode", - "[19] Junk Items to Scrap", - "[20] Junk Items to UU-A", - "[21] Scrap to UU-A", - "[22] Produce UU-M", + "Produces UU-A, UU-m & Scrap", "Size(WxHxD): 5x4x5, Controller (Bottom center)", - "3x1x3 Matter Generation Coils (Inside bottom 5x1x5 layer)", - "9x Matter Generation Coils (Centered 3x1x3 area in Bottom layer)", + "3x1x3 "+mCasingName3+"s (Inside bottom 5x1x5 layer)", + "9x "+mCasingName3+" (Centered 3x1x3 area in Bottom layer)", "1x Input Hatch (Any bottom layer casing)", "1x Output Hatch (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x Muffler Hatch (Centered 3x1x3 area in Top layer)", "1x Energy Hatch (Any bottom layer casing)", - "24x IC2 Reinforced Glass for the walls", - "Matter Fabricator Casings for the edges & top (40 at least!)", + "24x "+mCasingName2+" for the walls", + mCasingName1+"s for the edges & top (40 at least!)", }; } @@ -386,31 +399,21 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo return true; } - return super.checkRecipeGeneric(c, 32, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); + return super.checkRecipeGeneric(c, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll); } //Return normal Recipe handling - return super.checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); - } + return super.checkRecipeGeneric(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll); + } - private GT_Recipe generateScrapRecipe(ItemStack[] aInputs) { - if (aInputs.length < 1) { - return null; - } - else { - AutoMap<ItemStack> aInputsFiltered = new AutoMap<ItemStack>(); - ItemStack circuit = CI.getNumberedCircuit(1); - for (ItemStack f : aInputs) { - if (f == null || f.getItem() == circuit.getItem()) { - continue; - } - } - - - } - - - return null; + @Override + public int getMaxParallelRecipes() { + return this.mMode == MODE_SCRAP ? 32 : 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage()))); + } + + @Override + public int getEuDiscountForParallelism() { + return 80; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index fe435490a2..56d00a330f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -105,7 +105,17 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase } } return false; - } + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java index 2621d9e807..5d443d0a5f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java @@ -13,6 +13,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.block.ModBlocks; @@ -156,6 +157,16 @@ extends GregtechMeta_MultiBlockBase { //this.mMaxProgresstime = 100; //this.mEUt = -4; return true; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java index 575e8d9b73..2b2a70e926 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java @@ -630,5 +630,14 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM return aUpdated; } + @Override + public int getMaxParallelRecipes() { + return 1; + } + @Override + public int getEuDiscountForParallelism() { + return 0; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java index 4fdfc74c90..b90cf8910a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java @@ -391,6 +391,16 @@ extends GregtechMeta_MultiBlockBase { //this.getBaseMetaTileEntity().(tFluids[0].amount, true); Logger.WARNING("Tank"); return false; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index ea3c44ea7d..5addd5c5b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -375,6 +375,16 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe this.mEfficiencyIncrease = 10000; return true; } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } private void drawEnergyFromHatch(MetaTileEntity aHatch) { if (!isValidMetaTileEntity(aHatch)) return; diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang new file mode 100644 index 0000000000..a3378d004c --- /dev/null +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -0,0 +1,19 @@ + +//Shit I stole from GTNH~ + +GTPP.EBF.heat=Heat capacity + +GTPP.machines.tier=Tier + +GTPP.multiblock.pollutionreduced=Pollution reduced to +GTPP.multiblock.pollution=Pollution +GTPP.multiblock.energy=Stored Energy +GTPP.multiblock.Progress=Progress +GTPP.multiblock.efficiency=Efficiency +GTPP.multiblock.problems=Problems +GTPP.multiblock.mei=Max Energy Income +GTPP.multiblock.usage=Probably uses + +GTPP.CC.machinetier=Control Core Tier +GTPP.CC.discount=EU Discount +GTPP.CC.parallel=Maximum Parallel Processing |