aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java1245
2 files changed, 1246 insertions, 1 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
index 82631d81bf..f701b23e92 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -141,7 +141,7 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase<GT4Entity
.addSeparator()
.beginStructureBlock(3, 3, 3, true)
.addController("Front Center")
- .addCasingInfo("Autocrafter Frame", 10)
+ .addCasingInfo("Bulk Production Frame", 10)
.addInputBus("Any Casing", 1)
.addOutputBus("Any Casing", 1)
.addInputHatch("Any Casing", 1)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java
new file mode 100644
index 0000000000..b5fc3b6ebb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_QuantumForceTransformer.java
@@ -0,0 +1,1245 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.enums.GT_HatchElement.*;
+import static gregtech.api.util.GT_OreDictUnificator.getAssociation;
+import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
+
+import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
+import com.gtnewhorizon.structurelib.structure.*;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.objects.ItemData;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.*;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import org.apache.commons.lang3.tuple.Pair;
+import org.lwjgl.opengl.GL11;
+
+public class GregtechMetaTileEntity_QuantumForceTransformer
+ extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<GregtechMetaTileEntity_QuantumForceTransformer>
+ implements ISurvivalConstructable {
+
+ private int mCasing;
+ protected int mCraftingTier = 0;
+ protected int mFocusingTier = 0;
+ private boolean mSeparateInputBusses = false;
+ private boolean mFluidMode = false, doFermium = false, doNeptunium = false;
+ private static final Fluid mNeptunium = ELEMENT.getInstance().NEPTUNIUM.getPlasma();
+ private static final Fluid mFermium = ELEMENT.getInstance().FERMIUM.getPlasma();
+ private static final String MAIN_PIECE = "main";
+ private GT_MetaTileEntity_Hatch_Input mNeptuniumHatch;
+ private GT_MetaTileEntity_Hatch_Input mFermiumHatch;
+ private static final IStructureDefinition<GregtechMetaTileEntity_QuantumForceTransformer> STRUCTURE_DEFINITION =
+ StructureDefinition.<GregtechMetaTileEntity_QuantumForceTransformer>builder()
+ .addShape(MAIN_PIECE, new String[][] { // A - 142, B - 234, C - 177, D - 96, E - 224, H - 36, M - 21
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " BBBBABBBB ",
+ " BAAAAAAAB ",
+ " BABBABBAB ",
+ " BA AB ",
+ " A A ",
+ " A A ",
+ " A A "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " AAABBBAAA ",
+ " BAAAAAAAAAB ",
+ " B B ",
+ " A A ",
+ " A A ",
+ " ",
+ " ",
+ " "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " AA AA ",
+ " AA AA ",
+ " BAA AAB ",
+ " B B ",
+ " A A ",
+ " A A ",
+ " ",
+ " ",
+ " "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAAAB ",
+ " AA AA ",
+ " AA AA ",
+ "BAA AAB",
+ "B B",
+ "A A",
+ "A A",
+ "A A",
+ "A A",
+ "A A"
+ },
+ {
+ " TTT ",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " DDD ",
+ " EEE ",
+ " DDD ",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " DDD ",
+ " BAEEEAB ",
+ " AA EEE AA ",
+ " A EEE A ",
+ "BA DDD AB",
+ "B EEE B",
+ "B DDD B",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " Z~X "
+ },
+ {
+ " TTTTT ",
+ " ECCCE ",
+ " ECCCE ",
+ " ECCCE ",
+ " D D ",
+ " ECCCE ",
+ " D D ",
+ " ECCCE ",
+ " ECCCE ",
+ " ECCCE ",
+ " D D ",
+ " BAECCCEAB ",
+ " A ECCCE A ",
+ " A ECCCE A ",
+ "BA D D AB",
+ "B ECCCE B",
+ "B D D B",
+ "B ECCCE B",
+ " ECCCE ",
+ " ECCCE ",
+ " HHHHH "
+ },
+ {
+ " TTTTTTT ",
+ " ECCCCCE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " BAEC CEAB ",
+ " B EC CE B ",
+ "BB EC CE BB",
+ "BA D D AB",
+ "A EC CE A",
+ "A D D A",
+ "A EC CE A",
+ " EC CE ",
+ " EC CE ",
+ " HHHHHHH "
+ },
+ {
+ " TTTTTTT ",
+ " ECCCCCE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " AAEC CEAA ",
+ " A EC CE A ",
+ "AB EC CE BA",
+ "AA D D AA",
+ "A EC CE A",
+ "A D D A",
+ " EC CE ",
+ " EC CE ",
+ " EC CE ",
+ " HHHHHHH "
+ },
+ {
+ " TTTTTTT ",
+ " ECCCCCE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " D D ",
+ " EC CE ",
+ " EC CE ",
+ " EC CE ",
+ " D D ",
+ " BAEC CEAB ",
+ " B EC CE B ",
+ "BB EC CE BB",
+ "BA D D AB",
+ "A EC CE A",
+ "A D D A",
+ "A EC CE A",
+ " EC CE ",
+ " EC CE ",
+ " HHHHHHH "
+ },
+ {
+ " TTTTT ",
+ " ECCCE ",
+ " ECCCE ",
+ " ECCCE ",
+ " D D ",
+ " ECCCE ",
+ " D D ",
+ " ECCCE ",
+ " ECCCE ",
+ " ECCCE ",
+ " D D ",
+ " BAECCCEAB ",
+ " A ECCCE A ",
+ " A ECCCE A ",
+ "BA D D AB",
+ "B ECCCE B",
+ "B D D B",
+ "B ECCCE B",
+ " ECCCE ",
+ " ECCCE ",
+ " HHHHH "
+ },
+ {
+ " TTT ",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " DDD ",
+ " EEE ",
+ " DDD ",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " DDD ",
+ " BAEEEAB ",
+ " AA EEE AA ",
+ " A EEE A ",
+ "BA DDD AB",
+ "B EEE B",
+ "B DDD B",
+ " EEE ",
+ " EEE ",
+ " EEE ",
+ " HHH "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAAAB ",
+ " AA AA ",
+ " AA AA ",
+ "BAA AB",
+ "B B",
+ "A A",
+ "A A",
+ "A A",
+ "A A",
+ "A A"
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " AA AA ",
+ " AA AA ",
+ " BA AB ",
+ " B B ",
+ " A A ",
+ " A A ",
+ " ",
+ " ",
+ " "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " AAABBBAAA ",
+ " BAAAAAAAAAB ",
+ " B B ",
+ " A A ",
+ " A A ",
+ " ",
+ " ",
+ " "
+ },
+ {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " BAB ",
+ " BBBBABBBB ",
+ " BBBAAABBB ",
+ " ABBAAABBA ",
+ " A BA AB A ",
+ " A A ",
+ " A A ",
+ " A A "
+ },
+ })
+ .addElement(
+ 'A',
+ StructureUtility.ofBlocksTiered(
+ craftingTierConverter(),
+ getAllCraftingTiers(),
+ 0,
+ GregtechMetaTileEntity_QuantumForceTransformer::setCraftingTier,
+ GregtechMetaTileEntity_QuantumForceTransformer::getCraftingTier))
+ .addElement(
+ 'B',
+ StructureUtility.ofBlocksTiered(
+ focusingTierConverter(),
+ getAllFocusingTiers(),
+ 0,
+ GregtechMetaTileEntity_QuantumForceTransformer::setFocusingTier,
+ GregtechMetaTileEntity_QuantumForceTransformer::getFocusingTier))
+ .addElement('C', ofBlock(ModBlocks.blockCasings4Misc, 4))
+ .addElement('D', ofBlock(ModBlocks.blockCasings2Misc, 12))
+ .addElement('E', lazy(t -> ofBlock(t.getCasingBlock1(), t.getCasingMeta1())))
+ .addElement(
+ 'H',
+ buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class)
+ .atLeast(InputBus, InputHatch, Maintenance, Energy.or(ExoticEnergy))
+ .casingIndex(TAE.getIndexFromPage(0, 10))
+ .dot(4)
+ .buildAndChain(
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12))))
+ .addElement(
+ 'T',
+ buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class)
+ .atLeast(OutputBus, OutputHatch, Maintenance)
+ .casingIndex(TAE.getIndexFromPage(0, 10))
+ .dot(5)
+ .buildAndChain(
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12))))
+ .addElement(
+ 'Z',
+ buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class)
+ .hatchClass(GT_MetaTileEntity_Hatch_Input.class)
+ .adder(GregtechMetaTileEntity_QuantumForceTransformer::addNeptuniumHatch)
+ .casingIndex(TAE.getIndexFromPage(0, 10))
+ .dot(5)
+ .buildAndChain(
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12))))
+ .addElement(
+ 'X',
+ buildHatchAdder(GregtechMetaTileEntity_QuantumForceTransformer.class)
+ .hatchClass(GT_MetaTileEntity_Hatch_Input.class)
+ .adder(GregtechMetaTileEntity_QuantumForceTransformer::addFermiumHatch)
+ .casingIndex(TAE.getIndexFromPage(0, 10))
+ .dot(5)
+ .buildAndChain(
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12))))
+ .build();
+
+ public GregtechMetaTileEntity_QuantumForceTransformer(
+ final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_QuantumForceTransformer(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_QuantumForceTransformer(this.mName);
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Quantum Force Transformer")
+ .addInfo("Controller Block for the Quantum Force Transformer")
+ .addInfo("Allows Complex chemical lines to be performed instantly in one step")
+ .addInfo("Every recipe requires a catalyst, each catalyst adds 1 parallel and lasts forever")
+ .addInfo("Accepts TecTech Energy and Laser Hatches")
+ .addInfo("All inputs go on the bottom, all outputs go on the top")
+ .addInfo("Put a circuit in the controller to specify the focused output")
+ .addInfo("Check NEI to see the order of outputs, and which circuit number you need.")
+ .addInfo("Uses FocusTier*4*sqrt(parallels) Neptunium Plasma if focusing")
+ .addInfo("Can use FocusTier*4*sqrt(parallels) Fermium Plasma for additional chance output")
+ .addInfo("This multi gets improved when all casings of some types are upgraded")
+ .addInfo("Casing functions:")
+ .addInfo("Pulse Manipulators: Recipe Tier Allowed (check NEI for the tier of each recipe)")
+ .addInfo("Shielding Cores: Focusing Tier (equal to or higher than recipe tier to allow focus)")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(15, 21, 15, true)
+ .addController("Bottom Center")
+ .addCasingInfo("Bulk Production Frame", 80)
+ .addCasingInfo("Quantum Force Conductor", 177)
+ .addCasingInfo("Particle Containment Casing", 224)
+ .addCasingInfo("Neutron Pulse Manipulators", 233)
+ .addCasingInfo("Neutron Shielding Cores", 142)
+ .addInputBus("Bottom Layer", 4)
+ .addInputHatch("Bottom Layer", 4)
+ .addOutputHatch("Top Layer", 5)
+ .addOutputBus("Top Layer", 5)
+ .addEnergyHatch("Bottom Layer", 4)
+ .addMaintenanceHatch("Bottom Layer", 4)
+ .addStructureInfo("Neptunium Plasma Hatch: Left side of Controller")
+ .addStructureInfo("Fermium Plasma Hatch: Right side of Controller")
+ .toolTipFinisher(GT_Values.AuthorBlueWeabo + EnumChatFormatting.RESET + EnumChatFormatting.GREEN
+ + " + Steelux" + EnumChatFormatting.RESET + " - [GT++]");
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_QuantumForceTransformer> getStructureDefinition() {
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ this.mCasing = 0;
+ if (!checkPiece(MAIN_PIECE, 7, 20, 4)) {
+ return false;
+ }
+
+ if (mMaintenanceHatches.size() != 1
+ || mOutputBusses.size() < 1
+ || mInputBusses.size() < 1
+ || mInputHatches.size() < 1
+ || mOutputHatches.size() < 1) {
+ return false;
+ }
+
+ // Makes sure that the multi can accept only 1 TT Energy Hatch OR up to 2 Normal Energy Hatches. Deform if both
+ // present or more than 1 TT Hatch.
+ if (mExoticEnergyHatches.isEmpty() && mEnergyHatches.isEmpty()) {
+ return false;
+ }
+
+ if (mExoticEnergyHatches.size() >= 1) {
+ if (!mEnergyHatches.isEmpty()) {
+ return false;
+ }
+
+ if (mExoticEnergyHatches.size() != 1) {
+ return false;
+ }
+ }
+
+ if (mEnergyHatches.size() > 2) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(MAIN_PIECE, stackSize, hintsOnly, 7, 20, 4);
+ }
+
+ @Override
+ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
+ if (mMachine) return -1;
+ return survivialBuildPiece(MAIN_PIECE, stackSize, 7, 20, 4, elementBudget, env, false, true);
+ }
+
+ public static List<Pair<Block, Integer>> getAllCraftingTiers() {
+ return new ArrayList<Pair<Block, Integer>>() {
+ {
+ add(Pair.of(ModBlocks.blockCasings5Misc, 7));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 8));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 9));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 10));
+ }
+ };
+ }
+
+ public static List<Pair<Block, Integer>> getAllFocusingTiers() {
+ return new ArrayList<Pair<Block, Integer>>() {
+ {
+ add(Pair.of(ModBlocks.blockCasings5Misc, 11));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 12));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 13));
+ add(Pair.of(ModBlocks.blockCasings5Misc, 14));
+ }
+ };
+ }
+
+ public static ITierConverter<Integer> craftingTierConverter() {
+ return (block, meta) -> {
+ if (block == null) {
+ return -1;
+ } else if (block == ModBlocks.blockCasings5Misc) { // Resonance Chambers
+ switch (meta) {
+ case 7:
+ return 1;
+ case 8:
+ return 2;
+ case 9:
+ return 3;
+ case 10:
+ return 4;
+ }
+ }
+ return -1;
+ };
+ }
+
+ public static ITierConverter<Integer> focusingTierConverter() {
+ return (block, meta) -> {
+ if (block == null) {
+ return -1;
+ } else if (block == ModBlocks.blockCasings5Misc) { // Generation Coils
+ switch (meta) {
+ case 11:
+ return 1;
+ case 12:
+ return 2;
+ case 13:
+ return 3;
+ case 14:
+ return 4;
+ }
+ }
+ return -1;
+ };
+ }
+
+ private void setCraftingTier(int tier) {
+ mCraftingTier = tier;
+ }
+
+ private void setFocusingTier(int tier) {
+ mFocusingTier = tier;
+ }
+
+ private int getCraftingTier() {
+ return mCraftingTier;
+ }
+
+ private int getFocusingTier() {
+ return mFocusingTier;
+ }
+
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(208));
+ }
+
+ protected IIconContainer getActiveOverlay() {
+ return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active;
+ }
+
+ protected IIconContainer getInactiveOverlay() {
+ return TexturesGtBlock.Overlay_Machine_Controller_Advanced;
+ }
+
+ protected int getCasingTextureId() {
+ return TAE.getIndexFromPage(0, 10);
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sQuantumForceTransformerRecipes;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ private static int mMaxParallel = 64;
+ private int mCurrentParallel = 0;
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ mCurrentParallel = 0;
+ this.lEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = null;
+ this.mOutputFluids = null;
+ doFermium = false;
+ doNeptunium = false;
+ FluidStack[] tFluidList = getStoredFluids().toArray(new FluidStack[0]);
+ if (mSeparateInputBusses) {
+ ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>();
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ for (int i = tBus.getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getStackInSlot(i) != null) {
+ tInputList.add(tBus.getStackInSlot(i));
+ }
+ }
+ ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]);
+ if (processRecipe(tInputs, tFluidList, getRecipeMap(), aStack)) return true;
+ else tInputList.clear();
+ }
+ } else {
+ ItemStack[] tInputList = getStoredInputs().toArray(new ItemStack[0]);
+ return processRecipe(tInputList, tFluidList, getRecipeMap(), aStack);
+ }
+ this.mEfficiency = 0;
+ this.mEfficiencyIncrease = 0;
+ return false;
+ }
+
+ private boolean processRecipe(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs, GT_Recipe.GT_Recipe_Map aRecipeMap, ItemStack aStack) {
+ long tVoltage =
+ getMaxInputVoltage() / getExoticAndNormalEnergyHatchList().size();
+ long tAmps = (long) Math.floor(getMaxInputAmps() * 0.80);
+ long tTotalEUt = tVoltage * tAmps;
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = aRecipeMap
+ .findRecipe(
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[tTier],
+ aFluidInputs,
+ aItemInputs)
+ .copy();
+
+ if (tRecipe != null && tRecipe.mSpecialValue <= getCraftingTier()) {
+ ItemStack aRecipeCatalyst = null;
+ for (ItemStack tItem : tRecipe.mInputs) {
+ if (ItemUtils.isCatalyst(tItem)) {
+ aRecipeCatalyst = tItem;
+ break;
+ }
+ }
+
+ if (aRecipeCatalyst == null) {
+ return false;
+ }
+
+ int mCurrentMaxParallel = 0;
+ for (ItemStack tItem : aItemInputs) {
+ if (ItemUtils.isCatalyst(tItem) && tItem.isItemEqual(aRecipeCatalyst)) {
+ mCurrentMaxParallel += tItem.stackSize;
+ }
+
+ if (mCurrentMaxParallel >= mMaxParallel) {
+ mCurrentMaxParallel = mMaxParallel;
+ break;
+ }
+ }
+
+ if (mFermiumHatch != null) {
+ if (mFermiumHatch.getFluid() != null
+ && mFermiumHatch.getFluid().isFluidEqual(new FluidStack(mFermium, 1))) {
+ doFermium = true;
+ } else {
+ doFermium = false;
+ }
+ } else {
+ doFermium = false;
+ }
+
+ while (mCurrentParallel < mCurrentMaxParallel
+ && tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ mCurrentParallel++;
+ }
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ mMaxProgresstime = tRecipe.mDuration;
+ lEUt = -tRecipe.mEUt * mCurrentParallel;
+
+ calculateOverclockedNessMultiInternal(
+ tRecipe.mEUt * mCurrentParallel, tRecipe.mDuration, 1, tTotalEUt, false);
+
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 || lEUt == Long.MAX_VALUE - 1) return false;
+
+ if (this.lEUt > 0) {
+ this.lEUt = (-this.lEUt);
+ }
+
+ int[] tChances;
+ if (aStack == null
+ || aStack.getItemDamage() == 0
+ || mNeptuniumHatch.getFluid() == null
+ || !mNeptuniumHatch.getFluid().isFluidEqual(new FluidStack(mNeptunium, 1))) {
+ doNeptunium = false;
+ tChances = GetChanceOutputs(tRecipe, -1);
+ } else {
+ doNeptunium = true;
+ tChances = GetChanceOutputs(tRecipe, aStack.getItemDamage() - 1);
+ }
+
+ ArrayList<ItemStack> tItemOutputs = new ArrayList<ItemStack>();
+ ArrayList<FluidStack> tFluidOutputs = new ArrayList<FluidStack>();
+
+ if (mFluidMode) {
+ for (int i = 0; i < tChances.length; i++) {
+ if (getBaseMetaTileEntity().getRandomNumber(10000) < tChances[i]) {
+ ItemData data = getAssociation(tRecipe.getOutput(i));
+ Materials mat = data == null ? null : data.mMaterial.mMaterial;
+ if (i < tRecipe.mOutputs.length) {
+ if (mat != null) {
+ if (mat.getMolten(0) != null) {
+ tFluidOutputs.add(
+ mat.getMolten(tRecipe.getOutput(i).stackSize * 144 * mCurrentParallel));
+ } else if (mat.getFluid(0) != null) {
+ tFluidOutputs.add(
+ mat.getFluid(tRecipe.getOutput(i).stackSize * 1000 * mCurrentParallel));
+ } else {
+ ItemStack aItem = tRecipe.getOutput(i);
+ tItemOutputs.add(
+ GT_Utility.copyAmountUnsafe(aItem.stackSize * mCurrentParallel, aItem));
+ }
+ } else {
+ ItemStack aItem = tRecipe.getOutput(i);
+ tItemOutputs.add(
+ GT_Utility.copyAmountUnsafe(aItem.stackSize * mCurrentParallel, aItem));
+ }
+ } else {