aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2021-01-02 20:50:56 -0800
committerJason Mitchell <mitchej@gmail.com>2021-01-02 20:50:56 -0800
commit3b6bc659ee5a38644ce0c3e55dbc3363e3a7100e (patch)
tree444eebce14c88ddad3792c25084ebd51a3591f9e /src/main/java
parent84c3236766ed6520cb54d9667308fe8f2be606de (diff)
downloadGT5-Unofficial-3b6bc659ee5a38644ce0c3e55dbc3363e3a7100e.tar.gz
GT5-Unofficial-3b6bc659ee5a38644ce0c3e55dbc3363e3a7100e.tar.bz2
GT5-Unofficial-3b6bc659ee5a38644ce0c3e55dbc3363e3a7100e.zip
1) Remove mAddGTRecipesToIC2Machines (stolen from @Glease)
2) Batch (most) recipe map removals and additions (significant speedup) 3) Modernize old java constructs --> java8 (in the files touched)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/GT_Mod.java106
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java335
-rw-r--r--src/main/java/gregtech/api/util/GT_OreDictUnificator.java28
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java256
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java91
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingArrows.java32
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingBeans.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingBlock.java17
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingBolt.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCell.java31
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java14
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCrafting.java96
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCrate.java24
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCrop.java64
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java10
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCrystallized.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingDirty.java20
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java97
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingDye.java10
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingFood.java19
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingGear.java12
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingItem.java23
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingLens.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingLog.java85
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingNugget.java10
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java28
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingOrePoor.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingOreSmelting.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingPipe.java20
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingPlank.java46
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java83
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingPure.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingRotor.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingRound.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingSand.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingSaplings.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingScrew.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java108
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingSlab.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingStick.java14
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingStickLong.java12
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingStone.java50
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingStoneCobble.java8
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingStoneVarious.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHead.java98
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingToolOther.java6
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingTransforming.java22
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingWax.java2
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java38
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java1228
54 files changed, 1606 insertions, 1605 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index 1844fb77c5..62148430b5 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -1,5 +1,6 @@
package gregtech;
+import com.google.common.base.Stopwatch;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.LoadController;
import cpw.mods.fml.common.Loader;
@@ -424,7 +425,6 @@ public class GT_Mod implements IGT_Mod {
gregtechproxy.mPollutionVegetationLimit = tMainConfig.get("Pollution", "VegetationLimit", 1000000).getInt(1000000);
gregtechproxy.mPollutionSourRainLimit = tMainConfig.get("Pollution", "SourRainLimit", 2000000).getInt(2000000);
gregtechproxy.mExplosionItemDrop = tMainConfig.get("general", "ExplosionItemDrops", false).getBoolean(false);
- gregtechproxy.mAddGTRecipesToIC2Machines = tMainConfig.get("general", "AddGTRecipesToIC2Machines", true).getBoolean(true);
gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid");
gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true).getBoolean(true);
gregtechproxy.mLowGravProcessing = Loader.isModLoaded(GT_Values.MOD_ID_GC_CORE) && tMainConfig.get("general", "LowGravProcessing", true).getBoolean(true);
@@ -815,10 +815,10 @@ public class GT_Mod implements IGT_Mod {
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.storageblockcrafting, "tile.glowstone", false)) {
GT_ModHandler.removeRecipe(new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1), null, new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1));
}
- GT_ModHandler.removeRecipe(new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2));
- GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)});
+ GT_ModHandler.removeRecipeDelayed(new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2));
+ GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)});
- //Save a copy of these list before activateOreDictHandler(), then loop over them.
+ // Save a copy of these list before activateOreDictHandler(), then loop over them.
Map<IRecipeInput, RecipeOutput> aMaceratorRecipeList = GT_ModHandler.getMaceratorRecipeList();
Map<IRecipeInput, RecipeOutput> aCompressorRecipeList = GT_ModHandler.getCompressorRecipeList();
Map<IRecipeInput, RecipeOutput> aExtractorRecipeList = GT_ModHandler.getExtractorRecipeList();
@@ -827,14 +827,18 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("GT_Mod: Activating OreDictionary Handler, this can take some time, as it scans the whole OreDictionary");
GT_FML_LOGGER.info("If your Log stops here, you were too impatient. Wait a bit more next time, before killing Minecraft with the Task Manager.");
- long ms = System.currentTimeMillis();
+
+ Stopwatch stopwatch = Stopwatch.createStarted();
gregtechproxy.activateOreDictHandler();
- GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake.");
+ GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + stopwatch.stop() + "). Have a Cake.");
GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString());
GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString());
GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString());
- //GT_Log.out.println("GT_Mod: sRodMaterialList cycles: " + GT_RecipeRegistrator.sRodMaterialList_cycles);
+
Set<Materials> replaceVanillaItemsSet = gregtechproxy.mUseGreatlyShrukenReplacementList ? Arrays.stream(Materials.values()).filter(GT_RecipeRegistrator::hasVanillaRecipes).collect(Collectors.toSet()) : new HashSet<>(Arrays.asList(Materials.values()));
+
+ stopwatch.reset();
+ stopwatch.start();
GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait.");
ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", replaceVanillaItemsSet.size());
@@ -853,14 +857,20 @@ public class GT_Mod implements IGT_Mod {
});
}
ProgressManager.pop(progressBar);
- GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake.");
+ GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + stopwatch.stop() + "). Have a Cake.");
+
+
+ stopwatch.reset();
+ stopwatch.start();
//Add default IC2 recipe to GT
GT_ModHandler.addIC2RecipesToGT(aMaceratorRecipeList, GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true);
GT_ModHandler.addIC2RecipesToGT(aCompressorRecipeList, GT_Recipe.GT_Recipe_Map.sCompressorRecipes, true, true, true);
GT_ModHandler.addIC2RecipesToGT(aExtractorRecipeList, GT_Recipe.GT_Recipe_Map.sExtractorRecipes, true, true, true);
GT_ModHandler.addIC2RecipesToGT(aOreWashingRecipeList, GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true);
GT_ModHandler.addIC2RecipesToGT(aThermalCentrifugeRecipeList, GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true);
-
+ GT_FML_LOGGER.info("IC2 Removal (" + stopwatch.stop() + "). Have a Cake.");
+
+
if (GT_Values.D1) {
GT_ModHandler.sSingleNonBlockDamagableRecipeList.forEach(iRecipe -> GT_Log.out.println("=> " + iRecipe.getRecipeOutput().getDisplayName()));
}
@@ -888,61 +898,16 @@ public class GT_Mod implements IGT_Mod {
}
if (Loader.isModLoaded(MOD_ID_AE))
GT_MetaTileEntity_DigitalChestBase.registerAEIntegration();
- String tName = "";
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blastfurnace"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blockcutter"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "inductionFurnace"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "generator"), false)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "windMill"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "waterMill"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "solarPanel"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "centrifuge"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electrolyzer"), false)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "compressor"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electroFurnace"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "extractor"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "macerator"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "recycler"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "metalformer"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "orewashingplant"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "massFabricator"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "replicator"), true)) {
- GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L));
- }
+
+
+ Arrays.stream(new String[]{
+ "blastfurnace", "blockcutter", "inductionFurnace", "generator", "windMill", "waterMill", "solarPanel", "centrifuge", "electrolyzer", "compressor",
+ "electroFurnace", "extractor", "macerator", "recycler", "metalformer", "orewashingplant", "massFabricator", "replicator",
+ })
+ .filter(tName -> GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + tName, true))
+ .map(tName -> GT_ModHandler.getIC2Item(tName, 1L)).forEach(GT_ModHandler::removeRecipeByOutputDelayed);
+
+
if (gregtechproxy.mNerfedVanillaTools) {
GT_Log.out.println("GT_Mod: Nerfing Vanilla Tool Durability");
Items.wooden_sword.setMaxDamage(12);
@@ -976,9 +941,20 @@ public class GT_Mod implements IGT_Mod {
Items.diamond_hoe.setMaxDamage(768);
}
new GT_ExtremeDieselFuelLoader().run();
+
+
+ /*
+ * Until this point most crafting recipe additions, and removals, have been buffered.
+ * Go through, execute the removals in bulk, and then any deferred additions. The bulk removals in particular significantly speed up the recipe list
+ * modifications.
+ */
+
+ stopwatch.reset();
+ stopwatch.start();
GT_Log.out.println("GT_Mod: Adding buffered Recipes.");
GT_ModHandler.stopBufferingCraftingRecipes();
-
+ GT_FML_LOGGER.info("Executed delayed Crafting Recipes (" + stopwatch.stop() + "). Have a Cake.");
+
GT_Log.out.println("GT_Mod: Saving Lang File.");
GT_LanguageManager.sEnglishFile.save();
GregTech_API.sPostloadFinished = true;
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index bfa3f86e77..e8d311da39 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -54,11 +54,11 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
+import java.util.Set;
import java.util.stream.Collectors;
import static gregtech.api.enums.GT_Values.B;
@@ -78,22 +78,28 @@ import static gregtech.api.enums.GT_Values.W;
* Due to the many imports, this File can cause compile Problems if not all the APIs are installed
*/
public class GT_ModHandler {
- public static final List<IRecipe> sSingleNonBlockDamagableRecipeList = new ArrayList<IRecipe>(1000);
- private static final Map<String, ItemStack> sIC2ItemMap = new HashMap<String, ItemStack>();
- private static final List<IRecipe> sAllRecipeList = /*Collections.synchronizedList(*/new ArrayList<IRecipe>(5000)/*)*/, sBufferRecipeList = new ArrayList<IRecipe>(1000);
+ public static final List<IRecipe> sSingleNonBlockDamagableRecipeList = new ArrayList<>(1000);
+ private static final Map<String, ItemStack> sIC2ItemMap = new HashMap<>();
+
+ private static final List<IRecipe> sAllRecipeList = new ArrayList<>(5000), sBufferRecipeList = new ArrayList<>(1000);
+ private static final List<ItemStack> delayedRemovalByOutput = new ArrayList<>();
+ private static final List<InventoryCrafting> delayedRemovalByRecipe = new ArrayList<>();
+
+
public static volatile int VERSION = 509;
- public static Collection<String> sNativeRecipeClasses = new HashSet<String>(), sSpecialRecipeClasses = new HashSet<String>();
- public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<GT_ItemStack>();
+ public static Collection<String> sNativeRecipeClasses = new HashSet<>(), sSpecialRecipeClasses = new HashSet<>();
+ public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<>();
public static Object sBoxableWrapper = GT_Utility.callConstructor("gregtechmod.api.util.GT_IBoxableWrapper", 0, null, false);
- private static Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sOreWashingRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sThermalCentrifugeRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
- private static Map<IRecipeInput, RecipeOutput> sMassfabRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
+ 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 boolean sBufferCraftingRecipes = true;
- public static List<Integer> sSingleNonBlockDamagableRecipeList_list = new ArrayList<Integer>(100);
- private static boolean sSingleNonBlockDamagableRecipeList_create = true;
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_list = new ArrayList<>(100);
+ private static final boolean sSingleNonBlockDamagableRecipeList_create = true;
private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0);
private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R";
private static final ItemStack[][]
@@ -143,11 +149,11 @@ public class GT_ModHandler {
{sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null},
{null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2}
};
- public static List<Integer> sSingleNonBlockDamagableRecipeList_validsShapes1 = new ArrayList<Integer>(44);
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_validsShapes1 = new ArrayList<>(44);
public static boolean sSingleNonBlockDamagableRecipeList_validsShapes1_update = false;
- public static List<Integer> sSingleNonBlockDamagableRecipeList_warntOutput = new ArrayList<Integer>(50);
- public static List<Integer> sVanillaRecipeList_warntOutput = new ArrayList<Integer>(50);
- public static final List<IRecipe> sSingleNonBlockDamagableRecipeList_verified = new ArrayList<IRecipe>(1000);
+ public static List<Integer> sSingleNonBlockDamagableRecipeList_warntOutput = new ArrayList<>(50);
+ public static List<Integer> sVanillaRecipeList_warntOutput = new ArrayList<>(50);
+ public static final List<IRecipe> sSingleNonBlockDamagableRecipeList_verified = new ArrayList<>(1000);
private static Cache<GT_ItemStack, ItemStack> sSmeltingRecipeCache = CacheBuilder.newBuilder().maximumSize(1000).build();
public static List<Integer> sAnySteamFluidIDs = new ArrayList<>();
public static List<Integer> sSuperHeatedSteamFluidIDs = new ArrayList<>();
@@ -542,10 +548,8 @@ public class GT_ModHandler {
public static boolean addExtractionRecipe(ItemStack aInput, ItemStack aOutput) {
aOutput = GT_OreDictUnificator.get(true, aOutput);
if (aInput == null || aOutput == null) return false;
- if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines) GT_Utility.removeSimpleIC2MachineRecipe(aInput, getExtractorRecipeList(), null);
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.extractor, aInput, true)) return false;
RA.addExtractorRecipe(aInput, aOutput, 300, 2);
- if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines) GT_Utility.addSimpleIC2MachineRecipe(aInput, getExtractorRecipeList(), null, aOutput);
return true;
}
@@ -597,12 +601,8 @@ public class GT_ModHandler {
aOutput1 = GT_OreDictUnificator.get(true, aOutput1);
aOutput2 = GT_OreDictUnificator.get(true, aOutput2);
if (GT_Utility.isStackInvalid(aInput) || GT_Utility.isStackInvalid(aOutput1)) return false;
- if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines) GT_Utility.removeSimpleIC2MachineRecipe(aInput, getMaceratorRecipeList(), null);
if (GT_Utility.getContainerItem(aInput, false) == null) {
- if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines && GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) {
- GT_Utility.addSimpleIC2MachineRecipe(aInput, getMaceratorRecipeList(), null, aOutput1);
- }
addMagneticraftRecipe(aInput, aOutput1, aOutput2, aChance2, aOutput3, aChance3);
addImmersiveEngineeringRecipe(aInput, aOutput1, aOutput2, aChance2, aOutput3, aChance3);
RA.addPulveriserRecipe(aInput, new ItemStack[]{aOutput1, aOutput2, aOutput3}, new int[]{10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, 400, 2);
@@ -720,39 +720,34 @@ public class GT_ModHandler {
*/
public static void addIC2RecipesToGT(Map<IRecipeInput, RecipeOutput> aIC2RecipeList, GT_Recipe.GT_Recipe_Map aGTRecipeMap, boolean aAddGTRecipe, boolean aRemoveIC2Recipe, boolean aExcludeGTIC2Items) {
Map<ItemStack, ItemStack> aRecipesToRemove = new HashMap<>();
- for (Iterator i$ = aIC2RecipeList.entrySet().iterator(); i$.hasNext(); ) {
- Entry tRecipe = (Map.Entry) i$.next();
- if (((RecipeOutput) tRecipe.getValue()).items.size() > 0) {
- for (ItemStack tStack : ((IRecipeInput) tRecipe.getKey()).getInputs()) {
+ for (Entry<IRecipeInput, RecipeOutput> iRecipeInputRecipeOutputEntry : aIC2RecipeList.entrySet()) {
+ if ((iRecipeInputRecipeOutputEntry.getValue()).items.size() > 0) {
+ for (ItemStack tStack : (iRecipeInputRecipeOutputEntry.getKey()).getInputs()) {
if (GT_Utility.isStackValid(tStack)) {
if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) {
- try{
- if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") || tStack.getUnlocalizedName().contains("gt.blockores") || tStack.getUnlocalizedName().contains("ic2.itemCrushed") || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) continue;
- switch (aGTRecipeMap.mUnlocalizedName) {
- case "gt.recipe.macerator":
- aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 300, 2, 0);
- break;
- case "gt.recipe.compressor":
- aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 300, 2, 0);
- break;
- case "gt.recipe.extractor":
- aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 300, 2, 0);
- break;
- case "gt.recipe.thermalcentrifuge":
- aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 500, 48, 0);
- break;
+ try {
+ if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") || tStack.getUnlocalizedName().contains("gt.blockores") || tStack.getUnlocalizedName().contains("ic2.itemCrushed") || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed"))))
+ continue;
+ switch (aGTRecipeMap.mUnlocalizedName) {