aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-30 10:56:42 -0800
commit0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch)
tree1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
parentf8cc82edeb9810c45cba762d733a2c909a302faa (diff)
downloadGT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2
GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_RecipeRegistrator.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_RecipeRegistrator.java483
1 files changed, 217 insertions, 266 deletions
diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
index a353eff44d..81d11ad7f2 100644
--- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
+++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java
@@ -5,18 +5,9 @@ import static gregtech.api.enums.Materials.*;
import static gregtech.api.enums.Materials.Void;
import static gregtech.api.util.GT_Utility.calculateRecipeEU;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.SetMultimap;
-import cpw.mods.fml.relauncher.ReflectionHelper;
-import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
-import gregtech.api.objects.ItemData;
-import gregtech.api.objects.MaterialStack;
-import ic2.api.reactor.IReactorComponent;
import java.lang.reflect.Field;
import java.util.*;
+
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
@@ -28,112 +19,110 @@ import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.SetMultimap;
+
+import cpw.mods.fml.relauncher.ReflectionHelper;
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.*;
+import gregtech.api.objects.ItemData;
+import gregtech.api.objects.MaterialStack;
+import ic2.api.reactor.IReactorComponent;
+
/**
* Class for Automatic Recipe registering.
*/
public class GT_RecipeRegistrator {
+
/**
- * List of Materials, which are used in the Creation of Sticks. All Rod Materials are automatically added to this List.
+ * List of Materials, which are used in the Creation of Sticks. All Rod Materials are automatically added to this
+ * List.
*/
public static final List<Materials> sRodMaterialList = new ArrayList<Materials>();
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 RecipeShape[] sShapes = new RecipeShape[] {
- new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null),
- new RecipeShape(sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1),
- new RecipeShape(null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1),
- new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null),
- new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1),
- new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1),
- new RecipeShape(null, null, null, sMt1, null, sMt1, sMt1, null, sMt1),
- new RecipeShape(null, sMt1, null, null, sMt1, null, null, sMt2, null),
- new RecipeShape(sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null),
- new RecipeShape(null, sMt1, null, null, sMt2, null, null, sMt2, null),
- new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null),
- new RecipeShape(null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null),
- new RecipeShape(sMt1, sMt1, null, null, sMt2, null, null, sMt2, null),
- new RecipeShape(null, sMt1, sMt1, null, sMt2, null, null, sMt2, null),
- new RecipeShape(null, sMt1, null, sMt1, null, null, null, sMt1, sMt2),
- new RecipeShape(null, sMt1, null, null, null, sMt1, sMt2, sMt1, null),
- new RecipeShape(null, sMt1, null, sMt1, null, sMt1, null, null, sMt2),
- new RecipeShape(null, sMt1, null, sMt1, null, sMt1, sMt2, null, null),
- new RecipeShape(null, sMt2, null, null, sMt1, null, null, sMt1, null),
- new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1),
- new RecipeShape(null, sMt2, null, null, sMt2, null, null, sMt1, null),
- new RecipeShape(null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null),
- new RecipeShape(null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1),
- new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, null),
- new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, sMt2),
- new RecipeShape(null, null, sMt1, null, sMt2, null, sMt2, null, null),
- new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, null),
- new RecipeShape(null, null, sMt1, null, sMt2, null, null, null, null),
- new RecipeShape(sMt1, sMt2, null, null, null, null, null, null, null),
- new RecipeShape(sMt2, sMt1, null, null, null, null, null, null, null),
- new RecipeShape(sMt1, null, null, sMt2, null, null, null, null, null),
- new RecipeShape(sMt2, null, null, sMt1, null, null, null, null, null),
- new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null),
- new RecipeShape(sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null),
- new RecipeShape(null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1),
- new RecipeShape(null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1),
- new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null),
- new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null),
- new RecipeShape(null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1),
- new RecipeShape(null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1),
- new RecipeShape(sMt1, null, null, null, sMt1, null, null, null, null),
- new RecipeShape(null, sMt1, null, sMt1, null, null, null, null, null),
- new RecipeShape(sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null),
- new RecipeShape(null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2)
- };
+ new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null),
+ new RecipeShape(sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1),
+ new RecipeShape(null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1),
+ new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null),
+ new RecipeShape(sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1),
+ new RecipeShape(sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1),
+ new RecipeShape(null, null, null, sMt1, null, sMt1, sMt1, null, sMt1),
+ new RecipeShape(null, sMt1, null, null, sMt1, null, null, sMt2, null),
+ new RecipeShape(sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null),
+ new RecipeShape(null, sMt1, null, null, sMt2, null, null, sMt2, null),
+ new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null),
+ new RecipeShape(null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null),
+ new RecipeShape(sMt1, sMt1, null, null, sMt2, null, null, sMt2, null),
+ new RecipeShape(null, sMt1, sMt1, null, sMt2, null, null, sMt2, null),
+ new RecipeShape(null, sMt1, null, sMt1, null, null, null, sMt1, sMt2),
+ new RecipeShape(null, sMt1, null, null, null, sMt1, sMt2, sMt1, null),
+ new RecipeShape(null, sMt1, null, sMt1, null, sMt1, null, null, sMt2),
+ new RecipeShape(null, sMt1, null, sMt1, null, sMt1, sMt2, null, null),
+ new RecipeShape(null, sMt2, null, null, sMt1, null, null, sMt1, null),
+ new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1),
+ new RecipeShape(null, sMt2, null, null, sMt2, null, null, sMt1, null),
+ new RecipeShape(null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null),
+ new RecipeShape(null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1),
+ new RecipeShape(null, sMt2, null, null, sMt2, null, sMt1, sMt1, null),
+ new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, sMt2),
+ new RecipeShape(null, null, sMt1, null, sMt2, null, sMt2, null, null),
+ new RecipeShape(sMt1, null, null, null, sMt2, null, null, null, null),
+ new RecipeShape(null, null, sMt1, null, sMt2, null, null, null, null),
+ new RecipeShape(sMt1, sMt2, null, null, null, null, null, null, null),
+ new RecipeShape(sMt2, sMt1, null, null, null, null, null, null, null),
+ new RecipeShape(sMt1, null, null, sMt2, null, null, null, null, null),
+ new RecipeShape(sMt2, null, null, sMt1, null, null, null, null, null),
+ new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null),
+ new RecipeShape(sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null),
+ new RecipeShape(null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1),
+ new RecipeShape(null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1),
+ new RecipeShape(sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null),
+ new RecipeShape(sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null),
+ new RecipeShape(null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1),
+ new RecipeShape(null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1),
+ new RecipeShape(sMt1, null, null, null, sMt1, null, null, null, null),
+ new RecipeShape(null, sMt1, null, sMt1, null, null, null, null, null),
+ new RecipeShape(sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null),
+ new RecipeShape(null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2) };
public static final Field SHAPED_ORE_RECIPE_WIDTH = ReflectionHelper.findField(ShapedOreRecipe.class, "width");
public static final Field SHAPED_ORE_RECIPE_HEIGHT = ReflectionHelper.findField(ShapedOreRecipe.class, "height");
private static volatile Map<RecipeShape, List<IRecipe>> indexedRecipeListCache;
- private static final String[][] sShapesA = new String[][] {
- null,
- null,
- null,
- {"Helmet", s_P + s_P + s_P, s_P + s_H + s_P},
- {"ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P},
- {"Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P},
- {"Boots", s_P + " " + s_P, s_P + s_H + s_P},
- {"Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " "},
- {"Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " "},
- {"Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " "},
- {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "},
- {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "},
- {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "},
- {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "},
- {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R},
- {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R},
- {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R},
- {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R},
- {"Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " "},
- {"Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I},
- {"Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H},
- {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H},
- {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H},
- {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H},
- {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H},
- {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R},
- {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R},
- {"Knive", s_H + s_P, s_R + s_F},
- {"Knive", s_F + s_H, s_P + s_R},
- {"Knive", s_F + s_H, s_P + s_R},
- {"Knive", s_P + s_F, s_R + s_H},
- {"Knive", s_P + s_F, s_R + s_H},
- null,
- null,
- null,
- null,
- {"WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H},
- null,
- null,
- null,
- {"Shears", s_H + s_P, s_P + s_F},
- {"Shears", s_H + s_P, s_P + s_F},
- {"Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " "},
- {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R}
- };
+ private static final String[][] sShapesA = new String[][] { null, null, null,
+ { "Helmet", s_P + s_P + s_P, s_P + s_H + s_P },
+ { "ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P },
+ { "Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P },
+ { "Boots", s_P + " " + s_P, s_P + s_H + s_P },
+ { "Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " " },
+ { "Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " " },
+ { "Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " " },
+ { "Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " " },
+ { "Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " " },
+ { "Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " " },
+ { "Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " " },
+ { "Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R },
+ { "Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R },
+ { "Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R },
+ { "Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R },
+ { "Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " " },
+ { "Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I },
+ { "Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H },
+ { "Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H },
+ { "Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H },
+ { "Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H },
+ { "Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H },
+ { "Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R },
+ { "Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R }, { "Knive", s_H + s_P, s_R + s_F },
+ { "Knive", s_F + s_H, s_P + s_R }, { "Knive", s_F + s_H, s_P + s_R }, { "Knive", s_P + s_F, s_R + s_H },
+ { "Knive", s_P + s_F, s_R + s_H }, null, null, null, null,
+ { "WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H }, null, null, null,
+ { "Shears", s_H + s_P, s_P + s_F }, { "Shears", s_H + s_P, s_P + s_F },
+ { "Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " " },
+ { "Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R } };
public static volatile int VERSION = 509;
static {
@@ -141,8 +130,8 @@ public class GT_RecipeRegistrator {
GregTech_API.sAfterGTPostload.add(() -> indexedRecipeListCache = null);
}
- public static void registerMaterialRecycling(
- ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) {
+ public static void registerMaterialRecycling(ItemStack aStack, Materials aMaterial, long aMaterialAmount,
+ MaterialStack aByproduct) {
if (GT_Utility.isStackInvalid(aStack)) return;
if (aByproduct != null) {
aByproduct = aByproduct.clone();
@@ -154,17 +143,20 @@ public class GT_RecipeRegistrator {
}
public static void registerMaterialRecycling(ItemStack aStack, ItemData aData) {
- if (GT_Utility.isStackInvalid(aStack)
- || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack)
+ if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack)
|| aData == null
|| !aData.hasValidMaterialData()
|| !aData.mMaterial.mMaterial.mAutoGenerateRecycleRecipes
|| aData.mMaterial.mAmount <= 0
|| GT_Utility.getFluidForFilledItem(aStack, false) != null
- || aData.mMaterial.mMaterial.mSubTags.contains(SubTag.NO_RECIPES)) return;
+ || aData.mMaterial.mMaterial.mSubTags.contains(SubTag.NO_RECIPES))
+ return;
registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null);
registerReverseSmelting(
- GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true);
+ GT_Utility.copyAmount(1, aStack),
+ aData.mMaterial.mMaterial,
+ aData.mMaterial.mAmount,
+ true);
registerReverseFluidSmelting(
GT_Utility.copyAmount(1, aStack),
aData.mMaterial.mMaterial,
@@ -178,43 +170,41 @@ public class GT_RecipeRegistrator {
* @param aMaterial the Material.
* @param aMaterialAmount the amount of it in Material Units.
*/
- public static void registerReverseFluidSmelting(
- ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) {
- if (aStack == null
- || aMaterial == null
+ public static void registerReverseFluidSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount,
+ MaterialStack aByproduct) {
+ if (aStack == null || aMaterial == null
|| aMaterial.mSmeltInto.mStandardMoltenFluid == null
|| !aMaterial.contains(SubTag.SMELTING_TO_FLUID)
- || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0) return;
+ || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0)
+ return;
ItemData tData = GT_OreDictUnificator.getItemData(aStack);
boolean tHide = aStack.getUnlocalizedName().startsWith("gt.blockmachines")
&& (GT_Mod.gregtechproxy.mHideRecyclingRecipes);
- if (GT_Mod.gregtechproxy.mHideRecyclingRecipes
- && tData != null
+ if (GT_Mod.gregtechproxy.mHideRecyclingRecipes && tData != null
&& tData.hasValidPrefixData()
- && !(tData.mPrefix == OrePrefixes.dust
- || tData.mPrefix == OrePrefixes.ingot
+ && !(tData.mPrefix == OrePrefixes.dust || tData.mPrefix == OrePrefixes.ingot
|| tData.mPrefix == OrePrefixes.block | tData.mPrefix == OrePrefixes.plate)) {
tHide = true;
}
- // boolean tHide = (aMaterial != Materials.Iron && aMaterial!=
+ // boolean tHide = (aMaterial != Materials.Iron && aMaterial!=
// Materials.Redstone)&&(GT_Mod.gregtechproxy.mHideRecyclingRecipes);
- // if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){
- // tHide=false;
- // }
+ // if(tHide && tData!=null&&tData.hasValidPrefixData()&&tData.mPrefix==OrePrefixes.ingot){
+ // tHide=false;
+ // }
RA.addFluidSmelterRecipe(
GT_Utility.copyAmount(1, aStack),
- aByproduct == null
- ? null
+ aByproduct == null ? null
: aByproduct.mMaterial.contains(SubTag.NO_SMELTING)
- || !aByproduct.mMaterial.contains(SubTag.METAL)
- ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE)
- ? GT_OreDictUnificator.getDust(Materials.Ash, aByproduct.mAmount / 2)
- : aByproduct.mMaterial.contains(SubTag.UNBURNABLE)
- ? GT_OreDictUnificator.getDustOrIngot(
- aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount)
- : null
- : GT_OreDictUnificator.getIngotOrDust(
- aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount),
+ || !aByproduct.mMaterial.contains(SubTag.METAL)
+ ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE)
+ ? GT_OreDictUnificator.getDust(Materials.Ash, aByproduct.mAmount / 2)
+ : aByproduct.mMaterial.contains(SubTag.UNBURNABLE)
+ ? GT_OreDictUnificator.getDustOrIngot(
+ aByproduct.mMaterial.mSmeltInto,
+ aByproduct.mAmount)
+ : null
+ : GT_OreDictUnificator
+ .getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount),
aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)),
10000,
(int) Math.max(1, (24 * aMaterialAmount) / M),
@@ -228,37 +218,30 @@ public class GT_RecipeRegistrator {
* @param aMaterialAmount the amount of it in Material Units.
* @param aAllowAlloySmelter if it is allowed to be recycled inside the Alloy Smelter.
*/
- public static void registerReverseSmelting(
- ItemStack aStack, Materials aMaterial, long aMaterialAmount, boolean aAllowAlloySmelter) {
- if (aStack == null
- || aMaterial == null
+ public static void registerReverseSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount,
+ boolean aAllowAlloySmelter) {
+ if (aStack == null || aMaterial == null
|| aMaterialAmount <= 0
|| aMaterial.contains(SubTag.NO_SMELTING)
|| (aMaterialAmount > M && aMaterial.contains(SubTag.METAL))
- || (aMaterial.getProcessingMaterialTierEU() > TierEU.IV)) return;
+ || (aMaterial.getProcessingMaterialTierEU() > TierEU.IV))
+ return;
if (aMaterial == Materials.Naquadah || aMaterial == Materials.NaquadahEnriched) return;
aMaterialAmount /= aStack.stackSize;
boolean tHide = (aMaterial != Materials.Iron) && (GT_Mod.gregtechproxy.mHideRecyclingRecipes);
- if (aAllowAlloySmelter)
- GT_ModHandler.addSmeltingAndAlloySmeltingRecipe(
- GT_Utility.copyAmount(1, aStack),
- GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount),
- tHide);
- else
- GT_ModHandler.addSmeltingRecipe(
- GT_Utility.copyAmount(1, aStack),
- GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
+ if (aAllowAlloySmelter) GT_ModHandler.addSmeltingAndAlloySmeltingRecipe(
+ GT_Utility.copyAmount(1, aStack),
+ GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount),
+ tHide);
+ else GT_ModHandler.addSmeltingRecipe(
+ GT_Utility.copyAmount(1, aStack),
+ GT_OreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
}
- public static void registerReverseArcSmelting(
- ItemStack aStack,
- Materials aMaterial,
- long aMaterialAmount,
- MaterialStack aByProduct01,
- MaterialStack aByProduct02,
- MaterialStack aByProduct03) {
+ public static void registerReverseArcSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount,
+ MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03) {
registerReverseArcSmelting(
aStack,
new ItemData(
@@ -276,10 +259,10 @@ public class GT_RecipeRegistrator {
boolean tIron = false;
for (MaterialStack tMaterial : aData.getAllMaterialStacks()) {
- if (tMaterial.mMaterial == Materials.Iron
- || tMaterial.mMaterial == Materials.Copper
+ if (tMaterial.mMaterial == Materials.Iron || tMaterial.mMaterial == Materials.Copper
|| tMaterial.mMaterial == Materials.WroughtIron
- || tMaterial.mMaterial == Materials.AnnealedCopper) tIron = true;
+ || tMaterial.mMaterial == Materials.AnnealedCopper)
+ tIron = true;
if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) {
tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto;
@@ -311,10 +294,9 @@ public class GT_RecipeRegistrator {
}
aData = new ItemData(aData);
- if (aData.mByProducts.length > 3)
- for (MaterialStack tMaterial : aData.getAllMaterialStacks()) {
- if (tMaterial.mMaterial == Materials.Ash) tMaterial.mAmount = 0;
- }
+ if (aData.mByProducts.length > 3) for (MaterialStack tMaterial : aData.getAllMaterialStacks()) {
+ if (tMaterial.mMaterial == Materials.Ash) tMaterial.mAmount = 0;
+ }
aData = new ItemData(aData);
@@ -327,26 +309,18 @@ public class GT_RecipeRegistrator {
boolean tHide = !tIron && GT_Mod.gregtechproxy.mHideRecyclingRecipes;
RA.addArcFurnaceRecipe(
aStack,
- new ItemStack[] {
- GT_OreDictUnificator.getIngotOrDust(aData.mMaterial),
- GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(0)),
- GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(1)),
- GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(2))
- },
+ new ItemStack[] { GT_OreDictUnificator.getIngotOrDust(aData.mMaterial),
+ GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(0)),
+ GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(1)),
+ GT_OreDictUnificator.getIngotOrDust(aData.getByProduct(2)) },
null,
(int) Math.max(16, tAmount / M),
90,
tHide);
}
- public static void registerReverseMacerating(
- ItemStack aStack,
- Materials aMaterial,
- long aMaterialAmount,
- MaterialStack aByProduct01,
- MaterialStack aByProduct02,
- MaterialStack aByProduct03,
- boolean aAllowHammer) {
+ public static void registerReverseMacerating(ItemStack aStack, Materials aMaterial, long aMaterialAmount,
+ MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03, boolean aAllowHammer) {
registerReverseMacerating(
aStack,
new ItemData(
@@ -376,59 +350,43 @@ public class GT_RecipeRegistrator {
boolean tHide = (aData.mMaterial.mMaterial != Materials.Iron) && (GT_Mod.gregtechproxy.mHideRecyclingRecipes);
RA.addPulveriserRecipe(
aStack,
- new ItemStack[] {
- GT_OreDictUnificator.getDust(aData.mMaterial),
- GT_OreDictUnificator.getDust(aData.getByProduct(0)),
- GT_OreDictUnificator.getDust(aData.getByProduct(1)),
- GT_OreDictUnificator.getDust(aData.getByProduct(2))
- },
+ new ItemStack[] { GT_OreDictUnificator.getDust(aData.mMaterial),
+ GT_OreDictUnificator.getDust(aData.getByProduct(0)),
+ GT_OreDictUnificator.getDust(aData.getByProduct(1)),
+ GT_OreDictUnificator.getDust(aData.getByProduct(2)) },
null,
aData.mMaterial.mMaterial == Materials.Marble ? 1 : (int) Math.max(16, tAmount / M),
4,
tHide);
- if (aAllowHammer)
- for (MaterialStack tMaterial : aData.getAllMaterialStacks())
- if (tMaterial.mMaterial.contains(SubTag.CRYSTAL)
- && !tMaterial.mMaterial.contains(SubTag.METAL)
- && tMaterial.mMaterial != Materials.Glass) {
- if (RA.addForgeHammerRecipe(
- GT_Utility.copyAmount(1, aStack), GT_OreDictUnificator.getDust(aData.mMaterial), 200, 30))
- break;
- }
+ if (aAllowHammer) for (MaterialStack tMaterial : aData.getAllMaterialStacks())
+ if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL)
+ && tMaterial.mMaterial != Materials.Glass) {
+ if (RA.addForgeHammerRecipe(
+ GT_Utility.copyAmount(1, aStack),
+ GT_OreDictUnificator.getDust(aData.mMaterial),
+ 200,
+ 30))
+ break;
+ }
}
/**
* Place Materials which you want to replace in Non-GT-Recipes here (warning HUGHE impact on loading times!)
*/
- private static final Materials[] VANILLA_MATS = {
- Cobalt,
- Gold,
- Iron,
- Lead,
- FierySteel,
- Void,
- Bronze,
- Diamond,
- Ruby,
- Sapphire,
- Steel,
- IronWood,
- Steeleaf,
- Knightmetal,
- Thaumium,
- DarkSteel,
- };
+ private static final Materials[] VANILLA_MATS = { Cobalt, Gold, Iron, Lead, FierySteel, Void, Bronze, Diamond, Ruby,
+ Sapphire, Steel, IronWood, Steeleaf, Knightmetal, Thaumium, DarkSteel, };
/**
- * You give this Function a Material and it will scan almost everything for adding recycling Recipes and replacing Ingots, Gems etc.
+ * You give this Function a Material and it will scan almost everything for adding recycling Recipes and replacing
+ * Ingots, Gems etc.
*
* @param aMats Materials, for example an Ingot or a Gem.
* @param aPlate the Plate referenced to aMat
* @param aRecipeReplacing allows to replace the Recipe with a Plate variant
*/
- public static synchronized void registerUsagesForMaterials(
- String aPlate, boolean aRecipeReplacing, ItemStack... aMats) {
+ public static synchronized void registerUsagesForMaterials(String aPlate, boolean aRecipeReplacing,
+ ItemStack... aMats) {
for (ItemStack aMat : aMats) {
aMat = GT_Utility.copyOrNull(aMat);
@@ -452,13 +410,14 @@ public class GT_RecipeRegistrator {
GT_OreDictUnificator.addItemData(
tCrafted,
new ItemData(
- aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tRecipe.amount1));
+ aItemData.mMaterial.mMaterial,
+ aItemData.mMaterial.mAmount * tRecipe.amount1));
//
// GT_Log.out.println("###################################################################################");
- // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aPlate);
- // GT_Log.out.println("registerUsagesForMaterials used aPlate:
+ // GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aPlate);
+ // GT_Log.out.println("registerUsagesForMaterials used aPlate:
// "+aMat.getUnlocalizedName());
- // GT_Log.out.println("registerUsagesForMaterials used aPlate:
+ // GT_Log.out.println("registerUsagesForMaterials used aPlate:
// "+aMat.getDisplayName());
//
// GT_Log.out.println("###################################################################################");
@@ -484,8 +443,7 @@ public class GT_RecipeRegistrator {
private static Map<RecipeShape, List<IRecipe>> createIndexedRecipeListCache() {
Map<RecipeShape, List<IRecipe>> result = new IdentityHashMap<>();
@SuppressWarnings("unchecked")
- ArrayList<IRecipe> allRecipeList =
- (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
+ ArrayList<IRecipe> allRecipeList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
// filter using the empty slots in the shape.
// if the empty slots doesn't match, the recipe will definitely fail
SetMultimap<List<Integer>, RecipeShape> filter = HashMultimap.create();
@@ -502,8 +460,7 @@ public class GT_RecipeRegistrator {
}
buffer.clear();
ItemStack tStack = tRecipe.getRecipeOutput();
- if (GT_Utility.isStackValid(tStack)
- && tStack.getMaxStackSize() == 1
+ if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1
&& tStack.getMaxDamage() > 0
&& !(tStack.getItem() instanceof ItemBlock)
&& !(tStack.getItem() instanceof IReactorComponent)
@@ -543,8 +500,8 @@ public class GT_RecipeRegistrator {
return result;
}
- private static boolean checkRecipeShape(
- List<Integer> emptySlotIndexesBuffer, Object[] input, int tRecipeWidth, int tRecipeHeight) {
+ private static boolean checkRecipeShape(List<Integer> emptySlotIndexesBuffer, Object[] input, int tRecipeWidth,
+ int tRecipeHeight) {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
if (x >= tRecipeWidth || y >= tRecipeHeight) {
@@ -557,8 +514,7 @@ public class GT_RecipeRegistrator {
continue;
}
if (tObject instanceof ItemStack
- && (((ItemStack) tObject).getItem() == null
- || ((ItemStack) tObject).getMaxStackSize() < 2
+ && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2
|| ((ItemStack) tObject).getMaxDamage() > 0
|| ((ItemStack) tObject).getItem() instanceof ItemBlock)) {
return false;
@@ -583,8 +539,8 @@ public class GT_RecipeRegistrator {
for (int i = 0; i < sShapes.length; i++) {
RecipeShape tRecipe = sShapes[i];
- for (ItemStack tCrafted :
- GT_ModHandler.getRecipeOutputs(getRecipeList(tRecipe), true, tRecipe.shape)) {
+ for (ItemStack tCrafted : GT_ModHandler
+ .getRecipeOutputs(getRecipeList(tRecipe), true, tRecipe.shape)) {
if (aItemData != null && aItemData.hasValidPrefixMaterialData())
GT_OreDictUnificator.addItemData(
tCrafted,
@@ -592,7 +548,8 @@ public class GT_RecipeRegistrator {
aItemData.mMaterial.mMaterial,
aItemData.mMaterial.mAmount * tRecipe.amount1,
new MaterialStack(
- tMaterial, OrePrefixes.stick.mMaterialAmount * tRecipe.amount2)));
+ tMaterial,
+ OrePrefixes.stick.mMaterialAmount * tRecipe.amount2)));
if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) {
assert aItemData != null;
@@ -604,42 +561,28 @@ public class GT_RecipeRegistrator {
switch (sShapesA[i].length) {
case 2:
GT_ModHandler.addCraftingRecipe(
- tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] {
- sShapesA[i][1],
- s_P.charAt(0),
- aPlate,
- s_R.charAt(0),
- OrePrefixes.stick.get(tMaterial),
- s_I.charAt(0),
- aItemData
- });
+ tStack,
+ GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] { sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0),
+ OrePrefixes.stick.get(tMaterial), s_I.charAt(0),
+ aItemData });
break;
case 3:
GT_ModHandler.addCraftingRecipe(
- tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] {
- sShapesA[i][1],
- sShapesA[i][2],
- s_P.charAt(0),
- aPlate,
- s_R.charAt(0),
- OrePrefixes.stick.get(tMaterial),
- s_I.charAt(0),
- aItemData
- });
+ tStack,
+ GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] { sShapesA[i][1], sShapesA[i][2], s_P.charAt(0),
+ aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial),
+ s_I.charAt(0), aItemData });
break;
default:
GT_ModHandler.addCraftingRecipe(
- tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[] {
- sShapesA[i][1],
- sShapesA[i][2],
- sShapesA[i][3],
- s_P.charAt(0),
- aPlate,
- s_R.charAt(0),
- OrePrefixes.stick.get(tMaterial),
- s_I.charAt(0),
- aItemData
- });
+ tStack,
+ GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] { sShapesA[i][1], sShapesA[i][2], sShapesA[i][3],
+ s_P.charAt(0), aPlate, s_R.charAt(0),
+ OrePrefixes.stick.get(tMaterial), s_I.charAt(0),
+ aItemData });
break;
}
}
@@ -653,27 +596,34 @@ public class GT_RecipeRegistrator {
/**
* Registers wiremill recipes for given material using integrated circuits.
- * @param aMaterial material to register
+ *
+ * @param aMaterial material to register
* @param baseDuration base duration ticks for ingot -> 1x wire recipe
- * @param aEUt EU/t for recipe
- * If you provide a proper EU tier for recipe processing then aEUt will be overriden with it.
+ * @param aEUt EU/t for recipe If you provide a proper EU tier for recipe processing then aEUt will be
+ * overriden with it.
*/
public static void registerWiremillRecipes(Materials aMaterial, int baseDuration, int aEUt) {
registerWiremillRecipes(
- aMaterial, baseDuration, calculateRecipeEU(aMaterial, aEUt), OrePrefixes.ingot, OrePrefixes.stick, 2);
+ aMaterial,
+ baseDuration,
+ calculateRecipeEU(aMaterial, aEUt),
+ OrePrefixes.ingot,
+ OrePrefixes.stick,
+ 2);
}
/**
* Registers wiremill recipes for given material using integrated circuits.
- * @param aMaterial material to register
+ *
+ * @param aMaterial material to register
* @param baseDuration base duration ticks for ingot -> 1x wire recipe
- * @param aEUt EU/t for recipe
- * @param prefix1 prefix corresponds to ingot
- * @param prefix2 prefix corresponds to stick
- * @param multiplier amount of wires created from 1 ingot
+ * @param aEUt EU/t for recipe
+ * @param prefix1 prefix corresponds to ingot
+ * @param prefix2 prefix corresponds to stick
+ * @param multiplier amount of wires created from 1 ingot
*/
- public static void registerWiremillRecipes(
- Materials aMaterial, int baseDuration, int aEUt, OrePrefixes prefix1, OrePrefixes prefix2, int multiplier) {
+ public static void registerWiremillRecipes(Materials aMaterial, int baseDuration, int aEUt, OrePrefixes prefix1,
+ OrePrefixes prefix2, int multiplier) {
GT_Values.RA.addWiremillRecipe(
GT_OreDictUnificator.get(prefix1, aMaterial, 1L),
GT_Utility.getIntegratedCircuit(1),
@@ -789,6 +739,7 @@ public class GT_RecipeRegistrator {
}
private static class RecipeShape {
+
private final ItemStack[] shape;
private int amount1;
private int amount2;