diff options
author | Martin Robertz <dream-master@gmx.net> | 2021-12-12 19:09:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 19:09:46 +0100 |
commit | 896143b96132f5ac54aa8d8f7386f27487e5e530 (patch) | |
tree | d61c1bced93b36545873414562b1dfd80718f496 /src/Java/gregtech/api | |
parent | 9cbfc7a1bacdbe908632e0fff9ec5ad7f119e563 (diff) | |
parent | 35585d4556d85a1a9cda33cdd39b5b257e3e5215 (diff) | |
download | GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.tar.gz GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.tar.bz2 GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.zip |
Merge pull request #50 from GTNewHorizons/gtnh-milling
Milling/Nuclear Sciences revamp + Lots of minor fixes
Diffstat (limited to 'src/Java/gregtech/api')
-rw-r--r-- | src/Java/gregtech/api/util/GTPP_Recipe.java | 18 | ||||
-rw-r--r-- | src/Java/gregtech/api/util/GasSpargingRecipe.java | 99 | ||||
-rw-r--r-- | src/Java/gregtech/api/util/GasSpargingRecipeMap.java | 48 |
3 files changed, 159 insertions, 6 deletions
diff --git a/src/Java/gregtech/api/util/GTPP_Recipe.java b/src/Java/gregtech/api/util/GTPP_Recipe.java index bcbbb93007..1d04e8af6e 100644 --- a/src/Java/gregtech/api/util/GTPP_Recipe.java +++ b/src/Java/gregtech/api/util/GTPP_Recipe.java @@ -328,7 +328,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { */ public static final Collection<GTPP_Recipe_Map> sMappings = new ArrayList<>(); //public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gtpp.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); - public static final GTPP_Recipe_Map_Internal sCokeOvenRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 2, 1, 0, 1, E, 1, E, true, true); + public static final GTPP_Recipe_Map_Internal sCokeOvenRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 1, 0, 1, E, 1, E, true, true); public static final GTPP_Recipe_Map_Internal sMatterFab2Recipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.matterfab2", "Matter Fabricator", null, RES_PATH_GUI + "basicmachines/Default", 9, 9, 0, 0, 1, E, 1, E, true, true); //public static final Gregtech_Recipe_Map sMatterFabRecipes = new Gregtech_Recipe_Map(new HashSet<GregtechRecipe>(200), "gtpp.recipe.matterfab", "Matter Fabricator", null, RES_PATH_GUI + "basicmachines/Massfabricator", 1, 3, 1, 1, 1, E, 1, E, true, true); @@ -341,22 +341,27 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { public static final GTPP_Recipe_Map_Internal sSteamTurbineFuels = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10), "gtpp.recipe.steamturbinefuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); //LFTR recipes - public static final GTPP_Recipe_Map_Internal sLiquidFluorineThoriumReactorRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(50), "gtpp.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); - public static final GTPP_Recipe_Map_Internal sLiquidFluorineThoriumReactorRecipesEx = new GTPP_Recipe_Map_Internal(new NoConflictGTRecipeMap(), "gtpp.recipe.lftr.2", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); + public static final GTPP_Recipe_Map_Internal sLiquidFluorineThoriumReactorRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(50), "gtpp.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 2, 0, "Power: ", 1, " EU/t per Dynamo", true, true); // Ore Milling Map public static final GTPP_Recipe_Map_Internal sOreMillRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10000), "gtpp.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 3, 4, 1, 0, 1, E, 1, E, true, false); //Fission Fuel Plant Recipes public static final GTPP_Recipe_Map_Internal sFissionFuelProcessing = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(50), "gtpp.recipe.fissionfuel", "Nuclear Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 0, 1, E, 1, E, true, false); - + + //Cold Trap + public static final GTPP_Recipe_Map_Internal sColdTrapRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10000), "gtpp.recipe.coldtrap", "Cold Trap", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); + + //Reactor Processing Unit + public static final GTPP_Recipe_Map_Internal sReactorProcessingUnitRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10000), "gtpp.recipe.reactorprocessingunit", "Reactor Processing Unit", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); + //Basic Washer Map public static final GTPP_Recipe_Map_Internal sSimpleWasherRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(3), "gtpp.recipe.simplewasher", "Simple Dust Washer", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, true); //public static final GT_Recipe_Map sSimpleWasherRecipes_FakeFuckBW = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gtpp.recipe.simplewasher", "Fuck you Bart", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, false); - public static final GTPP_Recipe_Map sChemicalPlantRecipes = new GTPP_Recipe_Map( - new HashSet<GTPP_Recipe>(100), + public static final GTPP_Recipe_Map_Internal sChemicalPlantRecipes = new GTPP_Recipe_Map_Internal( + new HashSet<GT_Recipe>(100), "gtpp.recipe.fluidchemicaleactor", "Chemical Plant", null, @@ -402,6 +407,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { //Special Maps for Multis public static final GTPP_Recipe_Map_Internal sFishPondRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(3), "gtpp.recipe.fishpond", "Zhuhai - Fishing Port", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 0, 1, 0, 0, 1, "Requires Circuit: ", 1, ".", true, true); + public static final GTPP_Recipe_Map_Internal sSpargeTowerRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10000), "gtpp.recipe.spargetower", "Sparging", null, RES_PATH_GUI + "basicmachines/FissionFuel", 9, 9, 0, 0, 1, E, 1, E, true, false); //public static final GTPP_Recipe_Map sMultiblockCentrifugeRecipes = new GT_Recipe_Map_LargeCentrifuge(); //public static final GTPP_Recipe_Map sMultiblockElectrolyzerRecipes = new GT_Recipe_Map_LargeElectrolyzer(); diff --git a/src/Java/gregtech/api/util/GasSpargingRecipe.java b/src/Java/gregtech/api/util/GasSpargingRecipe.java new file mode 100644 index 0000000000..493c31dc65 --- /dev/null +++ b/src/Java/gregtech/api/util/GasSpargingRecipe.java @@ -0,0 +1,99 @@ +package gregtech.api.util; + +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.data.ArrayUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import net.minecraftforge.fluids.FluidStack; + +public class GasSpargingRecipe implements Comparable<GasSpargingRecipe> { + + public final FluidStack mInputGas; + public final FluidStack mInputSpentFuel; + public final FluidStack mOutputSpargedFuel; + public final int[] mMaxOutputQuantity; + public final FluidStack[] mFluidInputs; + public final FluidStack[] mFluidOutputs; + public final int mDuration; + public final int mEUt; + + public GasSpargingRecipe(FluidStack aSpargeGas, FluidStack aSpentFuel, FluidStack aSpargedFuel, FluidStack[] aOutputs, int[] aMaxOutputQuantity) { + mInputGas = aSpargeGas; + mInputSpentFuel = aSpentFuel; + mOutputSpargedFuel = aSpargedFuel; + mFluidInputs = new FluidStack[] {mInputGas, mInputSpentFuel}; + aOutputs = ArrayUtils.insertElementAtIndex(aOutputs, 0, aSpargeGas); + aOutputs = ArrayUtils.insertElementAtIndex(aOutputs, 1, aSpargedFuel); + mFluidOutputs = aOutputs; + mMaxOutputQuantity = aMaxOutputQuantity; + mDuration = 20 * 60 * 5; + mEUt = MaterialUtils.getVoltageForTier(3); + } + + @Override + public boolean equals(Object o) { + if (o instanceof GasSpargingRecipe) { + GasSpargingRecipe i = (GasSpargingRecipe) o; + if (this.mInputGas.equals(i.mInputGas) && this.mInputSpentFuel.equals(i.mInputSpentFuel)) { + return true; + } + } + return false; + } + + public int getMaxOutput(int aIndex) { + if (aIndex == 0) { + return mInputGas.amount * 100; + } + else if (aIndex == 1) { + return mOutputSpargedFuel.amount * 100; + } + aIndex -= 2; + if ((aIndex < 0) || (aIndex >= this.mMaxOutputQuantity.length)) { + return 10000; + } + return this.mMaxOutputQuantity[aIndex]; + } + + public boolean isValid() { + if (mInputGas == null || mInputGas.amount <= 0 || + mInputSpentFuel == null || mInputSpentFuel.amount <= 0 || + mFluidOutputs == null || mFluidOutputs.length < 1 || + mMaxOutputQuantity == null || mMaxOutputQuantity.length < 1 || + mFluidOutputs.length != mMaxOutputQuantity.length) { + return false; + } + return true; + } + + public boolean containsInputs(FluidStack aSpargeGas, FluidStack aSpentFuel) { + if (aSpargeGas != null && aSpargeGas.getFluid().equals(this.mInputGas.getFluid())) { + if (aSpentFuel != null && aSpentFuel.getFluid().equals(this.mInputSpentFuel.getFluid())) { + return true; + } + } + return false; + } + + @Override + public int compareTo(GasSpargingRecipe o) { + if (o.mFluidOutputs.length > this.mFluidOutputs.length) { + return 1; + } else if (o.mFluidOutputs.length == this.mFluidOutputs.length) { + return 0; + } else { + return -1; + } + } + + public String[] getRecipeInfo() { + AutoMap<String> result = new AutoMap<String>(); + result.put("Input "+ItemUtils.getArrayStackNames(mFluidInputs)); + result.put("Output "+ItemUtils.getArrayStackNames(mFluidOutputs)); + result.put("Duration: "+mDuration); + result.put("EU/t: "+mEUt); + String s[] = result.toArray(); + return s; + } + +} diff --git a/src/Java/gregtech/api/util/GasSpargingRecipeMap.java b/src/Java/gregtech/api/util/GasSpargingRecipeMap.java new file mode 100644 index 0000000000..6e60cc7ac3 --- /dev/null +++ b/src/Java/gregtech/api/util/GasSpargingRecipeMap.java @@ -0,0 +1,48 @@ +package gregtech.api.util; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraftforge.fluids.FluidStack; + +public class GasSpargingRecipeMap extends AutoMap<GasSpargingRecipe>{ + + public static final AutoMap<GasSpargingRecipe> mRecipes = new AutoMap<GasSpargingRecipe>(); + public static final String mUnlocalizedName = "gtpp.recipe.lftr.sparging"; + public static final String mNEIName = mUnlocalizedName; + public static final String mNEIDisplayName = "LFTR Gas Sparging"; + public static final String mNEIGUIPath = RES_PATH_GUI + "basicmachines/FissionFuel.png"; + + + public static boolean addRecipe(FluidStack aSpargeGas, FluidStack aSpentFuel, FluidStack aSpargedFuel, FluidStack[] aOutputs, int[] aMaxOutputs) { + if (aSpargeGas == null || aSpargeGas.amount <= 0 || + aSpentFuel == null || aSpentFuel.amount <= 0 || + aSpargedFuel == null || aSpargedFuel.amount <= 0 || + aOutputs == null || aOutputs.length < 1 || + aMaxOutputs == null || aMaxOutputs.length < 1 || + aOutputs.length != aMaxOutputs.length) { + return false; + } + int aMapSize = mRecipes.size(); + GasSpargingRecipe aRecipe = new GasSpargingRecipe( + aSpargeGas, + aSpentFuel, + aSpargedFuel, + aOutputs, + aMaxOutputs + ); + mRecipes.put(aRecipe); + return mRecipes.size() > aMapSize; + } + + public static GasSpargingRecipe findRecipe(FluidStack aSpargeGas, FluidStack aSpentFuel) { + for (GasSpargingRecipe aRecipe : mRecipes) { + if (aRecipe.containsInputs(aSpargeGas, aSpentFuel)) { + return aRecipe; + } + } + return null; + } +} + + |