diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/plugin/agrichem | |
parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/agrichem')
12 files changed, 2325 insertions, 2424 deletions
diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java b/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java index c6e98581ff..f83d33ad6c 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java @@ -2,59 +2,58 @@ package gtPlusPlus.plugin.agrichem; public enum AlgaeDefinition { - /* - * In general, the productivity of freshwater algae is primarily limited by - * the availability of the nutrient phosphate (PO4-3), while that of - * marine algae is limited by nitrate (NO3-) or ammonium (NH4+). - * Some algal species, however, may have unusual nutrient requirements, - * and their productivity may be limited by certain micronutrients, - * such as silica, in the case of diatoms. - */ - - Euglenophyta("Euglenophyta", "Euglenoids", true, false, getRGB(147, 168, 50)), - Chrysophyta("Chrysophyta", "Golden-Brown Algae", true, true, getRGB(186, 146, 0)), - Pyrrophyta("Pyrrophyta", "Fire Algae", true, true, getRGB(250, 118, 2)), - Chlorophyta("Chlorophyta", "Green Algae", true, true, getRGB(99, 181, 62)), - Rhodophyta("Rhodophyta", "Red Algae", false, true, getRGB(153, 5, 22)), - Paeophyta("Paeophyta", "Brown Algae", false, true, getRGB(94, 78, 47)), - Xanthophyta("Xanthophyta", "Yellow-Green Algae", true, false, getRGB(118, 138, 16)); + /* + * In general, the productivity of freshwater algae is primarily limited by + * the availability of the nutrient phosphate (PO4-3), while that of + * marine algae is limited by nitrate (NO3-) or ammonium (NH4+). + * Some algal species, however, may have unusual nutrient requirements, + * and their productivity may be limited by certain micronutrients, + * such as silica, in the case of diatoms. + */ - public final String mScientificName; - public final String mSimpleName; - public final boolean mSaltWater; - public final boolean mFreshWater; - public final int mColour; - - AlgaeDefinition(String aScientificName, String aSimpleName, boolean aFresh, boolean aSalt, int aColour) { - mScientificName = aScientificName; - mSimpleName = aSimpleName; - mFreshWater = aFresh; - mSaltWater = aSalt; - mColour = aColour; - } - - public static AlgaeDefinition getByIndex(int aIndex) { - switch(aIndex) { - default: - case 0: - return Euglenophyta; - case 1: - return Chrysophyta; - case 2: - return Pyrrophyta; - case 3: - return Chlorophyta; - case 4: - return Rhodophyta; - case 5: - return Paeophyta; - case 6: - return Xanthophyta; - } - } - - private final static int getRGB(int r, int g, int b) { - return AlgaeUtils.rgbtoHexValue(r, g, b); - } - + Euglenophyta("Euglenophyta", "Euglenoids", true, false, getRGB(147, 168, 50)), + Chrysophyta("Chrysophyta", "Golden-Brown Algae", true, true, getRGB(186, 146, 0)), + Pyrrophyta("Pyrrophyta", "Fire Algae", true, true, getRGB(250, 118, 2)), + Chlorophyta("Chlorophyta", "Green Algae", true, true, getRGB(99, 181, 62)), + Rhodophyta("Rhodophyta", "Red Algae", false, true, getRGB(153, 5, 22)), + Paeophyta("Paeophyta", "Brown Algae", false, true, getRGB(94, 78, 47)), + Xanthophyta("Xanthophyta", "Yellow-Green Algae", true, false, getRGB(118, 138, 16)); + + public final String mScientificName; + public final String mSimpleName; + public final boolean mSaltWater; + public final boolean mFreshWater; + public final int mColour; + + AlgaeDefinition(String aScientificName, String aSimpleName, boolean aFresh, boolean aSalt, int aColour) { + mScientificName = aScientificName; + mSimpleName = aSimpleName; + mFreshWater = aFresh; + mSaltWater = aSalt; + mColour = aColour; + } + + public static AlgaeDefinition getByIndex(int aIndex) { + switch (aIndex) { + default: + case 0: + return Euglenophyta; + case 1: + return Chrysophyta; + case 2: + return Pyrrophyta; + case 3: + return Chlorophyta; + case 4: + return Rhodophyta; + case 5: + return Paeophyta; + case 6: + return Xanthophyta; + } + } + + private static final int getRGB(int r, int g, int b) { + return AlgaeUtils.rgbtoHexValue(r, g, b); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java b/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java index 73ff23888c..4906d0483f 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java @@ -4,8 +4,7 @@ import gtPlusPlus.core.util.Utils; public class AlgaeUtils { - public static int rgbtoHexValue(final int r, final int g, final int b) { - return Utils.rgbtoHexValue(r, g, b); - } - + public static int rgbtoHexValue(final int r, final int g, final int b) { + return Utils.rgbtoHexValue(r, g, b); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java index c5402a6a41..9c7e89f1f5 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -2,12 +2,6 @@ package gtPlusPlus.plugin.agrichem; import static gtPlusPlus.core.lib.CORE.GTNH; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -33,6 +27,11 @@ import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; import ic2.core.Ic2Items; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import net.minecraft.enchantment.Enchantment; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -44,1381 +43,1311 @@ import net.minecraftforge.oredict.OreDictionary; public class BioRecipes { - private static Item mFert; - private static Item mDustDirt; - - private static Fluid mSalineWater; - private static Fluid mDistilledWater; - private static Fluid mThermalWater; - private static Fluid mAir; - private static Fluid mSulfuricWasteWater; - private static Fluid mAmmonia; - private static Fluid mMethanol; - private static Fluid mAceticAcid; - private static Fluid mPropionicAcid; - private static Fluid mLiquidPlastic; - private static Fluid mFermentationBase; - private static Fluid mCarbonDioxide; - private static Fluid mCarbonMonoxide; - private static Fluid mEthylene; - private static Fluid mEthanol; - private static Fluid mChlorine; - private static Fluid mHydrogen; - private static Fluid mDilutedSulfuricAcid; - private static Fluid mSulfuricAcid; - private static Fluid mUrea; - public static Fluid mFormaldehyde; - private static Fluid mLiquidResin; - private static Fluid mMethane; - private static Fluid mBenzene; - private static Fluid mEthylbenzene; - private static Fluid mStyrene; - private static Fluid mButanol; - private static Fluid mAcetone; - - - private static final ItemStack getGreenAlgaeRecipeChip() { - return getBioChip(4); - } - private static final ItemStack getBrownAlgaeRecipeChip() { - return getBioChip(8); - } - private static final ItemStack getGoldenBrownAlgaeRecipeChip() { - return getBioChip(12); - } - private static final ItemStack getRedAlgaeRecipeChip() { - return getBioChip(16); - } - - private static final ItemStack getBioChip(int aID) { - return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, aID, 0); - } - - public static void init() { - Logger.INFO("[Bio] Setting Variables"); - initRecipeVars(); - Logger.INFO("[Bio] Generating Biochip Recipes"); - recipeBioChip(); - Logger.INFO("[Bio] Generating Recipes"); - recipeAlgaeBiomass(); - Logger.INFO("[Bio] Finished with recipes"); - } - - private static final void initRecipeVars() { - mFert = AgriculturalChem.dustOrganicFertilizer; - mDustDirt = AgriculturalChem.dustDirt; - - // 5.08 Salt Water Solution ;) - if (!FluidUtils.doesFluidExist("saltwater")){ - mSalineWater = FluidUtils.generateFluidNoPrefix("saltwater", "Salt Water", 200, new short[]{10, 30, 220, 100}); - } - else { - Materials aSaltWater = MaterialUtils.getMaterial("saltwater"); - if (aSaltWater != null) { - FluidStack aWaterStack = aSaltWater.getFluid(1); - if (aWaterStack != null) { - mSalineWater = aSaltWater.getFluid(1).getFluid(); - } - } - if (mSalineWater == null) { - mSalineWater = FluidUtils.getWildcardFluidStack("saltwater", 1).getFluid(); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellSaltWater", 1) == null){ - new BaseItemComponent("saltwater", "Salt Water", new short[] {10, 30, 220}); - } - } - - mDistilledWater = FluidUtils.getDistilledWater(1).getFluid(); - mThermalWater = FluidUtils.getFluidStack("ic2hotwater", 1).getFluid(); - mAir = FluidUtils.getFluidStack("air", 1).getFluid(); - mSulfuricWasteWater = FluidUtils.getFluidStack("sulfuricapatite", 1).getFluid(); - mAmmonia = MISC_MATERIALS.AMMONIA.getFluidStack(1).getFluid(); - mEthylene = FluidUtils.getFluidStack("ethylene", 1).getFluid(); - mEthanol = FluidUtils.getFluidStack("bioethanol", 1).getFluid(); - mDilutedSulfuricAcid = FluidUtils.getFluidStack("dilutedsulfuricacid", 1).getFluid(); - mSulfuricAcid = FluidUtils.getFluidStack("sulfuricacid", 1).getFluid(); - mFormaldehyde = FluidUtils.getFluidStack("fluid.formaldehyde", 1).getFluid(); - mMethane = FluidUtils.getFluidStack("methane", 1).getFluid(); - mBenzene = FluidUtils.getFluidStack("benzene", 1).getFluid(); - mEthylbenzene = FluidUtils.getFluidStack("fluid.ethylbenzene", 1).getFluid(); - mStyrene = FluidUtils.getFluidStack("styrene", 1).getFluid(); - mMethanol = FluidUtils.getFluidStack("methanol", 1).getFluid(); - mLiquidPlastic = FluidUtils.getWildcardFluidStack("plastic", 1).getFluid(); - mCarbonDioxide = MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(1).getFluid(); - mCarbonMonoxide = MISC_MATERIALS.CARBON_MONOXIDE.getFluidStack(1).getFluid(); - mChlorine = FluidUtils.getFluidStack("chlorine", 1).getFluid(); - mHydrogen = FluidUtils.getFluidStack("hydrogen", 1).getFluid(); - mAceticAcid = AgrichemFluids.mAceticAcid; - mPropionicAcid = AgrichemFluids.mPropionicAcid; - mUrea = AgrichemFluids.mUrea; - mLiquidResin = AgrichemFluids.mLiquidResin; - mFermentationBase = AgrichemFluids.mFermentationBase; - mButanol = AgrichemFluids.mButanol; - mAcetone = AgrichemFluids.mAcetone; - } - - private static void recipeAlgaeBiomass() { - - // TODO - // Add in recipes to get initial Biomass - - recipeGreenAlgae(); - recipeBrownAlgae(); - recipeGoldenBrownAlgae(); - recipeRedAlgae(); - recipeWoodPellets(); - recipeWoodBricks(); - recipeCellulosePulp(); - recipeCatalystCarrier(); - recipeAluminiumSilverCatalyst(); - recipeAceticAcid(); - recipePropionicAcid(); - recipeFermentationBase(); - recipeEthanol(); - recipeCelluloseFibre(); - recipeGoldenBrownCelluloseFiber(); - recipeRedCelluloseFiber(); - recipeSodiumHydroxide(); - recipeSodiumCarbonate(); - recipePelletMold(); - recipeAluminiumPellet(); - recipeAlumina(); - recipeAluminium(); - recipeCalciumCarbonate(); - recipeLithiumChloride(); - recipeAlginicAcid(); - recipeSulfuricAcid(); - recipeUrea(); - recipeRawBioResin(); - recipeLiquidResin(); - recipeCompost(); - recipeMethane(); - recipeBenzene(); - recipeStyrene(); - registerFuels(); - } - - private static void registerFuels() { - - // Burnables - ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), 800); - ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), 4800); - - // Gas Fuels - //GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); - - //Combustion Fuels - GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 1), null, 400, 0); - - } - private static void recipeGreenAlgae() { - // Compost - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); - - // Turn into Cellulose - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getGreenAlgaeRecipeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), - 5 * 30, - 16); - - - } - - private static void recipeBrownAlgae() { - // Compost - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 2), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); - - // Alginic acid - CORE.RA.addExtractorRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), - 3 * 15, - 30); - - // Lithium Chloride - GT_Values.RA.addBlastRecipe( - getBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), - GT_Values.NF, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 5), - GT_Values.NI, - 120, - 120, - 1200); - - // Sodium Carbonate - CORE.RA.addChemicalRecipe( - getBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 40), - FluidUtils.getDistilledWater(2000), - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 20), - 20 * 30, - 30); - - } - - private static void recipeGoldenBrownAlgae() { - // Compost - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); - - // Turn into Cellulose - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getGoldenBrownAlgaeRecipeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 10) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), - 5 * 30, - 120); - - } - - private static void recipeRedAlgae() { - // Compost - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 2)); - - // Turn into Cellulose - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getRedAlgaeRecipeChip(), - ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 10) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), - 5 * 30, - 240); - - } - - private static void recipeCelluloseFibre() { - - CORE.RA.addChemicalRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 8), - ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), - GT_Values.NF, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 10), - 10 * 20, - 16); - - // Craft into Wood Pellets - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(2), - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 24), - 12 * 4, - 8); - - // Methanol Extraction - GT_Values.RA.addFluidExtractionRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), - GT_Values.NI, - FluidUtils.getFluidStack(mMethanol, 1000), - 10000, - 5 * 30, - 30); - - // Compost - GT_ModHandler.addPulverisationRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 3), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); - - // Plastic - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(16), - ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 500), - FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 500), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mLiquidPlastic, (1000)), - }, - 10 * 20, - 240, - 2); - - } - - private static void recipeWoodPellets() { - // Shapeless Recipe - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1) - }, ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2)); - - // Extruder Recipe - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), - ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 3), - 20 * 10, - 16); - - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(2), - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 8) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2), - 20 * 5, - 8); - - // CO2 - CORE.RA.addFluidExtractionRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), - FluidUtils.getFluidStack(mCarbonDioxide, 70), - 10*20, - 30); - - - // Add Charcoal Recipe - if (LoadedMods.Railcraft) { - RailcraftUtils.addCokeOvenRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), - true, - true, - ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), - GT_Values.NF, - 1200); - } - CORE.RA.addCokeOvenRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), - getBioChip(3), - null, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), - 120, - 16); - - } - - private static void recipeWoodBricks() { - - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(3), - ItemUtils.getOrePrefixStack(OrePrefixes.dust, Materials.Wood, 50) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), - 100 * 20, - 16); - } - - private static void recipeCellulosePulp() { - - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(2), - ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(Items.paper, 4), - 2 * 20, - 16); - } - - private static void recipeCatalystCarrier() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(20), - ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 4 : 2), - ItemUtils.getItemStackOfAmountFromOreDict("screwTin", GTNH ? 6 : 3) - }, - GT_Values.NF, - CI.getEmptyCatalyst(1), - 300 * 20, - 16); - } - - private static void recipeAluminiumSilverCatalyst() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(4), - CI.getEmptyCatalyst(10), - ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), - ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 4) - }, - GT_Values.NF, - CI.getGreenCatalyst(10), - 20 * 20, - 30); - } - - private static void recipeAceticAcid() { - - /* GT_Values.RA.addMixerRecipe( - CI.getGreenCatalyst(10), - var2, - var3, var4, - var5, // Fluid in - var6, // Fluid out - var7, // Item Out - var8, // Time - var9); // Eu - */ - - //CH4O + CO = C2H4O2 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getGreenCatalyst(0) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mMethanol, 700), - FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 700), - }, - new ItemStack[] { - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 700), - }, - 120 * 20, - 60, - 1); - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(14), - CI.emptyCells(1) - }, - FluidUtils.getFluidStack(mFermentationBase, 1000), - null, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellAceticAcid", 1) - }, - new int[] {10000, 10000}, - 60 * 20, - 16); - - } - - - - public final static HashSet<GT_ItemStack> mFruits = new HashSet<GT_ItemStack>(); - public final static HashSet<GT_ItemStack> mVege = new HashSet<GT_ItemStack>(); - public final static HashSet<GT_ItemStack> mNuts = new HashSet<GT_ItemStack>(); - public final static HashSet<GT_ItemStack> mSeeds = new HashSet<GT_ItemStack>(); - - public final static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); - public final static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); - - private static void processFermentationOreDict() { - processOreDictEntry("listAllfruit", mFruits); - processOreDictEntry("listAllFruit", mFruits); - processOreDictEntry("listAllveggie", mVege); - processOreDictEntry("listAllVeggie", mVege); - processOreDictEntry("listAllnut", mNuts); - processOreDictEntry("listAllNut", mNuts); - processOreDictEntry("listAllseed", mSeeds); - processOreDictEntry("listAllSeed", mSeeds); - - if (!mFruits.isEmpty()) { - for (GT_ItemStack g : mFruits) { - mList_Master_FruitVege.put(g.toStack()); - } - } - if (!mVege.isEmpty()) { - for (GT_ItemStack g : mVege) { - mList_Master_FruitVege.put(g.toStack()); - } - } - if (!mNuts.isEmpty()) { - for (GT_ItemStack g : mNuts) { - mList_Master_FruitVege.put(g.toStack()); - } - } - if (!mSeeds.isEmpty()) { - for (GT_ItemStack g : mSeeds) { - mList_Master_Seeds.put(g.toStack()); - } - } - } - - // Make Fermentation - private static void processOreDictEntry(String aOreName, HashSet<GT_ItemStack> mfruits2) { - ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName); - if (!aTemp.isEmpty()) { - for (ItemStack stack : aTemp) { - mfruits2.add(new GT_ItemStack(stack)); - } - } - } - - - private static void recipeFermentationBase() { - processFermentationOreDict(); - AutoMap<ItemStack> aFruitVege = mList_Master_FruitVege; - AutoMap<ItemStack> aSeeds = mList_Master_Seeds; - ArrayList<ItemStack> aMap = OreDictionary.getOres("cropSugarbeet"); - for (ItemStack a : aFruitVege) { - if (aMap.contains(a)) { - continue; - } - if (ItemUtils.checkForInvalidItems(a)) { - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(2), - ItemUtils.getSimpleStack(a, 10) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), - }, - 30 * 20, - 2, - 0); - } - - } - for (ItemStack a : aSeeds) { - if (ItemUtils.checkForInvalidItems(a)) { - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(3), - ItemUtils.getSimpleStack(a, 20) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), - }, - 30 * 20, - 2, - 0); - } - } - - // Sugar Cane - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(4), - ItemUtils.getSimpleStack(Items.reeds, 32) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), - }, - 30 * 20, - 30, - 0); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(5), - ItemUtils.getSimpleStack(Items.reeds, 32), - ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 2) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 2000), - }, - 10 * 20, - 30, - 0); - - // Sugar Beet - if (OreDictUtils.containsValidEntries("cropSugarbeet")) { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(4), - ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), - }, - 30 * 20, - 30, - 0); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(5), - ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 4), - ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 2) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 2000), - }, - 10 * 20, - 30, - 0); - } - - // Produce Acetone, Butanol and Ethanol - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(5), - ItemUtils.getItemStackOfAmountFromOreDict("cellFermentationBase", 48), - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 6), - ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 16), - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 18), - ItemUtils.getItemStackOfAmountFromOreDict("cellAcetone", 9), - ItemUtils.getItemStackOfAmountFromOreDict("cellEthanol", 3), - CI.emptyCells(18) - }, - new FluidStack[] { - - }, - 100 * 20, - 32, - 1); - - } - - private static void recipePropionicAcid() { - //C2H4 + CO + H2O = C3H6O2 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getGreenCatalyst(0) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthylene, 1000), - FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 1000), - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), - }, - new ItemStack[] { - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 1000), - }, - 10 * 20, - 60, - 1); - } - - private static void recipeEthanol() { - - CORE.RA.addDistilleryRecipe( - BioRecipes.getBioChip(2), - FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), - FluidUtils.getFluidStack(BioRecipes.mEthanol, 100), - null, - 20 * 20, - 60, - false); - - } - - private static void recipeGoldenBrownCelluloseFiber() { - CORE.RA.addFluidExtractionRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), - FluidUtils.getFluidStack(BioRecipes.mAmmonia, 500), - 10 * 30, - 120); - } - - private static void recipeRedCelluloseFiber() { - CORE.RA.addExtractorRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 3), - ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), - 3 * 30, - 240); - } - - private static void recipeSodiumHydroxide() { - //NaCl·H2O = NaOH + Cl + H - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(4) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mSalineWater, 1000), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 3) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mChlorine, 1000), - FluidUtils.getFluidStack(BioRecipes.mHydrogen, 1000), - }, - 300 * 20, - 120, - 1); - - //Na + H2O = NaOH + H - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(5), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 5) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 15) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mHydrogen, 5000), - }, - 60 * 20, - 60, - 1); - } - - private static void recipeSodiumCarbonate() { - - if (OreDictUtils.containsValidEntries("fuelCoke")) { - //Na2CO3 + Al2O3 =C= 2NaAlO2 + CO2 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(18), - ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 1), - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 6), - ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 5) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1000), - }, - 120 * 20, - 120, - 1); - - } - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(18), - ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 2), - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 6), - ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 5) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1000), - }, - 180 * 20, - 120, - 1); - - } - - private static void recipePelletMold() { - GregtechItemList.Pellet_Mold.set(ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 1)); - GT_Values.RA.addLatheRecipe( - ALLOY.TUMBAGA.getBlock(1), - GregtechItemList.Pellet_Mold.get(1), - null, - 20 * 30 * 15, - 90); - } - - private static void recipeAluminiumPellet() { - - // Ore Names, no prefix - AutoMap<String> aOreNames = new AutoMap<String>(); - - aOreNames.put("Lazurite"); - aOreNames.put("Bauxite"); - aOreNames.put("Grossular"); - aOreNames.put("Pyrope"); - aOreNames.put("Sodalite"); - aOreNames.put("Spodumene"); - aOreNames.put("Ruby"); - aOreNames.put("Sapphire"); - aOreNames.put("GreenSapphire"); - - // Voltage - HashMap<String, Integer> aOreData1 = new HashMap<String, Integer>(); - // Input Count - HashMap<String, Integer> aOreData2 = new HashMap<String, Integer>(); - // Output Count - HashMap<String, Integer> aOreData3 = new HashMap<String, Integer>(); - - aOreData1.put("Lazurite", 120); - aOreData1.put("Bauxite", 90); - aOreData1.put("Grossular", 90); - aOreData1.put("Pyrope", 90); - aOreData1.put("Sodalite", 90); - aOreData1.put("Spodumene", 90); - aOreData1.put("Ruby", 60); - aOreData1.put("Sapphire", 30); - aOreData1.put("GreenSapphire", 30); - aOreData2.put("Lazurite", 14); - aOreData2.put("Bauxite", 39); - aOreData2.put("Grossular", 20); - aOreData2.put("Pyrope", 20); - aOreData2.put("Sodalite", 11); - aOreData2.put("Spodumene", 10); - aOreData2.put("Ruby", 6); - aOreData2.put("Sapphire", 5); - aOreData2.put("GreenSapphire", 5); - aOreData3.put("Lazurite", 3); - aOreData3.put("Bauxite", 16); - aOreData3.put("Grossular", 2); - aOreData3.put("Pyrope", 2); - aOreData3.put("Sodalite", 3); - aOreData3.put("Spodumene", 1); - aOreData3.put("Ruby", 2); - aOreData3.put("Sapphire", 2); - aOreData3.put("GreenSapphire", 2); - - // Assemble all valid crushed ore types for making pellet mix - HashMap<String, ItemStack> aOreCache = new HashMap<String, ItemStack>(); - for (String aOreName : aOreNames) { - String aTemp = aOreName; - aOreName = "crushedPurified" + aOreName; - if (ItemUtils.doesOreDictHaveEntryFor(aOreName)) { - aOreCache.put(aTemp, ItemUtils.getItemStackOfAmountFromOreDict(aOreName, 1)); - } - } - - for (String aOreName : aOreNames) { - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(14), - ItemUtils.getSimpleStack(aOreCache.get(aOreName), aOreData2.get(aOreName)) - }, - new FluidStack[] { - FluidUtils.getSteam(2000 * aOreData2.get(aOreName)) - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mCleanAluminiumMix, (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) - }, - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 100 * (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) - }, - 20 * 60, - aOreData1.get(aOreName), - aOreName.equals("Bauxite") ? 2 : 1); - } - - GT_Values.RA.addExtruderRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mCleanAluminiumMix, 3), - ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), - ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 4), - 20 * 30, - 64); - } - - private static void recipeAlumina() { - //2NaAlO2 + 2NaOH + 2CO2 = Al2O3 + 2Na2CO3 + H2O - GT_Values.RA.addBlastRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8), - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 6), - FluidUtils.getFluidStack(mCarbonDioxide, 2000), - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 5), - ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 12), - 20 * 40, - 120, - 1200); - } - - private static void recipeAluminium() { - //2Al2O3 + 3C = 4Al + 3CO2 - GT_Values.RA.addBlastRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 10), - ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 3), - GT_Values.NF, - Materials.CarbonDioxide.getGas(3000), - ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), - null, - 20 * 120, - 120, - 1600); - } - - private static void recipeCalciumCarbonate() { - - } - - private static void recipeLithiumChloride() { - - if (OreDictUtils.containsValidEntries("dustRockSalt")) { - GT_Values.RA.addElectrolyzerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustRockSalt", 8), - ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 10), - FluidUtils.getFluidStack(BioRecipes.mAir, 4000), - FluidUtils.getFluidStack(BioRecipes.mChlorine, 500), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallPotassium", 5), - new int[] {7500, 8000, 8500, 9000, 7500, 8500}, - 60 * 30, - 60); - } - if (OreDictUtils.containsValidEntries("dustPotash")) { - GT_Values.RA.addElectrolyzerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustPotash", 10), - ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 16), - FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), - FluidUtils.getFluidStack(BioRecipes.mChlorine, 250), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 7), - ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), - new int[] {7500, 8000, 8500, 9000, 9000, 9000}, - 45 * 30, - 90); - } - - } - - private static void recipeAlginicAcid() { - - /*// Turn into Cellulose Pulp - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getBioChip(7), - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), - ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 5) - }, - GT_Values.NF, - ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 20), - 90 * 20, - 16);*/ - } - - private static void recipeSulfuricAcid() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(7), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 6) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 5000), - }, - 50 * 20, - 60, - 1); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(7), - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 2), - ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 5000), - }, - 6 * 20, - 180, - 3); - - } - - private static void recipeUrea() { - - //2NH3 + CO2 = CH4N2O + H2O - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(9), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mAmmonia, 600), - FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 300), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mUrea, 300), - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 300), - }, - 5 * 20, - 30, - 1); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(9), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mUrea, 200), - FluidUtils.getFluidStack(BioRecipes.mFormaldehyde, 200), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 200) - }, - 5 * 20, - 30, - 1); - } - - private static void recipeRawBioResin() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(3), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 5), - ItemUtils.getSimpleStack(Blocks.dirt, 1) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 100), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1), - }, - new FluidStack[] { - - }, - 1 * 20, - 30, - 1); - } - - private static void recipeLiquidResin() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(3), - ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthanol, 200), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 500), - }, - 5 * 20, - 30, - 1); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(3), - ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 8) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 144), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(Ic2Items.resin, 32) - }, - new FluidStack[] { - - }, - 60 * 20, - 30, - 1); - - - } - - private static void recipeCompost() { - ItemStack aFert; - if (LoadedMods.Forestry) { - aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertForestry, 32); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(11), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mUrea, 200), - }, - new ItemStack[] { - aFert - }, - new FluidStack[] { - - }, - 30 * 20, - 60, - 1); - } - - aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertIC2, 32); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(12), - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), - ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mUrea, 200), - }, - new ItemStack[] { - aFert - }, - new FluidStack[] { - - }, - 30 * 20, - 60, - 1); - - } - - private static void recipeMethane() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(12), - ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 10) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 500), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mMethane, 500), - }, - 5 * 20, - 64, - 1); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(13), - ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 8), - ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 6), - ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 4) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mMethane, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthylene, 2000), - }, - 10 * 20, - 60, - 1); - } - - private static void recipeBenzene() { - - //6CH4 = C6H6 + 18H - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(19), - CI.getGreenCatalyst(0), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mMethane, 6000), - }, - new ItemStack[] { - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mBenzene, 1000), - Materials.Hydrogen.getGas(18000) - }, - 8 * 20, - 120, - 2); - } - - private static void recipeStyrene() { - - //C8H10 = C8H8 + 2H - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getBioChip(20), - CI.getGreenCatalyst(0), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthylbenzene, 100), - }, - new ItemStack[] { - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mStyrene, 100), - Materials.Hydrogen.getGas(200) - }, - 16 * 20, - 480, - 2); - } - - private static void recipeBioChip() { - GT_ModHandler.addShapelessCraftingRecipe( - GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 0L), 0, new Object[]{OrePrefixes.circuit.get(Materials.Primitive)}); - - long bits = 0; - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, - new Object[]{"d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, - new Object[]{" d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, - new Object[]{" d", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, - new Object[]{" ", " Pd", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, - new Object[]{" ", " P ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, - new Object[]{" ", " P ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, - new Object[]{" ", " P ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, - new Object[]{" ", "dP ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, - new Object[]{"P d", " ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, - new Object[]{"P ", " d", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, - new Object[]{"P ", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, - new Object[]{"P ", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, - new Object[]{" P", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, - new Object[]{" P", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, - new Object[]{" P", " ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, - new Object[]{" P", "d ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, - new Object[]{" ", " ", "d P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, - new Object[]{" ", "d ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, - new Object[]{"d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, - new Object[]{" d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, - new Object[]{"d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, - new Object[]{" d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, - new Object[]{" d", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, - new Object[]{" ", " d", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); - } - - public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { - Method mAddRecipe = ReflectionUtils.getMethod(GT_ModHandler.class, "addCraftingRecipe", new Class[] { - ItemStack.class, Enchantment[].class, int[].class, - boolean.class, boolean.class, boolean.class, boolean.class, - boolean.class, boolean.class, boolean.class, boolean.class, - boolean.class, boolean.class, boolean.class, boolean.class, - boolean.class, Object[].class}); - boolean didInvoke = false; - if (mAddRecipe != null) { - try { - didInvoke = (boolean) mAddRecipe.invoke(null, aResult, - new Enchantment[] {}, - new int[] {}, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - aRecipe); - } - catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return didInvoke; - } - - + private static Item mFert; + private static Item mDustDirt; + + private static Fluid mSalineWater; + private static Fluid mDistilledWater; + private static Fluid mThermalWater; + private static Fluid mAir; + private static Fluid mSulfuricWasteWater; + private static Fluid mAmmonia; + private static Fluid mMethanol; + private static Fluid mAceticAcid; + private static Fluid mPropionicAcid; + private static Fluid mLiquidPlastic; + private static Fluid mFermentationBase; + private static Fluid mCarbonDioxide; + private static Fluid mCarbonMonoxide; + private static Fluid mEthylene; + private static Fluid mEthanol; + private static Fluid mChlorine; + private static Fluid mHydrogen; + private static Fluid mDilutedSulfuricAcid; + private static Fluid mSulfuricAcid; + private static Fluid mUrea; + public static Fluid mFormaldehyde; + private static Fluid mLiquidResin; + private static Fluid mMethane; + private static Fluid mBenzene; + private static Fluid mEthylbenzene; + private static Fluid mStyrene; + private static Fluid mButanol; + private static Fluid mAcetone; + + private static final ItemStack getGreenAlgaeRecipeChip() { + return getBioChip(4); + } + + private static final ItemStack getBrownAlgaeRecipeChip() { + return getBioChip(8); + } + + private static final ItemStack getGoldenBrownAlgaeRecipeChip() { + return getBioChip(12); + } + + private static final ItemStack getRedAlgaeRecipeChip() { + return getBioChip(16); + } + + private static final ItemStack getBioChip(int aID) { + return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, aID, 0); + } + + public static void init() { + Logger.INFO("[Bio] Setting Variables"); + initRecipeVars(); + Logger.INFO("[Bio] Generating Biochip Recipes"); + recipeBioChip(); + Logger.INFO("[Bio] Generating Recipes"); + recipeAlgaeBiomass(); + Logger.INFO("[Bio] Finished with recipes"); + } + + private static final void initRecipeVars() { + mFert = AgriculturalChem.dustOrganicFertilizer; + mDustDirt = AgriculturalChem.dustDirt; + + // 5.08 Salt Water Solution ;) + if (!FluidUtils.doesFluidExist("saltwater")) { + mSalineWater = + FluidUtils.generateFluidNoPrefix("saltwater", "Salt Water", 200, new short[] {10, 30, 220, 100}); + } else { + Materials aSaltWater = MaterialUtils.getMaterial("saltwater"); + if (aSaltWater != null) { + FluidStack aWaterStack = aSaltWater.getFluid(1); + if (aWaterStack != null) { + mSalineWater = aSaltWater.getFluid(1).getFluid(); + } + } + if (mSalineWater == null) { + mSalineWater = FluidUtils.getWildcardFluidStack("saltwater", 1).getFluid(); + } + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellSaltWater", 1) == null) { + new BaseItemComponent("saltwater", "Salt Water", new short[] {10, 30, 220}); + } + } + + mDistilledWater = FluidUtils.getDistilledWater(1).getFluid(); + mThermalWater = FluidUtils.getFluidStack("ic2hotwater", 1).getFluid(); + mAir = FluidUtils.getFluidStack("air", 1).getFluid(); + mSulfuricWasteWater = FluidUtils.getFluidStack("sulfuricapatite", 1).getFluid(); + mAmmonia = MISC_MATERIALS.AMMONIA.getFluidStack(1).getFluid(); + mEthylene = FluidUtils.getFluidStack("ethylene", 1).getFluid(); + mEthanol = FluidUtils.getFluidStack("bioethanol", 1).getFluid(); + mDilutedSulfuricAcid = + FluidUtils.getFluidStack("dilutedsulfuricacid", 1).getFluid(); + mSulfuricAcid = FluidUtils.getFluidStack("sulfuricacid", 1).getFluid(); + mFormaldehyde = FluidUtils.getFluidStack("fluid.formaldehyde", 1).getFluid(); + mMethane = FluidUtils.getFluidStack("methane", 1).getFluid(); + mBenzene = FluidUtils.getFluidStack("benzene", 1).getFluid(); + mEthylbenzene = FluidUtils.getFluidStack("fluid.ethylbenzene", 1).getFluid(); + mStyrene = FluidUtils.getFluidStack("styrene", 1).getFluid(); + mMethanol = FluidUtils.getFluidStack("methanol", 1).getFluid(); + mLiquidPlastic = FluidUtils.getWildcardFluidStack("plastic", 1).getFluid(); + mCarbonDioxide = MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(1).getFluid(); + mCarbonMonoxide = MISC_MATERIALS.CARBON_MONOXIDE.getFluidStack(1).getFluid(); + mChlorine = FluidUtils.getFluidStack("chlorine", 1).getFluid(); + mHydrogen = FluidUtils.getFluidStack("hydrogen", 1).getFluid(); + mAceticAcid = AgrichemFluids.mAceticAcid; + mPropionicAcid = AgrichemFluids.mPropionicAcid; + mUrea = AgrichemFluids.mUrea; + mLiquidResin = AgrichemFluids.mLiquidResin; + mFermentationBase = AgrichemFluids.mFermentationBase; + mButanol = AgrichemFluids.mButanol; + mAcetone = AgrichemFluids.mAcetone; + } + + private static void recipeAlgaeBiomass() { + + // TODO + // Add in recipes to get initial Biomass + + recipeGreenAlgae(); + recipeBrownAlgae(); + recipeGoldenBrownAlgae(); + recipeRedAlgae(); + recipeWoodPellets(); + recipeWoodBricks(); + recipeCellulosePulp(); + recipeCatalystCarrier(); + recipeAluminiumSilverCatalyst(); + recipeAceticAcid(); + recipePropionicAcid(); + recipeFermentationBase(); + recipeEthanol(); + recipeCelluloseFibre(); + recipeGoldenBrownCelluloseFiber(); + recipeRedCelluloseFiber(); + recipeSodiumHydroxide(); + recipeSodiumCarbonate(); + recipePelletMold(); + recipeAluminiumPellet(); + recipeAlumina(); + recipeAluminium(); + recipeCalciumCarbonate(); + recipeLithiumChloride(); + recipeAlginicAcid(); + recipeSulfuricAcid(); + recipeUrea(); + recipeRawBioResin(); + recipeLiquidResin(); + recipeCompost(); + recipeMethane(); + recipeBenzene(); + recipeStyrene(); + registerFuels(); + } + + private static void registerFuels() { + + // Burnables + ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), 800); + ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), 4800); + + // Gas Fuels + // GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); + + // Combustion Fuels + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 1), null, 400, 0); + } + + private static void recipeGreenAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + getGreenAlgaeRecipeChip(), ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), + 5 * 30, + 16); + } + + private static void recipeBrownAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 2), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Alginic acid + CORE.RA.addExtractorRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), + 3 * 15, + 30); + + // Lithium Chloride + GT_Values.RA.addBlastRecipe( + getBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 5), + GT_Values.NI, + 120, + 120, + 1200); + + // Sodium Carbonate + CORE.RA.addChemicalRecipe( + getBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 40), + FluidUtils.getDistilledWater(2000), + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 20), + 20 * 30, + 30); + } + + private static void recipeGoldenBrownAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + getGoldenBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 10) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), + 5 * 30, + 120); + } + + private static void recipeRedAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 2)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + getRedAlgaeRecipeChip(), ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 10) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), + 5 * 30, + 240); + } + + private static void recipeCelluloseFibre() { + + CORE.RA.addChemicalRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 8), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 10), + 10 * 20, + 16); + + // Craft into Wood Pellets + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] {getBioChip(2), ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12)}, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 24), + 12 * 4, + 8); + + // Methanol Extraction + GT_Values.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), + GT_Values.NI, + FluidUtils.getFluidStack(mMethanol, 1000), + 10000, + 5 * 30, + 30); + + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 3), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Plastic + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(16), ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 500), + FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 500), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidPlastic, (1000)), + }, + 10 * 20, + 240, + 2); + } + + private static void recipeWoodPellets() { + // Shapeless Recipe + RecipeUtils.addShapelessGregtechRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1) + }, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2)); + + // Extruder Recipe + GT_Values.RA.addExtruderRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), + ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 3), + 20 * 10, + 16); + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] {getBioChip(2), ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 8)}, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2), + 20 * 5, + 8); + + // CO2 + CORE.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + FluidUtils.getFluidStack(mCarbonDioxide, 70), + 10 * 20, + 30); + + // Add Charcoal Recipe + if (LoadedMods.Railcraft) { + RailcraftUtils.addCokeOvenRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), + true, + true, + ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), + GT_Values.NF, + 1200); + } + CORE.RA.addCokeOvenRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), + getBioChip(3), + null, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), + 120, + 16); + } + + private static void recipeWoodBricks() { + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] {getBioChip(3), ItemUtils.getOrePrefixStack(OrePrefixes.dust, Materials.Wood, 50)}, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), + 100 * 20, + 16); + } + + private static void recipeCellulosePulp() { + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] {getBioChip(2), ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4)}, + GT_Values.NF, + ItemUtils.getSimpleStack(Items.paper, 4), + 2 * 20, + 16); + } + + private static void recipeCatalystCarrier() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + getBioChip(20), + ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", GTNH ? 8 : 4), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 4 : 2), + ItemUtils.getItemStackOfAmountFromOreDict("screwTin", GTNH ? 6 : 3) + }, + GT_Values.NF, + CI.getEmptyCatalyst(1), + 300 * 20, + 16); + } + + private static void recipeAluminiumSilverCatalyst() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + getBioChip(4), + CI.getEmptyCatalyst(10), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 4) + }, + GT_Values.NF, + CI.getGreenCatalyst(10), + 20 * 20, + 30); + } + + private static void recipeAceticAcid() { + + /* GT_Values.RA.addMixerRecipe( + CI.getGreenCatalyst(10), + var2, + var3, var4, + var5, // Fluid in + var6, // Fluid out + var7, // Item Out + var8, // Time + var9); // Eu + */ + + // CH4O + CO = C2H4O2 + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {CI.getGreenCatalyst(0)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethanol, 700), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 700), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 700), + }, + 120 * 20, + 60, + 1); + + CORE.RA.addDehydratorRecipe( + new ItemStack[] {CI.getNumberedBioCircuit(14), CI.emptyCells(1)}, + FluidUtils.getFluidStack(mFermentationBase, 1000), + null, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellAceticAcid", 1) + }, + new int[] {10000, 10000}, + 60 * 20, + 16); + } + + public static final HashSet<GT_ItemStack> mFruits = new HashSet<GT_ItemStack>(); + public static final HashSet<GT_ItemStack> mVege = new HashSet<GT_ItemStack>(); + public static final HashSet<GT_ItemStack> mNuts = new HashSet<GT_ItemStack>(); + public static final HashSet<GT_ItemStack> mSeeds = new HashSet<GT_ItemStack>(); + + public static final AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); + public static final AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); + + private static void processFermentationOreDict() { + processOreDictEntry("listAllfruit", mFruits); + processOreDictEntry("listAllFruit", mFruits); + processOreDictEntry("listAllveggie", mVege); + processOreDictEntry("listAllVeggie", mVege); + processOreDictEntry("listAllnut", mNuts); + processOreDictEntry("listAllNut", mNuts); + processOreDictEntry("listAllseed", mSeeds); + processOreDictEntry("listAllSeed", mSeeds); + + if (!mFruits.isEmpty()) { + for (GT_ItemStack g : mFruits) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mVege.isEmpty()) { + for (GT_ItemStack g : mVege) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mNuts.isEmpty()) { + for (GT_ItemStack g : mNuts) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mSeeds.isEmpty()) { + for (GT_ItemStack g : mSeeds) { + mList_Master_Seeds.put(g.toStack()); + } + } + } + + // Make Fermentation + private static void processOreDictEntry(String aOreName, HashSet<GT_ItemStack> mfruits2) { + ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName); + if (!aTemp.isEmpty()) { + for (ItemStack stack : aTemp) { + mfruits2.add(new GT_ItemStack(stack)); + } + } + } + + private static void recipeFermentationBase() { + processFermentationOreDict(); + AutoMap<ItemStack> aFruitVege = mList_Master_FruitVege; + AutoMap<ItemStack> aSeeds = mList_Master_Seeds; + ArrayList<ItemStack> aMap = OreDictionary.getOres("cropSugarbeet"); + for (ItemStack a : aFruitVege) { + if (aMap.contains(a)) { + continue; + } + if (ItemUtils.checkForInvalidItems(a)) { + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(2), ItemUtils.getSimpleStack(a, 10)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + }, + 30 * 20, + 2, + 0); + } + } + for (ItemStack a : aSeeds) { + if (ItemUtils.checkForInvalidItems(a)) { + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(3), ItemUtils.getSimpleStack(a, 20)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + }, + 30 * 20, + 2, + 0); + } + } + + // Sugar Cane + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(4), ItemUtils.getSimpleStack(Items.reeds, 32)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + }, + 30 * 20, + 30, + 0); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getSimpleStack(Items.reeds, 32), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 2) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 2000), + }, + 10 * 20, + 30, + 0); + + // Sugar Beet + if (OreDictUtils.containsValidEntries("cropSugarbeet")) { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(4), ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + }, + 30 * 20, + 30, + 0); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 4), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 2) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 2000), + }, + 10 * 20, + 30, + 0); + } + + // Produce Acetone, Butanol and Ethanol + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("cellFermentationBase", 48), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 6), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 16), + }, + new FluidStack[] {}, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 18), + ItemUtils.getItemStackOfAmountFromOreDict("cellAcetone", 9), + ItemUtils.getItemStackOfAmountFromOreDict("cellEthanol", 3), + CI.emptyCells(18) + }, + new FluidStack[] {}, + 100 * 20, + 32, + 1); + } + + private static void recipePropionicAcid() { + // C2H4 + CO + H2O = C3H6O2 + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {CI.getGreenCatalyst(0)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylene, 1000), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 1000), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 1000), + }, + 10 * 20, + 60, + 1); + } + + private static void recipeEthanol() { + + CORE.RA.addDistilleryRecipe( + BioRecipes.getBioChip(2), + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + FluidUtils.getFluidStack(BioRecipes.mEthanol, 100), + null, + 20 * 20, + 60, + false); + } + + private static void recipeGoldenBrownCelluloseFiber() { + CORE.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 500), + 10 * 30, + 120); + } + + private static void recipeRedCelluloseFiber() { + CORE.RA.addExtractorRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 3), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), + 3 * 30, + 240); + } + + private static void recipeSodiumHydroxide() { + // NaCl·H2O = NaOH + Cl + H + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(4)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSalineWater, 1000), + }, + new ItemStack[] {ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 3)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mChlorine, 1000), + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 1000), + }, + 300 * 20, + 120, + 1); + + // Na + H2O = NaOH + H + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(5), ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 5)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), + }, + new ItemStack[] {ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 15)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 5000), + }, + 60 * 20, + 60, + 1); + } + + private static void recipeSodiumCarbonate() { + + if (OreDictUtils.containsValidEntries("fuelCoke")) { + // Na2CO3 + Al2O3 =C= 2NaAlO2 + CO2 + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(18), + ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 1), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 6), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 5) + }, + new FluidStack[] {}, + new ItemStack[] {ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1000), + }, + 120 * 20, + 120, + 1); + } + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(18), + ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 2), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 6), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 5) + }, + new FluidStack[] {}, + new ItemStack[] {ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1000), + }, + 180 * 20, + 120, + 1); + } + + private static void recipePelletMold() { + GregtechItemList.Pellet_Mold.set(ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 1)); + GT_Values.RA.addLatheRecipe( + ALLOY.TUMBAGA.getBlock(1), GregtechItemList.Pellet_Mold.get(1), null, 20 * 30 * 15, 90); + } + + private static void recipeAluminiumPellet() { + + // Ore Names, no prefix + AutoMap<String> aOreNames = new AutoMap<String>(); + + aOreNames.put("Lazurite"); + aOreNames.put("Bauxite"); + aOreNames.put("Grossular"); + aOreNames.put("Pyrope"); + aOreNames.put("Sodalite"); + aOreNames.put("Spodumene"); + aOreNames.put("Ruby"); + aOreNames.put("Sapphire"); + aOreNames.put("GreenSapphire"); + + // Voltage + HashMap<String, Integer> aOreData1 = new HashMap<String, Integer>(); + // Input Count + HashMap<String, Integer> aOreData2 = new HashMap<String, Integer>(); + // Output Count + HashMap<String, Integer> aOreData3 = new HashMap<String, Integer>(); + + aOreData1.put("Lazurite", 120); + aOreData1.put("Bauxite", 90); + aOreData1.put("Grossular", 90); + aOreData1.put("Pyrope", 90); + aOreData1.put("Sodalite", 90); + aOreData1.put("Spodumene", 90); + aOreData1.put("Ruby", 60); + aOreData1.put("Sapphire", 30); + aOreData1.put("GreenSapphire", 30); + aOreData2.put("Lazurite", 14); + aOreData2.put("Bauxite", 39); + aOreData2.put("Grossular", 20); + aOreData2.put("Pyrope", 20); + aOreData2.put("Sodalite", 11); + aOreData2.put("Spodumene", 10); + aOreData2.put("Ruby", 6); + aOreData2.put("Sapphire", 5); + aOreData2.put("GreenSapphire", 5); + aOreData3.put("Lazurite", 3); + aOreData3.put("Bauxite", 16); + aOreData3.put("Grossular", 2); + aOreData3.put("Pyrope", 2); + aOreData3.put("Sodalite", 3); + aOreData3.put("Spodumene", 1); + aOreData3.put("Ruby", 2); + aOreData3.put("Sapphire", 2); + aOreData3.put("GreenSapphire", 2); + + // Assemble all valid crushed ore types for making pellet mix + HashMap<String, ItemStack> aOreCache = new HashMap<String, ItemStack>(); + for (String aOreName : aOreNames) { + String aTemp = aOreName; + aOreName = "crushedPurified" + aOreName; + if (ItemUtils.doesOreDictHaveEntryFor(aOreName)) { + aOreCache.put(aTemp, ItemUtils.getItemStackOfAmountFromOreDict(aOreName, 1)); + } + } + + for (String aOreName : aOreNames) { + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + ItemUtils.getSimpleStack(aOreCache.get(aOreName), aOreData2.get(aOreName)) + }, + new FluidStack[] {FluidUtils.getSteam(2000 * aOreData2.get(aOreName))}, + new ItemStack[] { + ItemUtils.getSimpleStack( + AgriculturalChem.mCleanAluminiumMix, (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) + }, + new FluidStack[] { + FluidUtils.getFluidStack( + AgriculturalChem.RedMud, 100 * (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) + }, + 20 * 60, + aOreData1.get(aOreName), + aOreName.equals("Bauxite") ? 2 : 1); + } + + GT_Values.RA.addExtruderRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCleanAluminiumMix, 3), + ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 4), + 20 * 30, + 64); + } + + private static void recipeAlumina() { + // 2NaAlO2 + 2NaOH + 2CO2 = Al2O3 + 2Na2CO3 + H2O + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 8), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 6), + FluidUtils.getFluidStack(mCarbonDioxide, 2000), + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 5), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 12), + 20 * 40, + 120, + 1200); + } + + private static void recipeAluminium() { + // 2Al2O3 + 3C = 4Al + 3CO2 + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 10), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 3), + GT_Values.NF, + Materials.CarbonDioxide.getGas(3000), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + null, + 20 * 120, + 120, + 1600); + } + + private static void recipeCalciumCarbonate() {} + + private static void recipeLithiumChloride() { + + if (OreDictUtils.containsValidEntries("dustRockSalt")) { + GT_Values.RA.addElectrolyzerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustRockSalt", 8), + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 10), + FluidUtils.getFluidStack(BioRecipes.mAir, 4000), + FluidUtils.getFluidStack(BioRecipes.mChlorine, 500), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallPotassium", 5), + new int[] {7500, 8000, 8500, 9000, 7500, 8500}, + 60 * 30, + 60); + } + if (OreDictUtils.containsValidEntries("dustPotash")) { + GT_Values.RA.addElectrolyzerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustPotash", 10), + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 16), + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + FluidUtils.getFluidStack(BioRecipes.mChlorine, 250), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 7), + ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), + new int[] {7500, 8000, 8500, 9000, 9000, 9000}, + 45 * 30, + 90); + } + } + + private static void recipeAlginicAcid() { + + /*// Turn into Cellulose Pulp + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 5) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 20), + 90 * 20, + 16);*/ + } + + private static void recipeSulfuricAcid() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 6) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 5000), + }, + 50 * 20, + 60, + 1); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 2), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 5000), + }, + 6 * 20, + 180, + 3); + } + + private static void recipeUrea() { + + // 2NH3 + CO2 = CH4N2O + H2O + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 600), + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 300), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 300), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 300), + }, + 5 * 20, + 30, + 1); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 200), + FluidUtils.getFluidStack(BioRecipes.mFormaldehyde, 200), + }, + new ItemStack[] {}, + new FluidStack[] {FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 200)}, + 5 * 20, + 30, + 1); + } + + private static void recipeRawBioResin() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 5), + ItemUtils.getSimpleStack(Blocks.dirt, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 100), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1), + }, + new FluidStack[] {}, + 1 * 20, + 30, + 1); + } + + private static void recipeLiquidResin() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(3), ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthanol, 200), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 500), + }, + 5 * 20, + 30, + 1); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(3), ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 8)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 144), + }, + new ItemStack[] {ItemUtils.getSimpleStack(Ic2Items.resin, 32)}, + new FluidStack[] {}, + 60 * 20, + 30, + 1); + } + + private static void recipeCompost() { + ItemStack aFert; + if (LoadedMods.Forestry) { + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertForestry, 32); + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(11), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 200), + }, + new ItemStack[] {aFert}, + new FluidStack[] {}, + 30 * 20, + 60, + 1); + } + + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertIC2, 32); + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(12), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 200), + }, + new ItemStack[] {aFert}, + new FluidStack[] {}, + 30 * 20, + 60, + 1); + } + + private static void recipeMethane() { + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] {getBioChip(12), ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 10)}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 500), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 500), + }, + 5 * 20, + 64, + 1); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(13), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 8), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 6), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 4) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 2000), + }, + new ItemStack[] {}, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylene, 2000), + }, + 10 * 20, + 60, + 1); + } + + private static void recipeBenzene() { + + // 6CH4 = C6H6 + 18H + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(19), CI.getGreenCatalyst(0), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 6000), + }, + new ItemStack[] {}, + new FluidStack[] {FluidUtils.getFluidStack(BioRecipes.mBenzene, 1000), Materials.Hydrogen.getGas(18000) + }, + 8 * 20, + 120, + 2); + } + + private static void recipeStyrene() { + + // C8H10 = C8H8 + 2H + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + getBioChip(20), CI.getGreenCatalyst(0), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylbenzene, 100), + }, + new ItemStack[] {}, + new FluidStack[] {FluidUtils.getFluidStack(BioRecipes.mStyrene, 100), Materials.Hydrogen.getGas(200)}, + 16 * 20, + 480, + 2); + } + + private static void recipeBioChip() { + GT_ModHandler.addShapelessCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 0L), + 0, + new Object[] {OrePrefixes.circuit.get(Materials.Primitive)}); + + long bits = 0; + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, new Object[] { + "d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, new Object[] { + " d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, new Object[] { + " d", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, new Object[] { + " ", " Pd", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, new Object[] { + " ", " P ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, new Object[] { + " ", " P ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, new Object[] { + " ", " P ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, new Object[] { + " ", "dP ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, new Object[] { + "P d", " ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, new Object[] { + "P ", " d", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, new Object[] { + "P ", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, new Object[] { + "P ", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, new Object[] { + " P", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, new Object[] { + " P", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, new Object[] { + " P", " ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, new Object[] { + " P", "d ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, new Object[] { + " ", " ", "d P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, new Object[] { + " ", "d ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, new Object[] { + "d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, new Object[] { + " d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, new Object[] { + "d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, new Object[] { + " d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, new Object[] { + " d", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + addCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, new Object[] { + " ", " d", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0]) + }); + } + + public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { + Method mAddRecipe = ReflectionUtils.getMethod(GT_ModHandler.class, "addCraftingRecipe", new Class[] { + ItemStack.class, + Enchantment[].class, + int[].class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + boolean.class, + Object[].class + }); + boolean didInvoke = false; + if (mAddRecipe != null) { + try { + didInvoke = (boolean) mAddRecipe.invoke( + null, + aResult, + new Enchantment[] {}, + new int[] {}, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + aRecipe); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return didInvoke; + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java index 4cf31e9335..923f1698d1 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java @@ -1,70 +1,58 @@ package gtPlusPlus.plugin.agrichem; -import java.util.List; - import gtPlusPlus.api.interfaces.IPlugin; -import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.plugin.agrichem.fluids.FluidLoader; -import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; -import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; -import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; import gtPlusPlus.plugin.manager.Core_Manager; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; public class Core_Agrichem implements IPlugin { - final static Core_Agrichem mInstance; - - - static { - mInstance = new Core_Agrichem(); - Core_Manager.registerPlugin(mInstance); - mInstance.log("Preparing "+mInstance.getPluginName()+" for use."); - } - - @Override - public boolean preInit() { - mInstance.log("Generating Fluids"); - FluidLoader.generate(); - AgrichemFluids.init(); - mInstance.log("Generating Items"); - return true; - } - - @Override - public boolean init() { - mInstance.log("Setting Items"); - return true; - } - - @Override - public boolean postInit() { - mInstance.log("Generating Recipes"); - return true; - } - - @Override - public boolean serverStart() { - return true; - } - - @Override - public boolean serverStop() { - return true; - } - - @Override - public String getPluginName() { - return "GT++ Agrichemistry Module"; - } - - @Override - public String getPluginAbbreviation() { - return "FARM"; - } - + static final Core_Agrichem mInstance; + + static { + mInstance = new Core_Agrichem(); + Core_Manager.registerPlugin(mInstance); + mInstance.log("Preparing " + mInstance.getPluginName() + " for use."); + } + + @Override + public boolean preInit() { + mInstance.log("Generating Fluids"); + FluidLoader.generate(); + AgrichemFluids.init(); + mInstance.log("Generating Items"); + return true; + } + + @Override + public boolean init() { + mInstance.log("Setting Items"); + return true; + } + + @Override + public boolean postInit() { + mInstance.log("Generating Recipes"); + return true; + } + + @Override + public boolean serverStart() { + return true; + } + + @Override + public boolean serverStop() { + return true; + } + + @Override + public String getPluginName() { + return "GT++ Agrichemistry Module"; + } + + @Override + public String getPluginAbbreviation() { + return "FARM"; + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/IAlgalItem.java b/src/main/java/gtPlusPlus/plugin/agrichem/IAlgalItem.java index fada07d062..995734a05b 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/IAlgalItem.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/IAlgalItem.java @@ -5,8 +5,7 @@ import net.minecraft.item.ItemStack; public interface IAlgalItem { - public abstract AlgaeDefinition getAlgaeType(ItemStack aStack); - - public abstract AlgaeGeneticData getSpeciesData(ItemStack aStack); - + public abstract AlgaeDefinition getAlgaeType(ItemStack aStack); + + public abstract AlgaeGeneticData getSpeciesData(ItemStack aStack); } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java b/src/main/java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java index 039dd702da..8f3ef7a5e6 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java @@ -6,83 +6,76 @@ import net.minecraftforge.fluids.FluidRegistry; public class AgrichemFluids { - /* - * Saline Water - saltwater - * Sulfuric Waste Water - sulfuricapatite - * Methanol - methanol - * Hot Water - ic2hotwater - * Acetic Acid - * Propionic Acid - * Fermentation Base - * Ethylene - ethylene - * Ethanol - bioethanol - * Diluted SA - filutedsulfuricacid - * Sulfuric Acid - sulfuricacid - * Urea - * Formaldehyde - fluid.formaldehyde - * Liquid Resin - * Methane - methane - * Benzene - benzene - * Ethylbenzene - fluid.ethylbenzene - * Styrene - styrene - */ + /* + * Saline Water - saltwater + * Sulfuric Waste Water - sulfuricapatite + * Methanol - methanol + * Hot Water - ic2hotwater + * Acetic Acid + * Propionic Acid + * Fermentation Base + * Ethylene - ethylene + * Ethanol - bioethanol + * Diluted SA - filutedsulfuricacid + * Sulfuric Acid - sulfuricacid + * Urea + * Formaldehyde - fluid.formaldehyde + * Liquid Resin + * Methane - methane + * Benzene - benzene + * Ethylbenzene - fluid.ethylbenzene + * Styrene - styrene + */ - public static Fluid mAceticAcid; - public static Fluid mPropionicAcid; - public static Fluid mFermentationBase; - public static Fluid mUrea; - public static Fluid mLiquidResin; - public static Fluid mAcetone; - public static Fluid mButanol; - - - - public static void init() { - if (!FluidRegistry.isFluidRegistered("aceticacid")) { - mAceticAcid = FluidUtils.generateFluidNoPrefix("aceticacid", "Acetic Acid", 200, new short[] { 97, 168, 96, 100 }, true); - } - else { - mAceticAcid = FluidRegistry.getFluid("aceticacid"); - } - if (!FluidRegistry.isFluidRegistered("propionicacid")) { - mPropionicAcid = FluidUtils.generateFluidNoPrefix("propionicacid", "Propionic Acid", 200, new short[] { 198, 209, 148, 100 }, true); - } - else { - mPropionicAcid = FluidRegistry.getFluid("propionicacid"); - } - if (!FluidRegistry.isFluidRegistered("fermentation.base")) { - mFermentationBase = FluidUtils.generateFluidNoPrefix("fermentation.base", "Fermentation Base", 200, new short[] { 107, 100, 63, 100 }, true); - } - else { - mFermentationBase = FluidRegistry.getFluid("fermentation.base"); - } - if (!FluidRegistry.isFluidRegistered("ureamix")) { - mUrea = FluidUtils.generateFluidNoPrefix("ureamix", "Urea Mix", 200, new short[] { 71, 55, 12, 100 }, true); - } - else { - mUrea = FluidRegistry.getFluid("ureamix"); - } - if (!FluidRegistry.isFluidRegistered("liquidresin")) { - mLiquidResin = FluidUtils.generateFluidNoPrefix("liquidresin", "Liquid Resin", 200, new short[] { 59, 58, 56, 100 }, true); - } - else { - mLiquidResin = FluidRegistry.getFluid("liquidresin"); - } - - if (!FluidRegistry.isFluidRegistered("acetone")) { - mAcetone = FluidUtils.generateFluidNoPrefix("acetone", "Acetone", 200, new short[] { 59, 58, 56, 100 }, true); - } - else { - mAcetone = FluidRegistry.getFluid("acetone"); - } - if (!FluidRegistry.isFluidRegistered("butanol")) { - mButanol = FluidUtils.generateFluidNoPrefix("butanol", "Butanol", 200, new short[] { 159, 58, 56, 100 }, true); - } - else { - mButanol = FluidRegistry.getFluid("butanol"); - } - } - - - + public static Fluid mAceticAcid; + public static Fluid mPropionicAcid; + public static Fluid mFermentationBase; + public static Fluid mUrea; + public static Fluid mLiquidResin; + public static Fluid mAcetone; + public static Fluid mButanol; + + public static void init() { + if (!FluidRegistry.isFluidRegistered("aceticacid")) { + mAceticAcid = FluidUtils.generateFluidNoPrefix( + "aceticacid", "Acetic Acid", 200, new short[] {97, 168, 96, 100}, true); + } else { + mAceticAcid = FluidRegistry.getFluid("aceticacid"); + } + if (!FluidRegistry.isFluidRegistered("propionicacid")) { + mPropionicAcid = FluidUtils.generateFluidNoPrefix( + "propionicacid", "Propionic Acid", 200, new short[] {198, 209, 148, 100}, true); + } else { + mPropionicAcid = FluidRegistry.getFluid("propionicacid"); + } + if (!FluidRegistry.isFluidRegistered("fermentation.base")) { + mFermentationBase = FluidUtils.generateFluidNoPrefix( + "fermentation.base", "Fermentation Base", 200, new short[] {107, 100, 63, 100}, true); + } else { + mFermentationBase = FluidRegistry.getFluid("fermentation.base"); + } + if (!FluidRegistry.isFluidRegistered("ureamix")) { + mUrea = FluidUtils.generateFluidNoPrefix("ureamix", "Urea Mix", 200, new short[] {71, 55, 12, 100}, true); + } else { + mUrea = FluidRegistry.getFluid("ureamix"); + } + if (!FluidRegistry.isFluidRegistered("liquidresin")) { + mLiquidResin = FluidUtils.generateFluidNoPrefix( + "liquidresin", "Liquid Resin", 200, new short[] {59, 58, 56, 100}, true); + } else { + mLiquidResin = FluidRegistry.getFluid("liquidresin"); + } + + if (!FluidRegistry.isFluidRegistered("acetone")) { + mAcetone = FluidUtils.generateFluidNoPrefix("acetone", "Acetone", 200, new short[] {59, 58, 56, 100}, true); + } else { + mAcetone = FluidRegistry.getFluid("acetone"); + } + if (!FluidRegistry.isFluidRegistered("butanol")) { + mButanol = + FluidUtils.generateFluidNoPrefix("butanol", "Butanol", 200, new short[] {159, 58, 56, 100}, true); + } else { + mButanol = FluidRegistry.getFluid("butanol"); + } + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java b/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java index a60a8c09de..24a0d5fb8f 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java @@ -3,19 +3,17 @@ package gtPlusPlus.plugin.agrichem.fluids; import gtPlusPlus.core.fluids.FluidFactory; public class FluidLoader { - - private static final int ID_DIRTY_WATER = 50; - private static final int ID_RAW_SEWERAGE = 51; - private static final int ID_GUANO = 52; - private static final int ID_POOPJUICE = 53; - - public static void generate() { - FluidFactory.generate(ID_DIRTY_WATER, "dirtywater", new short[] {25, 25, 180}); - FluidFactory.generate(ID_RAW_SEWERAGE, "sewerage", new short[] {100, 45, 25}); - FluidFactory.generate(ID_GUANO, "guano", new short[] {175, 175, 180}); - FluidFactory.generate(ID_POOPJUICE, "poo", new short[] {75, 45, 10}); - - } - + private static final int ID_DIRTY_WATER = 50; + private static final int ID_RAW_SEWERAGE = 51; + private static final int ID_GUANO = 52; + private static final int ID_POOPJUICE = 53; + + public static void generate() { + + FluidFactory.generate(ID_DIRTY_WATER, "dirtywater", new short[] {25, 25, 180}); + FluidFactory.generate(ID_RAW_SEWERAGE, "sewerage", new short[] {100, 45, 25}); + FluidFactory.generate(ID_GUANO, "guano", new short[] {175, 175, 180}); + FluidFactory.generate(ID_POOPJUICE, "poo", new short[] {75, 45, 10}); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java index abeebc054d..cd0007bf02 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java @@ -1,15 +1,14 @@ package gtPlusPlus.plugin.agrichem.item.algae; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.OreDictUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; @@ -25,288 +24,269 @@ import net.minecraftforge.oredict.OreDictionary; public class ItemAgrichemBase extends Item { - final protected IIcon base[]; - - /* - * 0 - Algae Biomass - * 1 - Green Algae Biomass - * 2 - Brown Algae Biomass - * 3 - Golden-Brown Algae Biomass - * 4 - Red Algae Biomass - * 5 - Cellulose Fiber - * 6 - Golden-Brown Cellulose Fiber - * 7 - Red Cellulose Fiber - * 8 - Compost - * 9 - Wood Pellet - * 10 - Wood Brick - * 11 - Cellulose Pulp - * 12 - Raw Bio Resin - * 13 - Catalyst Carrier - * 14 - Green Metal Catalyst - * 15 - Alginic Acid - * 16 - Alumina - * 17 - Aluminium Pellet - * 18 - Sodium Aluminate - * 19 - Sodium Hydroxide // Exists in Newer GT - * 20 - Sodium Carbonate - * 21 - Lithium Chloride - * 22 - Pellet Mold - * 23 - Clean Aluminium Mix - * 24 - Pinecone - * 25 - Crushed Pine - */ - - public ItemAgrichemBase() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - base = new IIcon[26]; - this.setUnlocalizedName("BasicAgrichemItem"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return false; - } - - private static boolean mHasCheckedForSodiumHydroxide = false; - private static boolean mShowSodiumHydroxide = true; - - private static boolean checkSodiumHydroxide() { - if (mHasCheckedForSodiumHydroxide) { - return mShowSodiumHydroxide; - } - else { - if (OreDictUtils.containsValidEntries("dustSodiumHydroxide_GT5U") - || OreDictUtils.containsValidEntries("dustSodiumHydroxide")) { - List<ItemStack> aTest = OreDictionary.getOres( - "dustSodiumHydroxide", false - ); - if (aTest.isEmpty()) { - aTest = OreDictionary.getOres( - "dustSodiumHydroxide_GT5U", false - ); - if (!aTest.isEmpty()) { - mShowSodiumHydroxide = false; - } - } - else { - mShowSodiumHydroxide = false; - } - } - } - mHasCheckedForSodiumHydroxide = true; - return mShowSodiumHydroxide; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int i=0;i<base.length;i++) { - if (i == 19) { - // Only show if it doesn't exist. - if (checkSodiumHydroxide()) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - else { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - for (int i=0;i<this.base.length;i++) { - String aPath = CORE.MODID + ":" + "bioscience/MetaItem1/"+i; - this.base[i] = u.registerIcon(aPath); - } - } - - - private boolean isTextureValid(String aPath) { - if (aPath == null) { - return false; - } - else if (aPath.indexOf(92) == -1) { - Constructor aTextureAtlasSprite = ReflectionUtils.getConstructor( - TextureAtlasSprite.class, String.class - ); - if (aTextureAtlasSprite != null) { - try { - TextureAtlasSprite aTestAtlas = (TextureAtlasSprite) aTextureAtlasSprite.newInstance( - aPath - ); - if (aTestAtlas != null) { - return true; - } - } - catch (InstantiationException | IllegalAccessException - | IllegalArgumentException - | InvocationTargetException e) { - } - } - } - return false; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base[damage]; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base[damage]; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base[stack.getItemDamage()]; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base[stack.getItemDamage()]; - } - - @Override + protected final IIcon base[]; + + /* + * 0 - Algae Biomass + * 1 - Green Algae Biomass + * 2 - Brown Algae Biomass + * 3 - Golden-Brown Algae Biomass + * 4 - Red Algae Biomass + * 5 - Cellulose Fiber + * 6 - Golden-Brown Cellulose Fiber + * 7 - Red Cellulose Fiber + * 8 - Compost + * 9 - Wood Pellet + * 10 - Wood Brick + * 11 - Cellulose Pulp + * 12 - Raw Bio Resin + * 13 - Catalyst Carrier + * 14 - Green Metal Catalyst + * 15 - Alginic Acid + * 16 - Alumina + * 17 - Aluminium Pellet + * 18 - Sodium Aluminate + * 19 - Sodium Hydroxide // Exists in Newer GT + * 20 - Sodium Carbonate + * 21 - Lithium Chloride + * 22 - Pellet Mold + * 23 - Clean Aluminium Mix + * 24 - Pinecone + * 25 - Crushed Pine + */ + + public ItemAgrichemBase() { + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + base = new IIcon[26]; + this.setUnlocalizedName("BasicAgrichemItem"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate( + ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.common; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return false; + } + + private static boolean mHasCheckedForSodiumHydroxide = false; + private static boolean mShowSodiumHydroxide = true; + + private static boolean checkSodiumHydroxide() { + if (mHasCheckedForSodiumHydroxide) { + return mShowSodiumHydroxide; + } else { + if (OreDictUtils.containsValidEntries("dustSodiumHydroxide_GT5U") + || OreDictUtils.containsValidEntries("dustSodiumHydroxide")) { + List<ItemStack> aTest = OreDictionary.getOres("dustSodiumHydroxide", false); + if (aTest.isEmpty()) { + aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false); + if (!aTest.isEmpty()) { + mShowSodiumHydroxide = false; + } + } else { + mShowSodiumHydroxide = false; + } + } + } + mHasCheckedForSodiumHydroxide = true; + return mShowSodiumHydroxide; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i = 0; i < base.length; i++) { + if (i == 19) { + // Only show if it doesn't exist. + if (checkSodiumHydroxide()) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } else { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + for (int i = 0; i < this.base.length; i++) { + String aPath = CORE.MODID + ":" + "bioscience/MetaItem1/" + i; + this.base[i] = u.registerIcon(aPath); + } + } + + private boolean isTextureValid(String aPath) { + if (aPath == null) { + return false; + } else if (aPath.indexOf(92) == -1) { + Constructor aTextureAtlasSprite = ReflectionUtils.getConstructor(TextureAtlasSprite.class, String.class); + if (aTextureAtlasSprite != null) { + try { + TextureAtlasSprite aTestAtlas = (TextureAtlasSprite) aTextureAtlasSprite.newInstance(aPath); + if (aTestAtlas != null) { + return true; + } + } catch (InstantiationException + | IllegalAccessException + | IllegalArgumentException + | InvocationTargetException e) { + } + } + } + return false; + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return this.base[damage]; + } + + @Override + public IIcon getIconFromDamage(int damage) { + return this.base[damage]; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return this.base[stack.getItemDamage()]; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.base[stack.getItemDamage()]; + } + + @Override public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @Override + public double getDurabilityForDisplay(ItemStack aStack) { + if (ItemUtils.isCatalyst(aStack)) { + if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { + createCatalystNBT(aStack); + } + double currentDamage = getCatalystDamage(aStack); + return currentDamage / getCatalystMaxDamage(aStack); + } else { + return 1D; + } + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) { + boolean aHasSpecialTooltips = false; + int aMaxDamage = 0; + int aDamageSegment = 0; + int aDam = 0; + EnumChatFormatting durability = EnumChatFormatting.GRAY; + if (ItemUtils.isCatalyst(aStack)) { + list.add(EnumChatFormatting.GRAY + "Active Reaction Agent"); + aMaxDamage = getCatalystMaxDamage(aStack); + aDamageSegment = aMaxDamage / 5; + aDam = aMaxDamage - getCatalystDamage(aStack); + aHasSpecialTooltips = true; + } + if (aHasSpecialTooltips) { + if (aDam > aDamageSegment * 3) { + durability = EnumChatFormatting.GREEN; + } else if (aDam > aDamageSegment * 2) { + durability = EnumChatFormatting.YELLOW; + } else if (aDam > aDamageSegment) { + durability = EnumChatFormatting.GOLD; + } else if (aDam >= 0) { + durability = EnumChatFormatting.RED; + } + list.add(durability + "" + (aDam) + EnumChatFormatting.GRAY + " / " + aMaxDamage); + } + super.addInformation(aStack, player, list, bool); + } + + @Override + public boolean showDurabilityBar(ItemStack aStack) { + if (ItemUtils.isCatalyst(aStack)) { + int aDam = getCatalystDamage(aStack); + return aDam > 0; + } + return false; + } + + public static boolean createCatalystNBT(ItemStack rStack) { + return ItemGenericChemBase.createCatalystNBT(rStack); + } + + public static int getCatalystDamage(ItemStack aStack) { + return ItemGenericChemBase.getCatalystDamage(aStack); + } + + public static int getCatalystMaxDamage(ItemStack aStack) { + return ItemGenericChemBase.getCatalystMaxDamage(aStack); + } + + public static void setCatalystDamage(ItemStack aStack, int aAmount) { + ItemGenericChemBase.setCatalystDamage(aStack, aAmount); } - - - - @Override - public double getDurabilityForDisplay(ItemStack aStack) { - if (ItemUtils.isCatalyst(aStack)) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){ - createCatalystNBT(aStack); - } - double currentDamage = getCatalystDamage(aStack); - return currentDamage / getCatalystMaxDamage(aStack); - } - else { - return 1D; - } - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) { - boolean aHasSpecialTooltips = false; - int aMaxDamage = 0; - int aDamageSegment = 0; - int aDam = 0; - EnumChatFormatting durability = EnumChatFormatting.GRAY; - if (ItemUtils.isCatalyst(aStack)) { - list.add(EnumChatFormatting.GRAY+"Active Reaction Agent"); - aMaxDamage = getCatalystMaxDamage(aStack); - aDamageSegment = aMaxDamage / 5; - aDam = aMaxDamage-getCatalystDamage(aStack); - aHasSpecialTooltips = true; - } - if (aHasSpecialTooltips) { - if (aDam > aDamageSegment * 3){ - durability = EnumChatFormatting.GREEN; - } - else if (aDam > aDamageSegment * 2){ - durability = EnumChatFormatting.YELLOW; - } - else if (aDam > aDamageSegment){ - durability = EnumChatFormatting.GOLD; - } - else if (aDam >= 0){ - durability = EnumChatFormatting.RED; - } - list.add(durability+""+(aDam)+EnumChatFormatting.GRAY+" / "+aMaxDamage); - } - super.addInformation(aStack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack aStack) { - if (ItemUtils.isCatalyst(aStack)) { - int aDam = getCatalystDamage(aStack); - return aDam > 0; - } - return false; - } - - public static boolean createCatalystNBT(ItemStack rStack){ - return ItemGenericChemBase.createCatalystNBT(rStack); - } - - public static int getCatalystDamage(ItemStack aStack) { - return ItemGenericChemBase.getCatalystDamage(aStack); - } - - public static int getCatalystMaxDamage(ItemStack aStack) { - return ItemGenericChemBase.getCatalystMaxDamage(aStack); - } - - public static void setCatalystDamage(ItemStack aStack,int aAmount) { - ItemGenericChemBase.setCatalystDamage(aStack, aAmount); - } - - public static int getMaxCatalystDurability(ItemStack aStack) { - return ItemGenericChemBase.getMaxCatalystDurability(aStack); - } + public static int getMaxCatalystDurability(ItemStack aStack) { + return ItemGenericChemBase.getMaxCatalystDurability(aStack); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java index 6b31a42809..89c8447b84 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java @@ -1,7 +1,5 @@ package gtPlusPlus.plugin.agrichem.item.algae; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; @@ -10,6 +8,7 @@ import gtPlusPlus.plugin.agrichem.AlgaeDefinition; import gtPlusPlus.plugin.agrichem.IAlgalItem; import gtPlusPlus.plugin.agrichem.logic.AlgaeGeneticData; import gtPlusPlus.plugin.agrichem.logic.AlgaeGrowthRequirement; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -24,212 +23,203 @@ import net.minecraft.world.World; public class ItemAlgaeBase extends Item implements IAlgalItem { - protected IIcon base; - protected IIcon overlay; - - public ItemAlgaeBase() { - this.setHasSubtypes(true); - this.setMaxDamage(127); - this.setNoRepair(); - this.setMaxStackSize(32); - this.setUnlocalizedName("BasicAlgaeItem"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - if (!p_77663_1_.hasTagCompound() || p_77663_1_.getTagCompound().hasNoTags()) { - p_77663_1_ = initNBT(p_77663_1_); - } - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return EnumChatFormatting.UNDERLINE+super.getItemStackDisplayName(aStack); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - int aDam = aStack.getItemDamage(); - try { - aList.add(AlgaeDefinition.getByIndex(aDam).mSimpleName); - if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { - aStack = initNBT(aStack); - } - else { - NBTTagCompound aNBT = aStack.getTagCompound(); - boolean mRequiresLight = aNBT.getBoolean("mRequiresLight"); - boolean mSaltWater = aNBT.getBoolean("mSaltWater"); - boolean mFreshWater = aNBT.getBoolean("mFreshWater"); - byte mTempTolerance = aNBT.getByte("mTempTolerance"); - float mFertility = aNBT.getFloat("mFertility"); - float mProductionSpeed = aNBT.getFloat("mProductionSpeed"); - byte mLifespan = aNBT.getByte("mLifespan"); - int mGeneration = aNBT.getInteger("mGeneration"); - - aList.add("Requires Light: "+mRequiresLight); - aList.add("Salt Water: "+mSaltWater); - aList.add("Fresh Water: "+mFreshWater); - aList.add("Temp Tolerance: "+mTempTolerance); - aList.add("Growth: "+mFertility); - aList.add("Production: "+mProductionSpeed); - aList.add("Lifespan in days: "+mLifespan); - aList.add("Generation: "+mGeneration); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.uncommon; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int i=0;i<AlgaeDefinition.values().length;i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public int getColorFromItemStack(ItemStack aStack, int aMeta) { - return AlgaeDefinition.getByIndex(aStack.getItemDamage()).mColour; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if(pass == 0) { - return this.base; - } - return this.overlay; - } - - @Override - public void registerIcons(final IIconRegister i) { - this.base = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae"); - this.overlay = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae" + "_Overlay"); - } - - public static ItemStack initNBT(ItemStack aFreshAlgae) { - NBTTagCompound aNewTag = new NBTTagCompound(); - ItemAlgaeBase aItem; - if (aFreshAlgae.getItem() instanceof ItemAlgaeBase) { - aItem = (ItemAlgaeBase) aFreshAlgae.getItem(); - if (!aFreshAlgae.hasTagCompound()) { - AlgaeGeneticData y = aItem.getSpeciesData(aFreshAlgae); - aNewTag = y.writeToNBT(); - aFreshAlgae.setTagCompound(aNewTag); - } - else { - aNewTag = aFreshAlgae.getTagCompound(); - } - } - return aFreshAlgae; - } - - @Override - public AlgaeDefinition getAlgaeType(ItemStack aStack) { - return AlgaeDefinition.getByIndex(aStack != null ? aStack.getItemDamage() : 3); - } - - @Override - public AlgaeGeneticData getSpeciesData(ItemStack aStack) { - NBTTagCompound aTag; - if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { - aTag = new NBTTagCompound(); - AlgaeGeneticData aGenes; - if (aStack.getItemDamage() < 3 || aStack.getItemDamage() > 5) { - aGenes = new AlgaeGeneticData(); - aTag = aGenes.writeToNBT(); - } - else { - byte aTemp, aLifespan; - float aFert, aSpeed; - - int aDam = aStack.getItemDamage(); - aTemp = (byte) (aDam == 3 ? 0 : aDam == 4 ? 2 : 1); - aLifespan = (byte) (aDam == 3 ? 1 : aDam == 4 ? 3f : 2f); - aFert = (float) (aDam == 3 ? 2f : aDam == 4 ? 1f : 1.75f); - aSpeed = (float) (aDam == 3 ? 1f : aDam == 4 ? 1.5f : 2f); - - aGenes = new AlgaeGeneticData( - true, true, - AlgaeDefinition.getByIndex(aDam).mSaltWater, AlgaeDefinition.getByIndex(aDam).mFreshWater, - aTemp, - aFert, - aSpeed, - aLifespan, - 0, - new AutoMap<AlgaeGrowthRequirement>()); - aTag = aGenes.writeToNBT(); - } - } - else { - aTag = aStack.getTagCompound(); - } - - - - - return new AlgaeGeneticData(aTag); - } - - - - + protected IIcon base; + protected IIcon overlay; + + public ItemAlgaeBase() { + this.setHasSubtypes(true); + this.setMaxDamage(127); + this.setNoRepair(); + this.setMaxStackSize(32); + this.setUnlocalizedName("BasicAlgaeItem"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate( + ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + if (!p_77663_1_.hasTagCompound() || p_77663_1_.getTagCompound().hasNoTags()) { + p_77663_1_ = initNBT(p_77663_1_); + } + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return EnumChatFormatting.UNDERLINE + super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + int aDam = aStack.getItemDamage(); + try { + aList.add(AlgaeDefinition.getByIndex(aDam).mSimpleName); + if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { + aStack = initNBT(aStack); + } else { + NBTTagCompound aNBT = aStack.getTagCompound(); + boolean mRequiresLight = aNBT.getBoolean("mRequiresLight"); + boolean mSaltWater = aNBT.getBoolean("mSaltWater"); + boolean mFreshWater = aNBT.getBoolean("mFreshWater"); + byte mTempTolerance = aNBT.getByte("mTempTolerance"); + float mFertility = aNBT.getFloat("mFertility"); + float mProductionSpeed = aNBT.getFloat("mProductionSpeed"); + byte mLifespan = aNBT.getByte("mLifespan"); + int mGeneration = aNBT.getInteger("mGeneration"); + + aList.add("Requires Light: " + mRequiresLight); + aList.add("Salt Water: " + mSaltWater); + aList.add("Fresh Water: " + mFreshWater); + aList.add("Temp Tolerance: " + mTempTolerance); + aList.add("Growth: " + mFertility); + aList.add("Production: " + mProductionSpeed); + aList.add("Lifespan in days: " + mLifespan); + aList.add("Generation: " + mGeneration); + } + } catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.uncommon; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i = 0; i < AlgaeDefinition.values().length; i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public int getColorFromItemStack(ItemStack aStack, int aMeta) { + return AlgaeDefinition.getByIndex(aStack.getItemDamage()).mColour; + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + if (pass == 0) { + return this.base; + } + return this.overlay; + } + + @Override + public void registerIcons(final IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae"); + this.overlay = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae" + "_Overlay"); + } + + public static ItemStack initNBT(ItemStack aFreshAlgae) { + NBTTagCompound aNewTag = new NBTTagCompound(); + ItemAlgaeBase aItem; + if (aFreshAlgae.getItem() instanceof ItemAlgaeBase) { + aItem = (ItemAlgaeBase) aFreshAlgae.getItem(); + if (!aFreshAlgae.hasTagCompound()) { + AlgaeGeneticData y = aItem.getSpeciesData(aFreshAlgae); + aNewTag = y.writeToNBT(); + aFreshAlgae.setTagCompound(aNewTag); + } else { + aNewTag = aFreshAlgae.getTagCompound(); + } + } + return aFreshAlgae; + } + + @Override + public AlgaeDefinition getAlgaeType(ItemStack aStack) { + return AlgaeDefinition.getByIndex(aStack != null ? aStack.getItemDamage() : 3); + } + + @Override + public AlgaeGeneticData getSpeciesData(ItemStack aStack) { + NBTTagCompound aTag; + if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { + aTag = new NBTTagCompound(); + AlgaeGeneticData aGenes; + if (aStack.getItemDamage() < 3 || aStack.getItemDamage() > 5) { + aGenes = new AlgaeGeneticData(); + aTag = aGenes.writeToNBT(); + } else { + byte aTemp, aLifespan; + float aFert, aSpeed; + + int aDam = aStack.getItemDamage(); + aTemp = (byte) (aDam == 3 ? 0 : aDam == 4 ? 2 : 1); + aLifespan = (byte) (aDam == 3 ? 1 : aDam == 4 ? 3f : 2f); + aFert = (float) (aDam == 3 ? 2f : aDam == 4 ? 1f : 1.75f); + aSpeed = (float) (aDam == 3 ? 1f : aDam == 4 ? 1.5f : 2f); + + aGenes = new AlgaeGeneticData( + true, + true, + AlgaeDefinition.getByIndex(aDam).mSaltWater, + AlgaeDefinition.getByIndex(aDam).mFreshWater, + aTemp, + aFert, + aSpeed, + aLifespan, + 0, + new AutoMap<AlgaeGrowthRequirement>()); + aTag = aGenes.writeToNBT(); + } + } else { + aTag = aStack.getTagCompound(); + } + + return new AlgaeGeneticData(aTag); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java index f876839f5f..7e4c68b2f4 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java @@ -1,9 +1,5 @@ package gtPlusPlus.plugin.agrichem.item.algae; -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Predicate; - import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; @@ -16,6 +12,9 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.util.*; +import java.util.function.BiFunction; +import java.util.function.Predicate; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -32,207 +31,230 @@ import net.minecraftforge.common.util.FakePlayer; import org.apache.commons.lang3.tuple.Pair; public class ItemBioChip extends Item implements INetworkUpdatableItem { - private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); - - protected IIcon base; - - public ItemBioChip() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - this.setUnlocalizedName("BioRecipeSelector"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - ALL_VARIANTS.add(new ItemStack(this, 0, 0)); - for (int i = 1; i <= 24; i++) { - ItemStack aStack = new ItemStack(this, 0, i); - ALL_VARIANTS.add(aStack); - } - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - try { - aList.add("Configuration == "+aStack.getItemDamage()); - aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.0").toString(), "Right click to reconfigure")); - aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.1").toString(), "Needs a screwdriver or circuit programming tool")); - } - catch (Throwable t) { - t.printStackTrace(); - } - super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1)); - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - this.base = u.registerIcon(CORE.MODID + ":" + "bioscience/BioCircuit"); - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base; - } - - @Override + private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); + + protected IIcon base; + + public ItemBioChip() { + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + this.setUnlocalizedName("BioRecipeSelector"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + ALL_VARIANTS.add(new ItemStack(this, 0, 0)); + for (int i = 1; i <= 24; i++) { + ItemStack aStack = new ItemStack(this, 0, i); + ALL_VARIANTS.add(aStack); + } + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate( + ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + try { + aList.add("Configuration == " + aStack.getItemDamage()); + aList.add(GT_LanguageManager.addStringLocalization( + new StringBuilder() + .append(getUnlocalizedName()) + .append(".tooltip.0") + .toString(), + "Right click to reconfigure")); + aList.add(GT_LanguageManager.addStringLocalization( + new StringBuilder() + .append(getUnlocalizedName()) + .append(".tooltip.1") + .toString(), + "Needs a screwdriver or circuit programming tool")); + } catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.common; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1)); + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + this.base = u.registerIcon(CORE.MODID + ":" + "bioscience/BioCircuit"); + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return this.base; + } + + @Override + public IIcon getIconFromDamage(int damage) { + return this.base; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return this.base; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.base; + } + + @Override public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(); - } - - @Override - public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) { - int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1; - if (meta < 0 || meta > 24) - return true; - - if (!player.capabilities.isCreativeMode) { - Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> toolIndex = findConfiguratorInInv(player); - if (toolIndex == null) return true; - - ItemStack[] mainInventory = player.inventory.mainInventory; - mainInventory[toolIndex.getKey()] = toolIndex.getValue().apply(mainInventory[toolIndex.getKey()], player); - } - stack.setItemDamage(meta); - - return true; - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { - // nothing on server side or fake player - if (player instanceof FakePlayer || !world.isRemote) return false; - // check if any screwdriver - ItemStack configuratorStack; - if (player.capabilities.isCreativeMode) { - configuratorStack = null; - } else { - Pair<Integer, ?> configurator = findConfiguratorInInv(player); - if (configurator == null) { - int count; - try { - count = Integer.parseInt(StatCollector.translateToLocal("GT5U.item.programmed_circuit.no_screwdriver.count")); - } catch (NumberFormatException e) { - player.addChatComponentMessage(new ChatComponentText("Error in translation GT5U.item.programmed_circuit.no_screwdriver.count: " + e.getMessage())); - count = 1; - } - player.addChatComponentMessage(new ChatComponentTranslation("GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count))); - return false; - } - configuratorStack = player.inventory.mainInventory[configurator.getKey()]; - } - openSelectorGui(configuratorStack, stack.getItemDamage()); - return true; - } - - private void openSelectorGui(ItemStack configurator, int meta) { - FMLCommonHandler.instance().showGuiScreen(new GT_GUIDialogSelectItem( - StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"), - configurator, - null, - ItemBioChip::onConfigured, - ALL_VARIANTS, - meta, - true - )); - } - - private static void onConfigured(ItemStack stack) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setByte("meta", (byte) stack.getItemDamage()); - GT_Values.NW.sendToServer(new GT_Packet_UpdateItem(tag)); - } - - private static Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> findConfiguratorInInv(EntityPlayer player) { - ItemStack[] mainInventory = player.inventory.mainInventory; - for (int j = 0, mainInventoryLength = mainInventory.length; j < mainInventoryLength; j++) { - ItemStack toolStack = mainInventory[j]; - - if (!GT_Utility.isStackValid(toolStack)) - continue; - - for (Map.Entry<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> p : GregTech_API.sCircuitProgrammerList.entrySet()) - if (p.getKey().test(toolStack)) - return Pair.of(j, p.getValue()); - } - return null; - } + return super.getUnlocalizedName(); + } + + @Override + public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) { + int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1; + if (meta < 0 || meta > 24) return true; + + if (!player.capabilities.isCreativeMode) { + Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> toolIndex = findConfiguratorInInv(player); + if (toolIndex == null) return true; + + ItemStack[] mainInventory = player.inventory.mainInventory; + mainInventory[toolIndex.getKey()] = toolIndex.getValue().apply(mainInventory[toolIndex.getKey()], player); + } + stack.setItemDamage(meta); + + return true; + } + + @Override + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float xOffset, + float yOffset, + float zOffset) { + // nothing on server side or fake player + if (player instanceof FakePlayer || !world.isRemote) return false; + // check if any screwdriver + ItemStack configuratorStack; + if (player.capabilities.isCreativeMode) { + configuratorStack = null; + } else { + Pair<Integer, ?> configurator = findConfiguratorInInv(player); + if (configurator == null) { + int count; + try { + count = Integer.parseInt( + StatCollector.translateToLocal("GT5U.item.programmed_circuit.no_screwdriver.count")); + } catch (NumberFormatException e) { + player.addChatComponentMessage(new ChatComponentText( + "Error in translation GT5U.item.programmed_circuit.no_screwdriver.count: " + + e.getMessage())); + count = 1; + } + player.addChatComponentMessage(new ChatComponentTranslation( + "GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count))); + return false; + } + configuratorStack = player.inventory.mainInventory[configurator.getKey()]; + } + openSelectorGui(configuratorStack, stack.getItemDamage()); + return true; + } + + private void openSelectorGui(ItemStack configurator, int meta) { + FMLCommonHandler.instance() + .showGuiScreen(new GT_GUIDialogSelectItem( + StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"), + configurator, + null, + ItemBioChip::onConfigured, + ALL_VARIANTS, + meta, + true)); + } + + private static void onConfigured(ItemStack stack) { + NBTTagCompound tag = new NBTTagCompound(); + tag.setByte("meta", (byte) stack.getItemDamage()); + GT_Values.NW.sendToServer(new GT_Packet_UpdateItem(tag)); + } + + private static Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> findConfiguratorInInv( + EntityPlayer player) { + ItemStack[] mainInventory = player.inventory.mainInventory; + for (int j = 0, mainInventoryLength = mainInventory.length; j < mainInventoryLength; j++) { + ItemStack toolStack = mainInventory[j]; + + if (!GT_Utility.isStackValid(toolStack)) continue; + + for (Map.Entry<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> p : + GregTech_API.sCircuitProgrammerList.entrySet()) + if (p.getKey().test(toolStack)) return Pair.of(j, p.getValue()); + } + return null; + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java b/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java index dfe0f50b47..3e0bbafeeb 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java @@ -4,127 +4,133 @@ import gtPlusPlus.api.objects.data.AutoMap; import net.minecraft.nbt.NBTTagCompound; public class AlgaeGeneticData { - - private final int mLifespan; - - private final int mGeneration; - - private final boolean mIsDominant; - - private final boolean mRequiresLight; - - private final boolean mSaltWater; - - private final boolean mFreshWater; - - private final byte mTempTolerance; - - private final float mFertility; - - private final float mProductionSpeed; - - private final AutoMap<AlgaeGrowthRequirement> mSpecialRequirements; - - - public AlgaeGeneticData() { - this(true, true, true, true, (byte) 0, 1f, 1f, (byte) 30, 0, new AutoMap<AlgaeGrowthRequirement>()); - } - - public AlgaeGeneticData(boolean isDominant, boolean requiresLight, boolean isSalt, boolean isFresh, - byte aTempTolerance, float aFertility, float aSpeed, byte aLifespan, int aGeneration, AutoMap<AlgaeGrowthRequirement> aRequirements) { - mIsDominant = isDominant; - mRequiresLight = requiresLight; - mSaltWater = isSalt; - mFreshWater = isFresh; - mTempTolerance = aTempTolerance; - mFertility = aFertility; - mProductionSpeed = aSpeed; - mLifespan = aLifespan; - mGeneration = aGeneration; - mSpecialRequirements = aRequirements; - } - - - public AlgaeGeneticData(NBTTagCompound aNBT) { - if (aNBT == null || aNBT.hasNoTags()) { - mIsDominant = true; - mRequiresLight = true; - mSaltWater = true; - mFreshWater = true; - mTempTolerance = 0; - mFertility = 1; - mProductionSpeed = 1; - mLifespan = 30; - mGeneration = 0; - } - else { - mIsDominant = aNBT.getBoolean("mIsDominant"); - mRequiresLight = aNBT.getBoolean("mRequiresLight"); - mSaltWater = aNBT.getBoolean("mSaltWater"); - mFreshWater = aNBT.getBoolean("mFreshWater"); - mTempTolerance = aNBT.getByte("mTempTolerance"); - mFertility = aNBT.getFloat("mFertility"); - mProductionSpeed = aNBT.getFloat("mProductionSpeed"); - mLifespan = aNBT.getByte("mLifespan"); - mGeneration = aNBT.getInteger("mGeneration"); - } - mSpecialRequirements = new AutoMap<AlgaeGrowthRequirement>(); - } - - /** - * In MC Days - */ - public final int getLifespan() { - return this.mLifespan; - } - - public final boolean isDominant() { - return this.mIsDominant; - } - - public final boolean RequiresLight() { - return this.mRequiresLight; - } - - public final boolean isSaltWater() { - return this.mSaltWater; - } - - public final boolean isFreshWater() { - return this.mFreshWater; - } - - public final byte getTempTolerance() { - return this.mTempTolerance; - } - - public final float getFertility() { - return this.mFertility; - } - - public final float getProductionSpeed() { - return this.mProductionSpeed; - } - - public final int getGeneration() { - return this.mGeneration; - } - - public final AutoMap<AlgaeGrowthRequirement> getSpecialRequirements() { - return this.mSpecialRequirements; - } - - public NBTTagCompound writeToNBT() { - NBTTagCompound aGenes = new NBTTagCompound(); - aGenes.setBoolean("mIsDominant", this.mIsDominant); - aGenes.setBoolean("mRequiresLight", this.mRequiresLight); - aGenes.setBoolean("mSaltWater", this.mSaltWater); - aGenes.setBoolean("mFreshWater", this.mFreshWater); - aGenes.setInteger("mLifespan", this.mLifespan); - aGenes.setInteger("mGeneration", this.mGeneration); - aGenes.setByte("mTempTolerance", this.mTempTolerance); - aGenes.setFloat("mFertility", this.mFertility); - aGenes.setFloat("mProductionSpeed", this.mProductionSpeed); - return aGenes; - } + + private final int mLifespan; + + private final int mGeneration; + + private final boolean mIsDominant; + + private final boolean mRequiresLight; + + private final boolean mSaltWater; + + private final boolean mFreshWater; + + private final byte mTempTolerance; + + private final float mFertility; + + private final float mProductionSpeed; + + private final AutoMap<AlgaeGrowthRequirement> mSpecialRequirements; + + public AlgaeGeneticData() { + this(true, true, true, true, (byte) 0, 1f, 1f, (byte) 30, 0, new AutoMap<AlgaeGrowthRequirement>()); + } + + public AlgaeGeneticData( + boolean isDominant, + boolean requiresLight, + boolean isSalt, + boolean isFresh, + byte aTempTolerance, + float aFertility, + float aSpeed, + byte aLifespan, + int aGeneration, + AutoMap<AlgaeGrowthRequirement> aRequirements) { + mIsDominant = isDominant; + mRequiresLight = requiresLight; + mSaltWater = isSalt; + mFreshWater = isFresh; + mTempTolerance = aTempTolerance; + mFertility = aFertility; + mProductionSpeed = aSpeed; + mLifespan = aLifespan; + mGeneration = aGeneration; + mSpecialRequirements = aRequirements; + } + + public AlgaeGeneticData(NBTTagCompound aNBT) { + if (aNBT == null || aNBT.hasNoTags()) { + mIsDominant = true; + mRequiresLight = true; + mSaltWater = true; + mFreshWater = true; + mTempTolerance = 0; + mFertility = 1; + mProductionSpeed = 1; + mLifespan = 30; + mGeneration = 0; + } else { + mIsDominant = aNBT.getBoolean("mIsDominant"); + mRequiresLight = aNBT.getBoolean("mRequiresLight"); + mSaltWater = aNBT.getBoolean("mSaltWater"); + mFreshWater = aNBT.getBoolean("mFreshWater"); + mTempTolerance = aNBT.getByte("mTempTolerance"); + mFertility = aNBT.getFloat("mFertility"); + mProductionSpeed = aNBT.getFloat("mProductionSpeed"); + mLifespan = aNBT.getByte("mLifespan"); + mGeneration = aNBT.getInteger("mGeneration"); + } + mSpecialRequirements = new AutoMap<AlgaeGrowthRequirement>(); + } + + /** + * In MC Days + */ + public final int getLifespan() { + return this.mLifespan; + } + + public final boolean isDominant() { + return this.mIsDominant; + } + + public final boolean RequiresLight() { + return this.mRequiresLight; + } + + public final boolean isSaltWater() { + return this.mSaltWater; + } + + public final boolean isFreshWater() { + return this.mFreshWater; + } + + public final byte getTempTolerance() { + return this.mTempTolerance; + } + + public final float getFertility() { + return this.mFertility; + } + + public final float getProductionSpeed() { + return this.mProductionSpeed; + } + + public final int getGeneration() { + return this.mGeneration; + } + + public final AutoMap<AlgaeGrowthRequirement> getSpecialRequirements() { + return this.mSpecialRequirements; + } + + public NBTTagCompound writeToNBT() { + NBTTagCompound aGenes = new NBTTagCompound(); + aGenes.setBoolean("mIsDominant", this.mIsDominant); + aGenes.setBoolean("mRequiresLight", this.mRequiresLight); + aGenes.setBoolean("mSaltWater", this.mSaltWater); + aGenes.setBoolean("mFreshWater", this.mFreshWater); + aGenes.setInteger("mLifespan", this.mLifespan); + aGenes.setInteger("mGeneration", this.mGeneration); + aGenes.setByte("mTempTolerance", this.mTempTolerance); + aGenes.setFloat("mFertility", this.mFertility); + aGenes.setFloat("mProductionSpeed", this.mProductionSpeed); + return aGenes; + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java b/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java index 6bddc9d085..0c8c0c816f 100644 --- a/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java +++ b/src/main/java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java @@ -1,5 +1,3 @@ package gtPlusPlus.plugin.agrichem.logic; -public class AlgaeGrowthRequirement { - -} +public class AlgaeGrowthRequirement {} |