aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GasSpargingRecipeMap.java
blob: 6e60cc7ac30efef45cea963bc21f685f98002da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
	}
}