aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
authorchochem <40274384+chochem@users.noreply.github.com>2023-06-01 22:23:54 +0100
committerGitHub <noreply@github.com>2023-06-01 23:23:54 +0200
commit6724ab6015bc1e319f9037f4ed4ce89d2502af66 (patch)
treec6328764ff4ad8f2c7459b3d907e5949532499de /src/main/java/gregtech
parent9bbb1aa08ee88d166e84ecef635827be7fe85282 (diff)
downloadGT5-Unofficial-6724ab6015bc1e319f9037f4ed4ce89d2502af66.tar.gz
GT5-Unofficial-6724ab6015bc1e319f9037f4ed4ce89d2502af66.tar.bz2
GT5-Unofficial-6724ab6015bc1e319f9037f4ed4ce89d2502af66.zip
some gtmodhandler improvements (#2043)
* remove terrible naming conflict * ra2 for the alloysmelter+furnace combo
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java66
1 files changed, 43 insertions, 23 deletions
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index 8265f3d03f..21675a58a4 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -9,6 +9,8 @@ import static gregtech.api.enums.GT_Values.M;
import static gregtech.api.enums.GT_Values.RA;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.GT_Values.W;
+import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes;
+import static gregtech.api.util.GT_RecipeBuilder.TICKS;
import java.util.ArrayList;
import java.util.Arrays;
@@ -94,12 +96,7 @@ public class GT_ModHandler {
public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<>();
public static Object sBoxableWrapper = new GT_IBoxableWrapper();
public static Collection<GT_ItemStack> sBoxableItems = new ArrayList<>();
- private static final Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new HashMap<>();
- private static final Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new HashMap<>();
- private static final Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new HashMap<>();
- private static final Map<IRecipeInput, RecipeOutput> sOreWashingRecipes = new HashMap<>();
- private static final Map<IRecipeInput, RecipeOutput> sThermalCentrifugeRecipes = new HashMap<>();
- private static final Map<IRecipeInput, RecipeOutput> sMassfabRecipes = new HashMap<>();
+ private static final Map<IRecipeInput, RecipeOutput> emptyRecipeMap = new HashMap<>();
private static Set<GT_Utility.ItemId> recyclerWhitelist;
private static Set<GT_Utility.ItemId> recyclerBlacklist;
@@ -540,20 +537,43 @@ public class GT_ModHandler {
}
/**
- * Adds to Furnace AND Alloysmelter AND Induction Smelter
+ * Adds to Furnace AND Alloy Smelter
*/
public static boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput, boolean hidden) {
- if (aInput == null || aOutput == null) return false;
+ if (aInput == null || aOutput == null) {
+ return false;
+ }
boolean temp = aInput.stackSize == 1 && addSmeltingRecipe(aInput, aOutput);
- return (RA.addAlloySmelterRecipe(
- aInput,
- OrePrefixes.ingot.contains(aOutput) ? ItemList.Shape_Mold_Ingot.get(0)
- : OrePrefixes.block.contains(aOutput) ? ItemList.Shape_Mold_Block.get(0)
- : OrePrefixes.nugget.contains(aOutput) ? ItemList.Shape_Mold_Nugget.get(0) : null,
- aOutput,
- 130,
- 3,
- hidden));
+ ItemStack input2 = OrePrefixes.ingot.contains(aOutput) ? ItemList.Shape_Mold_Ingot.get(0)
+ : OrePrefixes.block.contains(aOutput) ? ItemList.Shape_Mold_Block.get(0)
+ : OrePrefixes.nugget.contains(aOutput) ? ItemList.Shape_Mold_Nugget.get(0) : null;
+ if (Materials.Graphite.contains(aInput)) {
+ return false;
+ }
+ if ((input2 == null) && ((OrePrefixes.ingot.contains(aInput)) || (OrePrefixes.dust.contains(aInput))
+ || (OrePrefixes.gem.contains(aInput)))) {
+ return false;
+ }
+ int duration = GregTech_API.sRecipeFile.get("alloysmelting", input2 == null ? aInput : aOutput, 130);
+ if (duration <= 0) {
+ return false;
+ }
+ GT_RecipeBuilder recipeBuilder = GT_Values.RA.stdBuilder();
+ if (input2 == null) {
+ recipeBuilder.itemInputs(aInput);
+ } else {
+ recipeBuilder.itemInputs(aInput, input2);
+ }
+ recipeBuilder.itemOutputs(aOutput)
+ .noFluidInputs()
+ .noFluidOutputs()
+ .duration(duration * TICKS)
+ .eut(3);
+ if (hidden) {
+ recipeBuilder.hidden();
+ }
+ recipeBuilder.addTo(sAlloySmelterRecipes);
+ return true;
}
/**
@@ -789,7 +809,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sExtractorRecipes;
+ return emptyRecipeMap;
}
public static Map<IRecipeInput, RecipeOutput> getCompressorRecipeList() {
@@ -798,7 +818,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sCompressorRecipes;
+ return emptyRecipeMap;
}
public static Map<IRecipeInput, RecipeOutput> getMaceratorRecipeList() {
@@ -807,7 +827,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sMaceratorRecipes;
+ return emptyRecipeMap;
}
public static Map<IRecipeInput, RecipeOutput> getThermalCentrifugeRecipeList() {
@@ -816,7 +836,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sThermalCentrifugeRecipes;
+ return emptyRecipeMap;
}
public static Map<IRecipeInput, RecipeOutput> getOreWashingRecipeList() {
@@ -825,7 +845,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sOreWashingRecipes;
+ return emptyRecipeMap;
}
public static Map<IRecipeInput, RecipeOutput> getMassFabricatorList() {
@@ -834,7 +854,7 @@ public class GT_ModHandler {
} catch (Throwable e) {
/* Do nothing */
}
- return sMassfabRecipes;
+ return emptyRecipeMap;
}
/**