diff options
author | HoleFish <48403212+HoleFish@users.noreply.github.com> | 2024-08-24 02:40:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 18:40:15 +0000 |
commit | 59f7b8c34641851010999dc31f59f996a5e7a3ff (patch) | |
tree | 83b9353eb1a5ccd3d04f334159c95fdaf8275bcd /src/main/java/gregtech/api/util/GT_RecipeConstants.java | |
parent | eb34e71e22177fb2d8072522eb7f3e5401b84eea (diff) | |
download | GT5-Unofficial-59f7b8c34641851010999dc31f59f996a5e7a3ff.tar.gz GT5-Unofficial-59f7b8c34641851010999dc31f59f996a5e7a3ff.tar.bz2 GT5-Unofficial-59f7b8c34641851010999dc31f59f996a5e7a3ff.zip |
Add recipemap for EBF gas recipes (#2931)
add
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_RecipeConstants.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_RecipeConstants.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/util/GT_RecipeConstants.java b/src/main/java/gregtech/api/util/GT_RecipeConstants.java index 22dc842941..7077654fb4 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeConstants.java +++ b/src/main/java/gregtech/api/util/GT_RecipeConstants.java @@ -22,8 +22,10 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; import gregtech.api.interfaces.IRecipeMap; +import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeCategories; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; @@ -201,6 +203,14 @@ public class GT_RecipeConstants { public static final RecipeMetadataKey<Integer> DECAY_TICKS = SimpleRecipeMetadataKey .create(Integer.class, "decay_ticks"); + public static final RecipeMetadataKey<Boolean> NOBLE_GASES = SimpleRecipeMetadataKey + .create(Boolean.class, "noble_gases"); + + public static final RecipeMetadataKey<Boolean> ANAEROBE_GASES = SimpleRecipeMetadataKey + .create(Boolean.class, "anaerobe_gases"); + + public static final RecipeMetadataKey<Boolean> NO_GAS = SimpleRecipeMetadataKey.create(Boolean.class, "no_gas"); + /** * Add a arc furnace recipe. Adds to both normal arc furnace and plasma arc furnace. * Will override the fluid input with oxygen/plasma for the respective recipe maps, so there is no point setting it. @@ -514,6 +524,74 @@ public class GT_RecipeConstants { }); /** + * Adds an Electric Blast Furnace recipe that might use gas. + */ + public static final IRecipeMap BlastFurnaceWithGas = IRecipeMap.newRecipeMap(builder -> { + Collection<GT_Recipe> ret = new ArrayList<>(); + int basicGasAmount = builder.getMetadataOrDefault(ADDITIVE_AMOUNT, 1000); + double durationBase = builder.getDuration(); + ArrayList<ItemStack> items = new ArrayList<>(Arrays.asList(builder.getItemInputsBasic())); + int circuitConfig = 1; + if (items.size() == 1) {// Set circuit config if it is a dust -> ingot recipe. + ItemData data = GT_OreDictUnificator.getAssociation(items.get(0)); + if (data != null) { + OrePrefixes prefix = data.mPrefix; + if (OrePrefixes.dust.equals(prefix)) { + circuitConfig = 1; + } else if (OrePrefixes.dustSmall.equals(prefix)) { + circuitConfig = 4; + } else if (OrePrefixes.dustTiny.equals(prefix)) { + circuitConfig = 9; + } + } + } else { // Set circuit config if there is an integrated circuit + for (int i = 0; i < items.size(); i++) { + if (GT_Utility.isAnyIntegratedCircuit(items.get(i))) { + circuitConfig = items.get(i) + .getItemDamage(); + items.remove(i--); + } + } + } + + if (builder.getMetadataOrDefault(NO_GAS, false)) { + items.add(GT_Utility.getIntegratedCircuit(circuitConfig)); + ret.addAll( + builder.copy() + .itemInputs(items.toArray(new ItemStack[0])) + .fluidInputs() + .duration((int) Math.max(durationBase * 1.1, 1)) + .addTo(RecipeMaps.blastFurnaceRecipes)); + items.remove(items.size() - 1); + circuitConfig += 10; + } + + items.add(GT_Utility.getIntegratedCircuit(circuitConfig)); + boolean nobleGases = builder.getMetadataOrDefault(NOBLE_GASES, false); + boolean anaerobeGases = builder.getMetadataOrDefault(ANAEROBE_GASES, false); + Collection<BlastFurnaceGasStat> gases = new ArrayList<>(); + + if (nobleGases && anaerobeGases) { + gases = BlastFurnaceGasStat.getNobleAndAnaerobeGases(); + } else if (nobleGases) { + gases = BlastFurnaceGasStat.getNobleGases(); + } else if (anaerobeGases) { + gases = BlastFurnaceGasStat.getAnaerobeGases(); + } + for (BlastFurnaceGasStat gas : gases) { + int gasAmount = (int) (gas.recipeConsumedAmountMultiplier * basicGasAmount); + int duration = (int) Math.max(gas.recipeTimeMultiplier * durationBase, 1); + ret.addAll( + builder.copy() + .itemInputs(items.toArray(new ItemStack[0])) + .fluidInputs(GT_Utility.copyAmount(gasAmount, gas.gas)) + .duration(duration) + .addTo(RecipeMaps.blastFurnaceRecipes)); + } + return ret; + }); + + /** * Just like any normal assembler recipe, however it accepts one input item to be oredicted. Pass in the item to * oredict via {@link #OREDICT_INPUT}. It will be used along all other item inputs as input of this recipe. */ |