diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-06 18:39:34 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-06 18:39:34 +0000 |
commit | 8a2686340889660ec82cebcc659a10dce82ac339 (patch) | |
tree | 73d7052267b457082d8b56ec3775956e1e5efe6b /src/main/java/gtPlusPlus | |
parent | 580024a4f982602974bfbeb639067e93ec41d2fa (diff) | |
download | GT5-Unofficial-8a2686340889660ec82cebcc659a10dce82ac339.tar.gz GT5-Unofficial-8a2686340889660ec82cebcc659a10dce82ac339.tar.bz2 GT5-Unofficial-8a2686340889660ec82cebcc659a10dce82ac339.zip |
Fix Auto-Generated ABS recipes sometimes containing two circuits.
Fix Fluid Extraction recipes for Ingots/Nuggets being generated wrong.
Greatly improve generation of Fluid Extraction recipes.
Removed useless Fluid Extractor code which is no longer used.
Initial work on the Elemental Duplicator.
Diffstat (limited to 'src/main/java/gtPlusPlus')
9 files changed, 238 insertions, 730 deletions
diff --git a/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java b/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java index d1ea784b81..aac3bc3e92 100644 --- a/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/main/java/gtPlusPlus/core/material/MaterialGenerator.java @@ -67,26 +67,6 @@ public class MaterialGenerator { private static volatile Item temp; @SuppressWarnings("unused") private static volatile Block tempBlock; - - - public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid) { - return addFluidExtractionRecipe(aEmpty, aRemains, aFluid, null, null); - } - - /** - * Called Reflectively from CORE.RA.addFluidExtractionRecipe - * @param aSpecial - * @return - */ - public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, Integer aDuration, Integer aEU) { - RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(true, aEmpty, aRemains, aFluid, aDuration, aEU); - if (g != null && g.valid()) { - //Logger.INFO("[FIND] Adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); - return true; - } - Logger.INFO("[ERROR] FAILED adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); - return false; - } public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java index edbf0813ae..df1cc14658 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java @@ -15,19 +15,15 @@ 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_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java index 326cc01de7..5d2dc5b9a2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java @@ -1,77 +1,45 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; +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_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GTPP_Recipe; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Triplet; -import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; +import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase { - private int mSolidCasingTier = 0; - private int mMachineCasingTier = 0; - private int mPipeCasingTier = 0; - private int mCoilTier = 0; - private int checkCoil; - private int[] checkCasing = new int[8]; - private int checkMachine; - private int checkPipe; - private int maxTierOfHatch; - private int mCasing; - private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null; +public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase<GregtechMTE_ElementalDuplicator> { private ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder> mReplicatorDataOrbHatches = new ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder>(); - - private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>(); + private static final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 3); + private int mCasing = 0; public GregtechMTE_ElementalDuplicator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -81,28 +49,6 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase super(aName); } - public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) { - int aSize = mTieredBlockRegistry.size(); - int aSize2 = aSize; - Triplet<Block, Integer, Integer> aCasingData = new Triplet<Block, Integer, Integer>(aBlock, aMeta, aCasingTextureID); - if (mTieredBlockRegistry.containsKey(aTier)) { - CORE.crash("Tried to register a Machine casing for tier "+aTier+" to the Chemical Plant, however this tier already contains one."); - } - mTieredBlockRegistry.put(aTier, aCasingData); - aSize = mTieredBlockRegistry.size(); - return aSize > aSize2; - } - - private static int getCasingTextureIdForTier(int aTier) { - if (!mTieredBlockRegistry.containsKey(aTier)) { - return 10; - } - int aCasingID = mTieredBlockRegistry.get(aTier).getValue_3(); - //Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier); - return aCasingID; - } - - @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMTE_ElementalDuplicator(this.mName); } @@ -114,631 +60,250 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType(getMachineType()) - .addInfo("Controller Block for the Industrial Replication Machine") - .addInfo("Now replication is less painful") - .addInfo("Please read to user manual for more information on construction & usage") + .addInfo("Produces Elemental Material from UU Matter") + .addInfo("This multiblock cannot be overclocked") + .addInfo("Maximum 1x of each bus/hatch.") + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() - .addController("Bottom Center") - .addStructureHint("Catalyst Housing", 1) - .addInputBus("Bottom Casing", 1) - .addOutputBus("Bottom Casing", 1) - .addInputHatch("Bottom Casing", 1) - .addOutputHatch("Bottom Casing", 1) - .addEnergyHatch("Bottom Casing", 1) - .addMaintenanceHatch("Bottom Casing", 1) + .beginStructureBlock(7, 7, 7, false) + .addController("Top Center") + .addCasingInfo("Robust Tungstensteel Machine Casing", 40) + .addCasingInfo("Tungstensteel Coils", 16) + .addCasingInfo("Molecular Containment Casing", 52) + .addCasingInfo("High Voltage Current Capacitor", 32) + .addCasingInfo("Particle Containment Casing", 4) + .addCasingInfo("Resonance Chamber I", 5) + .addCasingInfo("Modulator I", 4) + .addInputBus("Any Robust Tungstensteel Machine Casing", 1) + .addOutputBus("Any Robust Tungstensteel Machine Casing", 1) + .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1) + .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1) + .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1) .toolTipFinisher(CORE.GT_Tooltip_Builder); return tt; } + - public void setMachineMeta(int meta) { - checkMachine = meta; - } - - public int getMachineMeta() { - return checkMachine; - } - - public void setPipeMeta(int meta) { - checkPipe = meta; - } - - public int getPipeMeta() { - return checkPipe; - } - - public void setCoilMeta(int meta) { - checkCoil = meta; - } - - public int getCoilMeta() { - return checkCoil; - } - - public int coilTier(int meta) { - switch (meta) { - case 0: return 1; - case 1: return 2; - case 2: return 3; - case 3: return 4; - case 4: return 5; - case 5: return 7; - case 6: return 8; - case 7: return 10; - case 8: return 11; - case 9: return 6; - case 10: return 9; - } - return 0; - } - + private static final String STRUCTURE_PIECE_MAIN = "main"; + private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null; + @Override public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() { + STRUCTURE_DEFINITION = null; + log("Reset Structure Def"); if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder() - .addShape(mName, transpose(new String[][]{ - {"XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX"}, - {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"}, - {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"}, - {"X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X"}, - {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"}, - {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"}, - {"CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC"}, - })) - .addElement( - 'C', - ofChain( - ofHatchAdder( - GregtechMTE_ElementalDuplicator::addChemicalPlantList, getCasingTextureID(), 1 - ), - onElementPass( - x -> {++x.checkCasing[0]; ++x.mCasing;}, - ofSolidCasing(0) - ), - onElementPass( - x -> {++x.checkCasing[1]; ++x.mCasing;}, - ofSolidCasing(1) - ), - onElementPass( - x -> {++x.checkCasing[2]; ++x.mCasing;}, - ofSolidCasing(2) - ), - onElementPass( - x -> {++x.checkCasing[3]; ++x.mCasing;}, - ofSolidCasing(3) - ), - onElementPass( - x -> {++x.checkCasing[4]; ++x.mCasing;}, - ofSolidCasing(4) - ), - onElementPass( - x -> {++x.checkCasing[5]; ++x.mCasing;}, - ofSolidCasing(5) - ), - onElementPass( - x -> {++x.checkCasing[6]; ++x.mCasing;}, - ofSolidCasing(6) - ), - onElementPass( - x -> {++x.checkCasing[7]; ++x.mCasing;}, - ofSolidCasing(7) - ) - ) - ) - .addElement( - 'X', - ofChain( - onElementPass( - x -> {++x.checkCasing[0]; ++x.mCasing;}, - ofSolidCasing(0) - ), - onElementPass( - x -> {++x.checkCasing[1]; ++x.mCasing;}, - ofSolidCasing(1) - ), - onElementPass( - x -> {++x.checkCasing[2]; ++x.mCasing;}, - ofSolidCasing(2) - ), - onElementPass( - x -> {++x.checkCasing[3]; ++x.mCasing;}, - ofSolidCasing(3) - ), - onElementPass( - x -> {++x.checkCasing[4]; ++x.mCasing;}, - ofSolidCasing(4) - ), - onElementPass( - x -> {++x.checkCasing[5]; ++x.mCasing;}, - ofSolidCasing(5) - ), - onElementPass( - x -> {++x.checkCasing[6]; ++x.mCasing;}, - ofSolidCasing(6) - ), - onElementPass( - x -> {++x.checkCasing[7]; ++x.mCasing;}, - ofSolidCasing(7) - ) - ) - ) - .addElement( - 'M', - addTieredBlock( - GregTech_API.sBlockCasings1, GregtechMTE_ElementalDuplicator::setMachineMeta, GregtechMTE_ElementalDuplicator::getMachineMeta, 10 - ) - ) - .addElement( - 'H', - addTieredBlock( - GregTech_API.sBlockCasings5, GregtechMTE_ElementalDuplicator::setCoilMeta, GregtechMTE_ElementalDuplicator::getCoilMeta, 11 - ) - ) - .addElement( - 'P', - addTieredBlock( - GregTech_API.sBlockCasings2, GregtechMTE_ElementalDuplicator::setPipeMeta, GregtechMTE_ElementalDuplicator::getPipeMeta, 12, 16 - ) - ) - .build(); + + // h = Hatch + // c = Casing + + // a = MF Casing 1 + // b = Matter Gen Coil + + // d = Current Capacitor + // e = Particle + + // f = Resonance III + // g = Modulator III + + .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{ + {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccch~hccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " "}, + })) + + + //.addElement('c', ofBlock(getCasingBlock(), getCasingMeta())) + .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta())))) + .addElement('h', lazy(t -> ofChain( + ofHatchAdder(GregtechMTE_ElementalDuplicator::addGenericHatch, getCasingTextureIndex(), 1), + onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta())) + ))) + .build(); } return STRUCTURE_DEFINITION; } - - public static <T> IStructureElement<T> ofSolidCasing(int aIndex) { - return new IStructureElement<T>() { - @Override - public boolean check(T t, World world, int x, int y, int z) { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - Block target = mTieredBlockRegistry.get(aIndex).getValue_1(); - int targetMeta = mTieredBlockRegistry.get(aIndex).getValue_2(); - return target.equals(block) && meta == targetMeta; - } - - int getIndex(int size) { - if (size > 8) size = 8; - return size - 1; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2()); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return world.setBlock(x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2(), 3); - } - }; - } - + @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName , stackSize, hintsOnly, 3, 6, 0); + buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 3, 3, 0); } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; - for (int i = 0; i < 8; i++) { - checkCasing[i] = 0; - } - checkCoil = 0; - checkPipe = 0; - checkMachine = 0; - mSolidCasingTier = 0; - mMachineCasingTier = 0; - mPipeCasingTier = 0; - mCoilTier = 0; - mReplicatorDataOrbHatches.clear(); - if (checkPiece(mName, 3, 6, 0) && mCasing >= 80) { - for (int i = 0; i < 8; i++) { - if (checkCasing[i] == mCasing) { - mSolidCasingTier = i; - } - else if (checkCasing[i] > 0) - return false; - } - mMachineCasingTier = checkMachine - 1; - mPipeCasingTier = checkPipe - 12; - mCoilTier = coilTier(checkCoil - 1); - updateHatchTexture(); - return mMachineCasingTier >= maxTierOfHatch; + boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); + if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) { + return false; } - return false; + return aDidBuild && mCasing >= 40 && checkHatch(); + } + + protected static int getCasingTextureIndex() { + return CASING_TEXTURE_ID; } - public void updateHatchTexture() { - for (GT_MetaTileEntity_Hatch h : mReplicatorDataOrbHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID()); - for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID()); + protected static Block getCasingBlock() { + return ModBlocks.blockCasings5Misc; + } + + protected static Block getCasingBlock2() { + return ModBlocks.blockSpecialMultiCasings2; + } + + protected static Block getCasingBlock3() { + return GregTech_API.sBlockCasings4; + } + + protected static Block getCoilBlock() { + return GregTech_API.sBlockCasings5; + } + + protected static int getCasingMeta() { + return 3; + } + + protected static int getCasingMeta2() { + return 12; + } + + protected static int getCasingMeta3() { + return 13; + } + + protected static int getTungstenCasingMeta() { + return 0; } - public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; - } else { + } + else { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder){ - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){ - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier); - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){ - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { return addToMachineList(aTileEntity, aBaseCasingIndex); } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) { + ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap(); + return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex); + } } + log("Bad Hatch"); return false; } - @Override - public String getSound() { - return GregTech_API.sSoundList.get(Integer.valueOf(207)); - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - - ITexture aOriginalTexture; - - // Check things exist client side (The worst code ever) - if (aBaseMetaTileEntity.getWorld() != null) { - - } - int aCasingID = getCasingTextureID(); - aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(aCasingID); - + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)}; + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))}; } - return new ITexture[]{aOriginalTexture}; + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; } @Override public boolean hasSlotInGUI() { return true; } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) { - generateRecipes(); - } - return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT; - } - - public static void generateRecipes() { - for (GT_Recipe i : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { - GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.add(i); - } - } - + @Override - public int getMaxParallelRecipes() { - return 2 * getPipeCasingTier(); + public boolean requiresVanillaGtGUI() { + return true; } @Override - public int getEuDiscountForParallelism() { - return 100; - } - - private int getSolidCasingTier() { - return this.mSolidCasingTier; - } - - private int getMachineCasingTier() { - return mMachineCasingTier; - } - - private int getPipeCasingTier() { - return mPipeCasingTier; + public String getCustomGUIResourceName() { + return "VacuumFreezer"; } - private int getCasingTextureID() { - // Check the Tier Client Side - int aTier = mSolidCasingTier; - int aCasingID = getCasingTextureIdForTier(aTier); - return aCasingID; + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GTPP_Recipe_Map.sMolecularTransformerRecipes; } - public boolean addToMachineList(IGregTechTileEntity aTileEntity) { - int aMaxTier = getMachineCasingTier(); - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { - GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity; - int aTileTier = aMachineBlock.mTier; - if (aTileTier > aMaxTier) { - log("Hatch tier too high."); - return false; - } - else { - return addToMachineList(aTileEntity, getCasingTextureID()); - } - } - else { - log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know.. - return false; - } + public boolean isCorrectMachinePart(final ItemStack aStack) { + return true; } @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier); - aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier); - aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier); - aNBT.setInteger("mCoilTier", this.mCoilTier); + public boolean checkRecipe(final ItemStack aStack) { + return checkRecipeGeneric(1, 100, 100); } - + @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mSolidCasingTier = aNBT.getInteger("mSolidCasingTier"); - mMachineCasingTier = aNBT.getInteger("mMachineCasingTier"); - mPipeCasingTier = aNBT.getInteger("mPipeCasingTier"); - mCoilTier = aNBT.getInteger("mCoilTier"); + public int getMaxParallelRecipes() { + return 1; } @Override - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) { - log("Found GT_MetaTileEntity_Hatch_ElementalDataOrbHolder"); - ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap(); - return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex); - } - return super.addToMachineList(aTileEntity, aBaseCasingIndex); + public int getEuDiscountForParallelism() { + return 100; } - @Override public int getMaxEfficiency(final ItemStack aStack) { return 10000; } - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 100; + public int getPollutionPerSecond(final ItemStack aStack) { + return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer; } - @Override - public int getAmountOfOutputs() { - return 1; + public int getDamageToComponent(final ItemStack aStack) { + return 0; } - @Override public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - // Same speed bonus as pyro oven - public int getSpeedBonus() { - return 50 * (this.mCoilTier - 2); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate == 1 || this.mStartUpCheck == 1) { - this.mReplicatorDataOrbHatches.clear(); - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - + @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus()); - } - - - @Override - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) { - return false; - } - - private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>(); - private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>(); - private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>(); - private static boolean mInitRecipeCache = false; - - private static void initRecipeCaches() { - if (!mInitRecipeCache) { - mTieredRecipeMap.put((long) 0, aTier0Recipes); - mTieredRecipeMap.put((long) 1, aTier1Recipes); - mTieredRecipeMap.put((long) 2, aTier2Recipes); - mTieredRecipeMap.put((long) 3, aTier3Recipes); - mTieredRecipeMap.put((long) 4, aTier4Recipes); - mTieredRecipeMap.put((long) 5, aTier5Recipes); - mTieredRecipeMap.put((long) 6, aTier6Recipes); - mTieredRecipeMap.put((long) 7, aTier7Recipes); - for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) { - if (aRecipe != null) { - switch (aRecipe.mSpecialValue) { - case 0: - aTier0Recipes.add(aRecipe); - continue; - case 1: - aTier1Recipes.add(aRecipe); - continue; - case 2: - aTier2Recipes.add(aRecipe); - continue; - case 3: - aTier3Recipes.add(aRecipe); - continue; - case 4: - aTier4Recipes.add(aRecipe); - continue; - case 5: - aTier5Recipes.add(aRecipe); - continue; - case 6: - aTier6Recipes.add(aRecipe); - continue; - case 7: - aTier7Recipes.add(aRecipe); - continue; - } - } - } - mInitRecipeCache = true; - } - } - - private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) { - int aInputCount = aComparator.mInputs.length; - if (aInputCount > 0) { - //Logger.INFO("Looking for recipe with "+aInputCount+" Items"); - int aMatchingInputs = 0; - recipe : for (ItemStack a : aComparator.mInputs) { - for (ItemStack b : aInputs) { - if (a.getItem() == b.getItem()) { - if (a.getItemDamage() == b.getItemDamage()) { - //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName()); - aMatchingInputs++; - continue recipe; - } - } - } - } - if (aMatchingInputs != aInputCount) { - return false; - } - } - int aFluidInputCount = aComparator.mFluidInputs.length; - if (aFluidInputCount > 0) { - //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids"); - int aMatchingFluidInputs = 0; - recipe : for (FluidStack b : aComparator.mFluidInputs) { - //Logger.INFO("Checking for fluid "+b.getLocalizedName()); - for (FluidStack a : aFluids) { - if (GT_Utility.areFluidsEqual(a, b)) { - //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName()); - aMatchingFluidInputs++; - continue recipe; - } - else { - //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName()); - } - } - } - if (aMatchingFluidInputs != aFluidInputCount) { - return false; - } - } - Logger.INFO("Recipes Match!"); - return true; - } - - public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) { - if (!mInitRecipeCache) { - initRecipeCaches(); - } - if (this.getRecipeMap().mRecipeList.isEmpty()) { - log("No Recipes in Map to search through."); - return null; - } - else { - log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V."); - log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids."); - // Try check the cached recipe first - if (aRecipe != null) { - if (areInputsEqual(aRecipe, aInputs, aFluids)) { - if (aRecipe.mEUt <= aVoltage) { - Logger.INFO("Using cached recipe."); - return aRecipe; - } - } - } - - // Get all recipes for the tier - AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>(); - for (long i=0;i<=aSpecialValue;i++) { - aMasterMap.add(mTieredRecipeMap.get(i)); - } - GT_Recipe aFoundRecipe = null; - - // Iterate the tiers recipes until we find the one with all inputs matching - master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) { - for (GT_Recipe aRecipeToCheck : aTieredMap) { - if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) { - log("Found recipe with matching inputs!"); - if (aRecipeToCheck.mSpecialValue <= aSpecialValue) { - if (aRecipeToCheck.mEUt <= aVoltage) { - aFoundRecipe = aRecipeToCheck; - break master; - } - } - } - } - } - - // If we found a recipe, return it - if (aFoundRecipe != null) { - log("Found valid recipe."); - return aFoundRecipe; - } - } - log("Did not find valid recipe."); - return null; - } - - /* - * Catalyst Handling - */ - - @Override - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - tItems.addAll(tHatch.getInventory()); - } - } - return tItems; - } - -} + super.onPreTick(aBaseMetaTileEntity, aTick); + // Fix GT bug + /*if (this.getBaseMetaTileEntity().getFrontFacing() != 1) { + this.getBaseMetaTileEntity().setFrontFacing((byte) 1); + }*/ + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mUpdate == 1 || this.mStartUpCheck == 1) { + this.mReplicatorDataOrbHatches.clear(); + } + } + super.onPostTick(aBaseMetaTileEntity, aTick); + } + + @Override + public ArrayList<ItemStack> getStoredInputs() { + ArrayList<ItemStack> tItems = super.getStoredInputs(); + for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) { + tHatch.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + tItems.addAll(tHatch.getInventory()); + } + } + return tItems; + } + +}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index 9e58d486d3..f5abad2373 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -134,12 +134,12 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluidStack(fluidAmount), 100, (duration/(mTotalPartsCounter > 0 ? mTotalPartsCounter : 1)), (int) aVoltage)){ Logger.WARNING("[BAS] Success."); Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); - if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluidStack(144), 100, duration, 120)){ + /*if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluidStack(144), 100, duration, 120)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(M.getNugget(1), null, M.getFluidStack(16), 100, duration/9, 120)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); - } + }*/ /*if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/4, 120)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } @@ -157,12 +157,12 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { Logger.WARNING("[BAS] Success."); if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluidStack(144), M.getIngot(1), duration/2, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); - if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluidStack(144), 100, duration/2, 60)){ + /*if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluidStack(144), 100, duration/2, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } if (GT_Values.RA.addFluidExtractionRecipe(M.getNugget(1), null, M.getFluidStack(16), 100, duration/2/9, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); - } + }*/ /*if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/2/4, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java index 63c2d18783..3e54a7fe5d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_GTNH.java @@ -8,10 +8,12 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -124,9 +126,9 @@ public class RecipeGen_BlastSmelterGT_GTNH { FluidStack[] inputsF; int voltage, time, special; boolean enabled; - inputs = x.mInputs; - outputs = x.mOutputs; - inputsF = x.mFluidInputs; + inputs = x.mInputs.clone(); + outputs = x.mOutputs.clone(); + inputsF = x.mFluidInputs.clone(); voltage = x.mEUt; time = x.mDuration; enabled = x.mEnabled; @@ -157,6 +159,13 @@ public class RecipeGen_BlastSmelterGT_GTNH { //If this recipe is enabled and we have a valid molten fluidstack, let's try add this recipe. if (enabled && isValid(inputs, outputs, inputsF, mMoltenStack)) { //Build correct input stack + ArrayList<ItemStack> aTempList = new ArrayList<ItemStack>(); + for (ItemStack aPossibleCircuit : inputs) { + if (!ItemUtils.isControlCircuit(aPossibleCircuit)) { + aTempList.add(aPossibleCircuit); + } + } + inputs = aTempList.toArray(new ItemStack[aTempList.size()]); ItemStack[] newInput = new ItemStack[inputs.length+1]; int l = 1; for (ItemStack y : inputs) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java index 9fe86985f4..488af954d6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java @@ -177,6 +177,8 @@ public class RecipeGen_FluidCanning implements Runnable { private final boolean addFluidExtractionRecipe(GT_Recipe aRecipe) { boolean result = false; + CORE.crash(); + Logger.INFO("[FE-Debug] "+aRecipe.mFluidOutputs[0].amount+"L of "+aRecipe.mFluidOutputs[0].getLocalizedName()+" fluid extractor from 1 " + aRecipe.mInputs[0].getDisplayName() + " - Success. Time: "+aRecipe.mDuration+", Voltage: "+aRecipe.mEUt); int aCount1 = GT_Recipe_Map.sFluidExtractionRecipes.mRecipeList.size(); int aCount2 = aCount1; GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); @@ -187,7 +189,7 @@ public class RecipeGen_FluidCanning implements Runnable { } else { Logger.INFO("[ERROR] Failed adding Extraction recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); - //dumpStack(); + dumpStack(); } return result; } @@ -204,7 +206,7 @@ public class RecipeGen_FluidCanning implements Runnable { } else { Logger.INFO("[ERROR] Failed adding Canning recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); - //dumpStack(); + dumpStack(); } return result; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index e87fc08c90..ec71cb6b57 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -44,85 +44,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (material.getFluidStack(1) != null && !material.getFluidStack(1).getUnlocalizedName().toLowerCase().contains("plasma")) { - if (!material.requiresBlastFurnace()) { - - // Ingot - if (ItemUtils.checkForInvalidItems(material.getIngot(1))) - if (CORE.RA.addFluidExtractionRecipe( - material.getIngot(1), // Input - material.getFluidStack(144), // Fluid Output - 1 * 20, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("144l fluid extractor from 1 ingot Recipe: " + material.getLocalizedName() - + " - Success"); - } else { - Logger.WARNING("144l fluid extractor from 1 ingot Recipe: " + material.getLocalizedName() - + " - Failed"); - } - - // Plate - if (ItemUtils.checkForInvalidItems(material.getPlate(1))) - if (CORE.RA.addFluidExtractionRecipe( - material.getPlate(1), // Input - material.getFluidStack(144), // Fluid Output - 1 * 20, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("144l fluid extractor from 1 plate Recipe: " + material.getLocalizedName() - + " - Success"); - } else { - Logger.WARNING("144l fluid extractor from 1 plate Recipe: " + material.getLocalizedName() - + " - Failed"); - } - - // Double Plate - if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))) - if (CORE.RA.addFluidExtractionRecipe( - material.getPlateDouble(1), // Input - material.getFluidStack(288), // Fluid Output - 1 * 20, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("144l fluid extractor from 1 double plate Recipe: " + material.getLocalizedName() - + " - Success"); - } else { - Logger.WARNING("144l fluid extractor from 1 double plate Recipe: " + material.getLocalizedName() - + " - Failed"); - } - - // Nugget - if (ItemUtils.checkForInvalidItems(material.getNugget(1))) - if (CORE.RA.addFluidExtractionRecipe( - material.getNugget(1), // Input - material.getFluidStack(16), // Fluid Output - 16, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING("16l fluid extractor from 1 nugget Recipe: " + material.getLocalizedName() - + " - Success"); - } else { - Logger.WARNING("16l fluid extractor from 1 nugget Recipe: " + material.getLocalizedName() - + " - Failed"); - } - - // Block - if (ItemUtils.checkForInvalidItems(material.getBlock(1))) - if (CORE.RA.addFluidExtractionRecipe( - material.getBlock(1), // Input - material.getFluidStack(144 * 9), // Fluid Output - 288, // Duration - material.vVoltageMultiplier // Eu Tick - )) { - Logger.WARNING((144 * 9) + "l fluid extractor from 1 block Recipe: " - + material.getLocalizedName() + " - Success"); - } else { - Logger.WARNING((144 * 9) + "l fluid extractor from 1 block Recipe: " - + material.getLocalizedName() + " - Failed"); - } - - } - // Making Shapes from fluid // Ingot diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index acb7e5fe02..614734e78d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -1,6 +1,8 @@ package gtPlusPlus.xmod.gregtech.loaders; +import static gregtech.api.enums.GT_Values.L; import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.RA; import java.util.ArrayList; import java.util.Map; @@ -9,6 +11,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; @@ -137,9 +140,13 @@ public class RecipeGen_Recycling implements Runnable { //Fluid Extractor if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, material.getFluidStack(mFluidAmount), 30, material.vVoltageMultiplier)) { + + int aFluidAmount = (int) ((L * validPrefix.getKey().mMaterialAmount) / (M * tempStack.stackSize)); + int aDuration = (int) Math.max(1, (24 * validPrefix.getKey().mMaterialAmount) / M); + boolean aGenFluidExtraction = CORE.RA.addFluidExtractionRecipe(tempStack, material.getFluidStack(aFluidAmount), aDuration, material.vVoltageMultiplier); + if (aGenFluidExtraction/*(mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, material.getFluidStack(mFluidAmount), 30, material.vVoltageMultiplier)*/) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " - + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluidStack(1).getLocalizedName()+"."); + + tempStack.getDisplayName() + " and obtain " + aFluidAmount+"mb of "+material.getFluidStack(1).getLocalizedName()+". Time: "+aDuration+", Voltage: "+material.vVoltageMultiplier); } else { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Failed"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 7a84940b6f..c7e652023b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.recipes; import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_Values.RA; import static gtPlusPlus.core.lib.CORE.GTNH; import java.lang.reflect.InvocationTargetException; @@ -1283,12 +1284,39 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu) { - return MaterialGenerator.addFluidExtractionRecipe(GT_Values.NI, input, output, aTime, aEu); + + boolean aRecipe = RA.addFluidSmelterRecipe( + GT_Utility.copyAmount(1, input), + null, + output, + 10000, + aTime, + aEu, + false); + if (aRecipe) { + Logger.INFO("Added Fluid Extractor Recipe: " + + input.getDisplayName() + " and obtain " + + output.amount+"mb of "+output.getLocalizedName() + +". Time: "+aTime+", Voltage: " + +aEu); + } + return aRecipe; + + //return MaterialGenerator.addFluidExtractionRecipe(GT_Values.NI, input, output, aTime, aEu); } @Override public boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, int aDuration, int aEU) { - return MaterialGenerator.addFluidExtractionRecipe(aEmpty, aRemains, aFluid, aDuration, aEU); + boolean aRecipe = RA.addFluidSmelterRecipe( + GT_Utility.copyAmount(1, aEmpty), + aRemains, + aFluid, + 10000, + aDuration, + aEU, + false); + return aRecipe; + //return MaterialGenerator.addFluidExtractionRecipe(aEmpty, aRemains, aFluid, aDuration, aEU); } @Override |