aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/util
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
commit0669f5eb9d5029a8b94ec552171b0837605f7747 (patch)
tree6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/xmod/gregtech/api/util
parent3654052fb63a571c5eaca7f20714b87c17f7e966 (diff)
downloadGT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/util')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java798
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java955
2 files changed, 1111 insertions, 642 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java
index ff9d9d47a8..fed71886e3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java
@@ -1,9 +1,5 @@
package gtPlusPlus.xmod.gregtech.api.util;
-import static gregtech.api.enums.GT_Values.E;
-import static gregtech.api.enums.GT_Values.M;
-import static gregtech.api.enums.GT_Values.W;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
@@ -27,336 +23,476 @@ import net.minecraftforge.oredict.OreDictionary;
* <p/>
* This is the Core of my OreDict Unification Code
* <p/>
- * If you just want to use this to unificate your Items, then use the Function in the GregTech_API File
+ * If you just want to use this to unificate your Items, then use the Function
+ * in the GregTech_API File
* <p/>
- * P.S. It is intended to be named "Unificator" and not "Unifier", because that sounds more awesome.
+ * P.S. It is intended to be named "Unificator" and not "Unifier", because that
+ * sounds more awesome.
*/
public class GregtechOreDictUnificator {
- private static final HashMap<String, ItemStack> sName2StackMap = new HashMap<String, ItemStack>();
- private static final HashMap<GT_ItemStack, GregtechItemData> sItemStack2DataMap = new HashMap<GT_ItemStack, GregtechItemData>();
- private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<GT_ItemStack>();
- public static volatile int VERSION = 508;
- private static int isRegisteringOre = 0, isAddingOre = 0;
- private static boolean mRunThroughTheList = true;
-
- static {
- GregTech_API.sItemStackMappings.add(sItemStack2DataMap);
- }
-
- /**
- * The Blacklist just prevents the Item from being unificated into something else.
- * Useful if you have things like the Industrial Diamond, which is better than regular Diamond, but also usable in absolutely all Diamond Recipes.
- */
- public static void addToBlacklist(ItemStack aStack) {
- if (GT_Utility.isStackValid(aStack) && !GT_Utility.isStackInList(aStack, sNoUnificationList))
- sNoUnificationList.add(aStack);
- }
-
- public static boolean isBlacklisted(ItemStack aStack) {
- return GT_Utility.isStackInList(aStack, sNoUnificationList);
- }
-
- public static void add(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack) {
- set(aPrefix, aMaterial, aStack, false, false);
- }
-
- public static void set(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack) {
- set(aPrefix, aMaterial, aStack, true, false);
- }
-
- public static void set(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack, boolean aOverwrite, boolean aAlreadyRegistered) {
- if (aMaterial == null || aPrefix == null || GT_Utility.isStackInvalid(aStack) || Items.feather.getDamage(aStack) == W)
- return;
- isAddingOre++;
- aStack = GT_Utility.copyAmount(1, aStack);
- if (!aAlreadyRegistered) registerOre(aPrefix.get(aMaterial), aStack);
- addAssociation(aPrefix, aMaterial, aStack, isBlacklisted(aStack));
- if (aOverwrite || GT_Utility.isStackInvalid(sName2StackMap.get(aPrefix.get(aMaterial).toString())))
- sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack);
- isAddingOre--;
- }
-
- public static ItemStack getFirstOre(Object aName, long aAmount) {
- if (GT_Utility.isStringInvalid(aName)) return null;
- ItemStack tStack = sName2StackMap.get(aName.toString());
- if (GT_Utility.isStackValid(tStack)) return GT_Utility.copyAmount(aAmount, tStack);
- return GT_Utility.copyAmount(aAmount, getOres(aName).toArray());
- }
-
- public static ItemStack get(Object aName, long aAmount) {
- return get(aName, null, aAmount, true, true);
- }
-
- public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount) {
- return get(aName, aReplacement, aAmount, true, true);
- }
-
- public static ItemStack get(GregtechOrePrefixes aPrefix, Object aMaterial, long aAmount) {
- return get(aPrefix, aMaterial, null, aAmount);
- }
-
- public static ItemStack get(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) {
- return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true);
- }
-
- public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount, boolean aMentionPossibleTypos, boolean aNoInvalidAmounts) {
- if (aNoInvalidAmounts && aAmount < 1) return null;
- if (!sName2StackMap.containsKey(aName.toString()) && aMentionPossibleTypos)
- GT_Log.err.println("Unknown Key for Unification, Typo? " + aName);
- return GT_Utility.copyAmount(aAmount, sName2StackMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement);
- }
-
- public static ItemStack[] setStackArray(boolean aUseBlackList, ItemStack... aStacks) {
- for (int i = 0; i < aStacks.length; i++) aStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i]));
- return aStacks;
- }
-
- public static ItemStack[] getStackArray(boolean aUseBlackList, Object... aStacks) {
- ItemStack[] rStacks = new ItemStack[aStacks.length];
- for (int i = 0; i < aStacks.length; i++) rStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i]));
- return rStacks;
- }
-
- public static ItemStack setStack(ItemStack aStack) {
- return setStack(true, aStack);
- }
-
- public static ItemStack setStack(boolean aUseBlackList, ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) return aStack;
- ItemStack tStack = get(aUseBlackList, aStack);
- if (GT_Utility.areStacksEqual(aStack, tStack)) return aStack;
- aStack.func_150996_a(tStack.getItem());
- Items.feather.setDamage(aStack, Items.feather.getDamage(tStack));
- return aStack;
- }
-
- public static ItemStack get(ItemStack aStack) {
- return get(true, aStack);
- }
-
- public static ItemStack get(boolean aUseBlackList, ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) return null;
- GregtechItemData tPrefixMaterial = getAssociation(aStack);
- ItemStack rStack = null;
- if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData() || (aUseBlackList && tPrefixMaterial.mBlackListed))
- return GT_Utility.copy(aStack);
- if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) {
- tPrefixMaterial.mBlackListed = true;
- return GT_Utility.copy(aStack);
- }
- if (tPrefixMaterial.mUnificationTarget == null)
- tPrefixMaterial.mUnificationTarget = sName2StackMap.get(tPrefixMaterial.toString());
- rStack = tPrefixMaterial.mUnificationTarget;
- if (GT_Utility.isStackInvalid(rStack)) return GT_Utility.copy(aStack);
- assert rStack != null;
- rStack.setTagCompound(aStack.getTagCompound());
- return GT_Utility.copyAmount(aStack.stackSize, rStack);
- }
-
- public static void addItemData(ItemStack aStack, GregtechItemData aData) {
- if (GT_Utility.isStackValid(aStack) && getItemData(aStack) == null && aData != null) setItemData(aStack, aData);
- }
-
- public static void setItemData(ItemStack aStack, GregtechItemData aData) {
- if (GT_Utility.isStackInvalid(aStack) || aData == null) return;
- GregtechItemData tData = getItemData(aStack);
- if (tData == null || !tData.hasValidPrefixMaterialData()) {
- if (tData != null) for (Object tObject : tData.mExtraData)
- if (!aData.mExtraData.contains(tObject)) aData.mExtraData.add(tObject);
- if (aStack.stackSize > 1) {
- if (aData.mMaterial != null) aData.mMaterial.mAmount /= aStack.stackSize;
- for (GregtechMaterialStack tMaterial : aData.mByProducts) tMaterial.mAmount /= aStack.stackSize;
- aStack = GT_Utility.copyAmount(1, aStack);
- }
- sItemStack2DataMap.put(new GT_ItemStack(aStack), aData);
- if (aData.hasValidMaterialData()) {
- long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : M;
- for (GregtechMaterialStack tMaterial : aData.mByProducts)
- tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M;
- if (tValidMaterialAmount < M) GT_ModHandler.addToRecyclerBlackList(aStack);
- }
- if (mRunThroughTheList) {
- if (GregTech_API.sLoadStarted) {
- mRunThroughTheList = false;
- for (Entry<GT_ItemStack, GregtechItemData> tEntry : sItemStack2DataMap.entrySet())
- if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling)
- GregtechRecipeRegistrator.registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue());
- }
- } else {
- if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling)
- GregtechRecipeRegistrator.registerMaterialRecycling(aStack, aData);
- }
- } else {
- for (Object tObject : aData.mExtraData)
- if (!tData.mExtraData.contains(tObject)) tData.mExtraData.add(tObject);
- }
- }
-
- public static void addAssociation(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack, boolean aBlackListed) {
- if (aPrefix == null || aMaterial == null || GT_Utility.isStackInvalid(aStack)) return;
- if (Items.feather.getDamage(aStack) == W) for (byte i = 0; i < 16; i++)
- setItemData(GT_Utility.copyAmountAndMetaData(1, i, aStack), new GregtechItemData(aPrefix, aMaterial, aBlackListed));
- setItemData(aStack, new GregtechItemData(aPrefix, aMaterial, aBlackListed));
- }
-
- public static GregtechItemData getItemData(ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) return null;
- GregtechItemData rData = sItemStack2DataMap.get(new GT_ItemStack(aStack));
- if (rData == null) rData = sItemStack2DataMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack)));
- return rData;
- }
-
- public static GregtechItemData getAssociation(ItemStack aStack) {
- GregtechItemData rData = getItemData(aStack);
- return rData != null && rData.hasValidPrefixMaterialData() ? rData : null;
- }
-
- public static boolean isItemStackInstanceOf(ItemStack aStack, Object aName) {
- if (GT_Utility.isStringInvalid(aName) || GT_Utility.isStackInvalid(aStack)) return false;
- for (ItemStack tOreStack : getOres(aName.toString()))
- if (GT_Utility.areStacksEqual(tOreStack, aStack, true)) return true;
- return false;
- }
-
- public static boolean isItemStackDye(ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) return false;
- for (Dyes tDye : Dyes.VALUES) if (isItemStackInstanceOf(aStack, tDye.toString())) return true;
- return false;
- }
-
- public static boolean registerOre(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aStack) {
- return registerOre(aPrefix.get(aMaterial), aStack);
- }
-
- public static boolean registerOre(Object aName, ItemStack aStack) {
- if (aName == null || GT_Utility.isStackInvalid(aStack)) return false;
- String tName = aName.toString();
- if (GT_Utility.isStringInvalid(tName)) return false;
- ArrayList<ItemStack> tList = getOres(tName);
- for (int i = 0; i < tList.size(); i++) if (GT_Utility.areStacksEqual(tList.get(i), aStack, true)) return false;
- isRegisteringOre++;
- OreDictionary.registerOre(tName, GT_Utility.copyAmount(1, aStack));
- isRegisteringOre--;
- return true;
- }
-
- public static boolean isRegisteringOres() {
- return isRegisteringOre > 0;
- }
-
- public static boolean isAddingOres() {
- return isAddingOre > 0;
- }
-
- public static void resetUnificationEntries() {
- for (GregtechItemData tPrefixMaterial : sItemStack2DataMap.values()) tPrefixMaterial.mUnificationTarget = null;
- }
-
- public static ItemStack getGem(GregtechMaterialStack aMaterial) {
- return aMaterial == null ? null : getGem(aMaterial.mMaterial, aMaterial.mAmount);
- }
-
- public static ItemStack getGem(GT_Materials aMaterial, OrePrefixes aPrefix) {
- return aMaterial == null ? null : getGem(aMaterial, aPrefix.mMaterialAmount);
- }
-
- public static ItemStack getGem(GT_Materials aMaterial, long aMaterialAmount) {
- ItemStack rStack = null;
- if (((aMaterialAmount >= M) || aMaterialAmount >= M * 32))
- rStack = get(GregtechOrePrefixes.gem, aMaterial, aMaterialAmount / M);
- if (rStack == null && (((aMaterialAmount * 2) % M == 0) || aMaterialAmount >= M * 16))
- rStack = get(GregtechOrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M);
- if (rStack == null && (((aMaterialAmount * 4) >= M)))
- rStack = get(GregtechOrePrefixes.gemChipped, aMaterial, (aMaterialAmount * 4) / M);
- return rStack;
- }
-
- public static ItemStack getDust(GregtechMaterialStack aMaterial) {
- return aMaterial == null ? null : getDust(aMaterial.mMaterial, aMaterial.mAmount);
- }
-
- public static ItemStack getDust(GT_Materials aMaterial, OrePrefixes aPrefix) {
- return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount);
- }
-
- public static ItemStack getDust(GT_Materials aMaterial, long aMaterialAmount) {
- if (aMaterialAmount <= 0) return null;
- ItemStack rStack = null;
- if (((aMaterialAmount % M == 0) || aMaterialAmount >= M * 16))
- rStack = get(GregtechOrePrefixes.dust, aMaterial, aMaterialAmount / M);
- if (rStack == null && (((aMaterialAmount * 4) % M == 0) || aMaterialAmount >= M * 8))
- rStack = get(GregtechOrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M);
- if (rStack == null && (((aMaterialAmount * 9) >= M)))
- rStack = get(GregtechOrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M);
- return rStack;
- }
-
- public static ItemStack getIngot(GregtechMaterialStack aMaterial) {
- return aMaterial == null ? null : getIngot(aMaterial.mMaterial, aMaterial.mAmount);
- }
-
- public static ItemStack getIngot(GT_Materials aMaterial, OrePrefixes aPrefix) {
- return aMaterial == null ? null : getIngot(aMaterial, aPrefix.mMaterialAmount);
- }
-
- public static ItemStack getIngot(GT_Materials aMaterial, long aMaterialAmount) {
- if (aMaterialAmount <= 0) return null;
- ItemStack rStack = null;
- if (((aMaterialAmount % (M * 9) == 0 && aMaterialAmount / (M * 9) > 1) || aMaterialAmount >= M * 72))
- rStack = get(GregtechOrePrefixes.block, aMaterial, aMaterialAmount / (M * 9));
- if (rStack == null && ((aMaterialAmount % M == 0) || aMaterialAmount >= M * 8))
- rStack = get(GregtechOrePrefixes.ingot, aMaterial, aMaterialAmount / M);
- if (rStack == null && (((aMaterialAmount * 9) >= M)))
- rStack = get(GregtechOrePrefixes.nugget, aMaterial, (aMaterialAmount * 9) / M);
- return rStack;
- }
-
- public static ItemStack getIngotOrDust(GT_Materials aMaterial, long aMaterialAmount) {
- if (aMaterialAmount <= 0) return null;
- ItemStack rStack = getIngot(aMaterial, aMaterialAmount);
- if (rStack == null) rStack = getDust(aMaterial, aMaterialAmount);
- return rStack;
- }
-
- public static ItemStack getIngotOrDust(GregtechMaterialStack aMaterial) {
- ItemStack rStack = getIngot(aMaterial);
- if(aMaterial!=null&&aMaterial.mMaterial!=null)rStack = getDust(aMaterial);
- if (rStack == null) rStack = getDust(aMaterial);
- return rStack;
- }
-
- public static ItemStack getDustOrIngot(GT_Materials aMaterial, long aMaterialAmount) {
- if (aMaterialAmount <= 0) return null;
- ItemStack rStack = getDust(aMaterial, aMaterialAmount);
- if (rStack == null) rStack = getIngot(aMaterial, aMaterialAmount);
- return rStack;
- }
-
- public static ItemStack getDustOrIngot(GregtechMaterialStack aMaterial) {
- ItemStack rStack = getDust(aMaterial);
- if (rStack == null) rStack = getIngot(aMaterial);
- return rStack;
- }
-
- /**
- * @return a Copy of the OreDictionary.getOres() List
- */
- public static ArrayList<ItemStack> getOres(OrePrefixes aPrefix, Object aMaterial) {
- return getOres(aPrefix.get(aMaterial));
- }
-
- /**
- * @return a Copy of the OreDictionary.getOres() List
- */
- public static ArrayList<ItemStack> getOres(Object aOreName) {
- String aName = aOreName == null ? E : aOreName.toString();
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- if (GT_Utility.isStringValid(aName)) rList.addAll(OreDictionary.getOres(aName));
- return rList;
- }
-
- public static void registerRecipes(OreDictEventContainer tOre) {
+ private static final HashMap<String, ItemStack> sName2StackMap = new HashMap<String, ItemStack>();
+ private static final HashMap<GT_ItemStack, GregtechItemData> sItemStack2DataMap = new HashMap<GT_ItemStack, GregtechItemData>();
+ private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<GT_ItemStack>();
+ public static volatile int VERSION = 508;
+ private static int isRegisteringOre = 0, isAddingOre = 0;
+ private static boolean mRunThroughTheList = true;
+
+ static {
+ GregTech_API.sItemStackMappings.add(GregtechOreDictUnificator.sItemStack2DataMap);
+ }
+
+ public static void add(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final ItemStack aStack) {
+ GregtechOreDictUnificator.set(aPrefix, aMaterial, aStack, false, false);
+ }
+
+ public static void addAssociation(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial,
+ final ItemStack aStack, final boolean aBlackListed) {
+ if (aPrefix == null || aMaterial == null || GT_Utility.isStackInvalid(aStack)) {
+ return;
+ }
+ if (Items.feather.getDamage(aStack) == GT_Values.W) {
+ for (byte i = 0; i < 16; i++) {
+ GregtechOreDictUnificator.setItemData(GT_Utility.copyAmountAndMetaData(1, i, aStack),
+ new GregtechItemData(aPrefix, aMaterial, aBlackListed));
+ }
+ }
+ GregtechOreDictUnificator.setItemData(aStack, new GregtechItemData(aPrefix, aMaterial, aBlackListed));
+ }
+
+ public static void addItemData(final ItemStack aStack, final GregtechItemData aData) {
+ if (GT_Utility.isStackValid(aStack) && GregtechOreDictUnificator.getItemData(aStack) == null && aData != null) {
+ GregtechOreDictUnificator.setItemData(aStack, aData);
+ }
+ }
+
+ /**
+ * The Blacklist just prevents the Item from being unificated into something
+ * else. Useful if you have things like the Industrial Diamond, which is
+ * better than regular Diamond, but also usable in absolutely all Diamond
+ * Recipes.
+ */
+ public static void addToBlacklist(final ItemStack aStack) {
+ if (GT_Utility.isStackValid(aStack)
+ && !GT_Utility.isStackInList(aStack, GregtechOreDictUnificator.sNoUnificationList)) {
+ GregtechOreDictUnificator.sNoUnificationList.add(aStack);
+ }
+ }
+
+ public static ItemStack get(final boolean aUseBlackList, final ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return null;
+ }
+ final GregtechItemData tPrefixMaterial = GregtechOreDictUnificator.getAssociation(aStack);
+ ItemStack rStack = null;
+ if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData()
+ || aUseBlackList && tPrefixMaterial.mBlackListed) {
+ return GT_Utility.copy(aStack);
+ }
+ if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered
+ && GregtechOreDictUnificator.isBlacklisted(aStack)) {
+ tPrefixMaterial.mBlackListed = true;
+ return GT_Utility.copy(aStack);
+ }
+ if (tPrefixMaterial.mUnificationTarget == null) {
+ tPrefixMaterial.mUnificationTarget = GregtechOreDictUnificator.sName2StackMap
+ .get(tPrefixMaterial.toString());
+ }
+ rStack = tPrefixMaterial.mUnificationTarget;
+ if (GT_Utility.isStackInvalid(rStack)) {
+ return GT_Utility.copy(aStack);
+ }
+ assert rStack != null;
+ rStack.setTagCompound(aStack.getTagCompound());
+ return GT_Utility.copyAmount(aStack.stackSize, rStack);
+ }
+
+ public static ItemStack get(final GregtechOrePrefixes aPrefix, final Object aMaterial, final ItemStack aReplacement,
+ final long aAmount) {
+ return GregtechOreDictUnificator.get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true);
+ }
+
+ public static ItemStack get(final GregtechOrePrefixes aPrefix, final Object aMaterial, final long aAmount) {
+ return GregtechOreDictUnificator.get(aPrefix, aMaterial, null, aAmount);
+ }
+
+ public static ItemStack get(final ItemStack aStack) {
+ return GregtechOreDictUnificator.get(true, aStack);
+ }
+
+ public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount) {
+ return GregtechOreDictUnificator.get(aName, aReplacement, aAmount, true, true);
+ }
+
+ public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount,
+ final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) {
+ if (aNoInvalidAmounts && aAmount < 1) {
+ return null;
+ }
+ if (!GregtechOreDictUnificator.sName2StackMap.containsKey(aName.toString()) && aMentionPossibleTypos) {
+ GT_Log.err.println("Unknown Key for Unification, Typo? " + aName);
+ }
+ return GT_Utility.copyAmount(aAmount, GregtechOreDictUnificator.sName2StackMap.get(aName.toString()),
+ GregtechOreDictUnificator.getFirstOre(aName, aAmount), aReplacement);
+ }
+
+ public static ItemStack get(final Object aName, final long aAmount) {
+ return GregtechOreDictUnificator.get(aName, null, aAmount, true, true);
+ }
+
+ public static GregtechItemData getAssociation(final ItemStack aStack) {
+ final GregtechItemData rData = GregtechOreDictUnificator.getItemData(aStack);
+ return rData != null && rData.hasValidPrefixMaterialData() ? rData : null;
+ }
+
+ public static ItemStack getDust(final GregtechMaterialStack aMaterial) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getDust(aMaterial.mMaterial, aMaterial.mAmount);
+ }
+
+ public static ItemStack getDust(final GT_Materials aMaterial, final long aMaterialAmount) {
+ if (aMaterialAmount <= 0) {
+ return null;
+ }
+ ItemStack rStack = null;
+ if (aMaterialAmount % GT_Values.M == 0 || aMaterialAmount >= GT_Values.M * 16) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.dust, aMaterial, aMaterialAmount / GT_Values.M);
+ }
+ if (rStack == null && (aMaterialAmount * 4 % GT_Values.M == 0 || aMaterialAmount >= GT_Values.M * 8)) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.dustSmall, aMaterial,
+ aMaterialAmount * 4 / GT_Values.M);
+ }
+ if (rStack == null && aMaterialAmount * 9 >= GT_Values.M) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.dustTiny, aMaterial,
+ aMaterialAmount * 9 / GT_Values.M);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getDust(final GT_Materials aMaterial, final OrePrefixes aPrefix) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getDust(aMaterial, aPrefix.mMaterialAmount);
+ }
+
+ public static ItemStack getDustOrIngot(final GregtechMaterialStack aMaterial) {
+ ItemStack rStack = GregtechOreDictUnificator.getDust(aMaterial);
+ if (rStack == null) {
+ rStack = GregtechOreDictUnificator.getIngot(aMaterial);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getDustOrIngot(final GT_Materials aMaterial, final long aMaterialAmount) {
+ if (aMaterialAmount <= 0) {
+ return null;
+ }
+ ItemStack rStack = GregtechOreDictUnificator.getDust(aMaterial, aMaterialAmount);
+ if (rStack == null) {
+ rStack = GregtechOreDictUnificator.getIngot(aMaterial, aMaterialAmount);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getFirstOre(final Object aName, final long aAmount) {
+ if (GT_Utility.isStringInvalid(aName)) {
+ return null;
+ }
+ final ItemStack tStack = GregtechOreDictUnificator.sName2StackMap.get(aName.toString());
+ if (GT_Utility.isStackValid(tStack)) {
+ return GT_Utility.copyAmount(aAmount, tStack);
+ }
+ return GT_Utility.copyAmount(aAmount, GregtechOreDictUnificator.getOres(aName).toArray());
+ }
+
+ public static ItemStack getGem(final GregtechMaterialStack aMaterial) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getGem(aMaterial.mMaterial, aMaterial.mAmount);
+ }
+
+ public static ItemStack getGem(final GT_Materials aMaterial, final long aMaterialAmount) {
+ ItemStack rStack = null;
+ if (aMaterialAmount >= GT_Values.M || aMaterialAmount >= GT_Values.M * 32) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.gem, aMaterial, aMaterialAmount / GT_Values.M);
+ }
+ if (rStack == null && (aMaterialAmount * 2 % GT_Values.M == 0 || aMaterialAmount >= GT_Values.M * 16)) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.gemFlawed, aMaterial,
+ aMaterialAmount * 2 / GT_Values.M);
+ }
+ if (rStack == null && aMaterialAmount * 4 >= GT_Values.M) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.gemChipped, aMaterial,
+ aMaterialAmount * 4 / GT_Values.M);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getGem(final GT_Materials aMaterial, final OrePrefixes aPrefix) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getGem(aMaterial, aPrefix.mMaterialAmount);
+ }
+
+ public static ItemStack getIngot(final GregtechMaterialStack aMaterial) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getIngot(aMaterial.mMaterial, aMaterial.mAmount);
+ }
+
+ public static ItemStack getIngot(final GT_Materials aMaterial, final long aMaterialAmount) {
+ if (aMaterialAmount <= 0) {
+ return null;
+ }
+ ItemStack rStack = null;
+ if (aMaterialAmount % (GT_Values.M * 9) == 0 && aMaterialAmount / (GT_Values.M * 9) > 1
+ || aMaterialAmount >= GT_Values.M * 72) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.block, aMaterial,
+ aMaterialAmount / (GT_Values.M * 9));
+ }
+ if (rStack == null && (aMaterialAmount % GT_Values.M == 0 || aMaterialAmount >= GT_Values.M * 8)) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.ingot, aMaterial, aMaterialAmount / GT_Values.M);
+ }
+ if (rStack == null && aMaterialAmount * 9 >= GT_Values.M) {
+ rStack = GregtechOreDictUnificator.get(GregtechOrePrefixes.nugget, aMaterial,
+ aMaterialAmount * 9 / GT_Values.M);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getIngot(final GT_Materials aMaterial, final OrePrefixes aPrefix) {
+ return aMaterial == null ? null : GregtechOreDictUnificator.getIngot(aMaterial, aPrefix.mMaterialAmount);
+ }
+
+ public static ItemStack getIngotOrDust(final GregtechMaterialStack aMaterial) {
+ ItemStack rStack = GregtechOreDictUnificator.getIngot(aMaterial);
+ if (aMaterial != null && aMaterial.mMaterial != null) {
+ rStack = GregtechOreDictUnificator.getDust(aMaterial);
+ }
+ if (rStack == null) {
+ rStack = GregtechOreDictUnificator.getDust(aMaterial);
+ }
+ return rStack;
+ }
+
+ public static ItemStack getIngotOrDust(final GT_Materials aMaterial, final long aMaterialAmount) {
+ if (aMaterialAmount <= 0) {
+ return null;
+ }
+ ItemStack rStack = GregtechOreDictUnificator.getIngot(aMaterial, aMaterialAmount);
+ if (rStack == null) {
+ rStack = GregtechOreDictUnificator.getDust(aMaterial, aMaterialAmount);
+ }
+ return rStack;
+ }
+
+ public static GregtechItemData getItemData(final ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return null;
+ }
+ GregtechItemData rData = GregtechOreDictUnificator.sItemStack2DataMap.get(new GT_ItemStack(aStack));
+ if (rData == null) {
+ rData = GregtechOreDictUnificator.sItemStack2DataMap
+ .get(new GT_ItemStack(GT_Utility.copyMetaData(GT_Values.W, aStack)));
+ }
+ return rData;
+ }
+
+ /**
+ * @return a Copy of the OreDictionary.getOres() List
+ */
+ public static ArrayList<ItemStack> getOres(final Object aOreName) {
+ final String aName = aOreName == null ? GT_Values.E : aOreName.toString();
+ final ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStringValid(aName)) {
+ rList.addAll(OreDictionary.getOres(aName));
+ }
+ return rList;
+ }
+
+ /**
+ * @return a Copy of the OreDictionary.getOres() List
+ */
+ public static ArrayList<ItemStack> getOres(final OrePrefixes aPrefix, final Object aMaterial) {
+ return GregtechOreDictUnificator.getOres(aPrefix.get(aMaterial));
+ }
+
+ public static ItemStack[] getStackArray(final boolean aUseBlackList, final Object... aStacks) {
+ final ItemStack[] rStacks = new ItemStack[aStacks.length];
+ for (int i = 0; i < aStacks.length; i++) {
+ rStacks[i] = GregtechOreDictUnificator.get(aUseBlackList, GT_Utility.copy(aStacks[i]));
+ }
+ return rStacks;
+ }
+
+ public static boolean isAddingOres() {
+ return GregtechOreDictUnificator.isAddingOre > 0;
+ }
+
+ public static boolean isBlacklisted(final ItemStack aStack) {
+ return GT_Utility.isStackInList(aStack, GregtechOreDictUnificator.sNoUnificationList);
+ }
+
+ public static boolean isItemStackDye(final ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return false;
+ }
+ for (final Dyes tDye : Dyes.VALUES) {
+ if (GregtechOreDictUnificator.isItemStackInstanceOf(aStack, tDye.toString())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isItemStackInstanceOf(final ItemStack aStack, final Object aName) {
+ if (GT_Utility.isStringInvalid(aName) || GT_Utility.isStackInvalid(aStack)) {
+ return false;
+ }
+ for (final ItemStack tOreStack : GregtechOreDictUnificator.getOres(aName.toString())) {
+ if (GT_Utility.areStacksEqual(tOreStack, aStack, true)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isRegisteringOres() {
+ return GregtechOreDictUnificator.isRegisteringOre > 0;
+ }
+
+ public static boolean registerOre(final GregtechOrePrefixes aPrefix, final Object aMaterial,
+ final ItemStack aStack) {
+ return GregtechOreDictUnificator.registerOre(aPrefix.get(aMaterial), aStack);
+ }
+
+ public static boolean registerOre(final Object aName, final ItemStack aStack) {
+ if (aName == null || GT_Utility.isStackInvalid(aStack)) {
+ return false;
+ }
+ final String tName = aName.toString();
+ if (GT_Utility.isStringInvalid(tName)) {
+ return false;
+ }
+ final ArrayList<ItemStack> tList = GregtechOreDictUnificator.getOres(tName);
+ for (int i = 0; i < tList.size(); i++) {
+ if (GT_Utility.areStacksEqual(tList.get(i), aStack, true)) {
+ return false;
+ }
+ }
+ GregtechOreDictUnificator.isRegisteringOre++;
+ OreDictionary.registerOre(tName, GT_Utility.copyAmount(1, aStack));
+ GregtechOreDictUnificator.isRegisteringOre--;
+ return true;
+ }
+
+ public static void registerRecipes(final OreDictEventContainer tOre) {
// TODO Auto-generated method stub
-
+
+ }
+
+ public static void resetUnificationEntries() {
+ for (final GregtechItemData tPrefixMaterial : GregtechOreDictUnificator.sItemStack2DataMap.values()) {
+ tPrefixMaterial.mUnificationTarget = null;
+ }
+ }
+
+ public static void set(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final ItemStack aStack) {
+ GregtechOreDictUnificator.set(aPrefix, aMaterial, aStack, true, false);
+ }
+
+ public static void set(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, ItemStack aStack,
+ final boolean aOverwrite, final boolean aAlreadyRegistered) {
+ if (aMaterial == null || aPrefix == null || GT_Utility.isStackInvalid(aStack)
+ || Items.feather.getDamage(aStack) == GT_Values.W) {
+ return;
+ }
+ GregtechOreDictUnificator.isAddingOre++;
+ aStack = GT_Utility.copyAmount(1, aStack);
+ if (!aAlreadyRegistered) {
+ GregtechOreDictUnificator.registerOre(aPrefix.get(aMaterial), aStack);
+ }
+ GregtechOreDictUnificator.addAssociation(aPrefix, aMaterial, aStack,
+ GregtechOreDictUnificator.isBlacklisted(aStack));
+ if (aOverwrite || GT_Utility
+ .isStackInvalid(GregtechOreDictUnificator.sName2StackMap.get(aPrefix.get(aMaterial).toString()))) {
+ GregtechOreDictUnificator.sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack);
+ }
+ GregtechOreDictUnificator.isAddingOre--;
+ }
+
+ public static void setItemData(ItemStack aStack, final GregtechItemData aData) {
+ if (GT_Utility.isStackInvalid(aStack) || aData == null) {
+ return;
+ }
+ final GregtechItemData tData = GregtechOreDictUnificator.getItemData(aStack);
+ if (tData == null || !tData.hasValidPrefixMaterialData()) {
+ if (tData != null) {
+ for (final Object tObject : tData.mExtraData) {
+ if (!aData.mExtraData.contains(tObject)) {
+ aData.mExtraData.add(tObject);
+ }
+ }
+ }
+ if (aStack.stackSize > 1) {
+ if (aData.mMaterial != null) {
+ aData.mMaterial.mAmount /= aStack.stackSize;
+ }
+ for (final GregtechMaterialStack tMaterial : aData.mByProducts) {
+ tMaterial.mAmount /= aStack.stackSize;
+ }
+ aStack = GT_Utility.copyAmount(1, aStack);
+ }
+ GregtechOreDictUnificator.sItemStack2DataMap.put(new GT_ItemStack(aStack), aData);
+ if (aData.hasValidMaterialData()) {
+ long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0
+ : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : GT_Values.M;
+ for (final GregtechMaterialStack tMaterial : aData.mByProducts) {
+ tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0
+ : tMaterial.mAmount >= 0 ? tMaterial.mAmount : GT_Values.M;
+ }
+ if (tValidMaterialAmount < GT_Values.M) {
+ GT_ModHandler.addToRecyclerBlackList(aStack);
+ }
+ }
+ if (GregtechOreDictUnificator.mRunThroughTheList) {
+ if (GregTech_API.sLoadStarted) {
+ GregtechOreDictUnificator.mRunThroughTheList = false;
+ for (final Entry<GT_ItemStack, GregtechItemData> tEntry : GregtechOreDictUnificator.sItemStack2DataMap
+ .entrySet()) {
+ if (!tEntry.getValue().hasValidPrefixData()
+ || tEntry.getValue().mPrefix.mAllowNormalRecycling) {
+ GregtechRecipeRegistrator.registerMaterialRecycling(tEntry.getKey().toStack(),
+ tEntry.getValue());
+ }
+ }
+ }
+ }
+ else {
+ if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) {
+ GregtechRecipeRegistrator.registerMaterialRecycling(aStack, aData);
+ }
+ }
+ }
+ else {
+ for (final Object tObject : aData.mExtraData) {
+ if (!tData.mExtraData.contains(tObject)) {
+ tData.mExtraData.add(tObject);
+ }
+ }
+ }
+ }
+
+ public static ItemStack setStack(final boolean aUseBlackList, final ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return aStack;
+ }
+ final ItemStack tStack = GregtechOreDictUnificator.get(aUseBlackList, aStack);
+ if (GT_Utility.areStacksEqual(aStack, tStack)) {
+ return aStack;
+ }
+ aStack.func_150996_a(tStack.getItem());
+ Items.feather.setDamage(aStack, Items.feather.getDamage(tStack));
+ return aStack;
+ }
+
+ public static ItemStack setStack(final ItemStack aStack) {
+ return GregtechOreDictUnificator.setStack(true, aStack);
+ }
+
+ public static ItemStack[] setStackArray(final boolean aUseBlackList, final ItemStack... aStacks) {
+ for (int i = 0; i < aStacks.length; i++) {
+ aStacks[i] = GregtechOreDictUnificator.get(aUseBlackList, GT_Utility.copy(aStacks[i]));
+ }
+ return aStacks;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java
index 89245f0689..8b2f21732d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java
@@ -1,9 +1,5 @@
package gtPlusPlus.xmod.gregtech.api.util;
-import static gregtech.api.enums.GT_Values.L;
-import static gregtech.api.enums.GT_Values.M;
-import static gregtech.api.enums.GT_Values.RA;
-
import java.util.*;
import gregtech.api.GregTech_API;
@@ -25,311 +21,648 @@ import net.minecraft.item.ItemStack;
* Class for Automatic Recipe registering.
*/
public class GregtechRecipeRegistrator {
- /**
- * List of GT_Materials, which are used in the Creation of Sticks. All Rod GT_Materials are automatically added to this List.
- */
- public static final List<GT_Materials> sRodMaterialList = new ArrayList<GT_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 ItemStack[][]
- sShapes1 = new ItemStack[][]{
- {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null},
- {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1},
- {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1},
- {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null},
- {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1},
- {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1},
- {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1},
- {null, sMt1, null, null, sMt1, null, null, sMt2, null},
- {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null},
- {null, sMt1, null, null, sMt2, null, null, sMt2, null},
- {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null},
- {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null},
- {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null},
- {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null},
- {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2},
- {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null},
- {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2},
- {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null},
- {null, sMt2, null, null, sMt1, null, null, sMt1, null},
- {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1},
- {null, sMt2, null, null, sMt2, null, null, sMt1, null},
- {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null},
- {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1},
- {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null},
- {sMt1, null, null, null, sMt2, null, null, null, sMt2},
- {null, null, sMt1, null, sMt2, null, sMt2, null, null},
- {sMt1, null, null, null, sMt2, null, null, null, null},
- {null, null, sMt1, null, sMt2, null, null, null, null},
- {sMt1, sMt2, null, null, null, null, null, null, null},
- {sMt2, sMt1, null, null, null, null, null, null, null},
- {sMt1, null, null, sMt2, null, null, null, null, null},
- {sMt2, null, null, sMt1, null, null, null, null, null},
- {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null},
- {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null},
- {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1},
- {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1},
- {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null},
- {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null},
- {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1},
- {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1},
- {sMt1, null, null, null, sMt1, null, null, null, null},
- {null, sMt1, null, sMt1, null, null, null, null, null},
- {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null},
- {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2}
- };
- 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 = 508;
-
- public static void registerMaterialRecycling(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByproduct) {
- if (GT_Utility.isStackInvalid(aStack)) return;
- if (aByproduct != null) {
- aByproduct = aByproduct.clone();
- aByproduct.mAmount /= aStack.stackSize;
- }
- GregtechOreDictUnificator.addItemData(GT_Utility.copyAmount(1, aStack), new GregtechItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct));
- }
-
- public static void registerMaterialRecycling(ItemStack aStack, GregtechItemData aData) {
- if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) || aData == null || !aData.hasValidMaterialData() || aData.mMaterial.mAmount <= 0 || GT_Utility.getFluidForFilledItem(aStack, false) != null)
- return;
- registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null);
- registerReverseSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true);
- registerReverseFluidSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0));
- registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData);
- }
-
- /**
- * @param aStack the stack to be recycled.
- * @param aMaterial the Material.
- * @param aMaterialAmount the amount of it in Material Units.
- */
- public static void registerReverseFluidSmelting(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByproduct) {
- if (aStack == null || aMaterial == null || aMaterial.mSmeltInto.mStandardMoltenFluid == null || !aMaterial.contains(SubTag.SMELTING_TO_FLUID) || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0)
- return;
- RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, aStack), aByproduct == null ? null : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL) ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) ? GregtechOreDictUnificator.getDust(GT_Materials._NULL, aByproduct.mAmount / 2) : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GregtechOreDictUnificator.getDustOrIngot(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) : null : GregtechOreDictUnificator.getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount), aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)), 10000, (int) Math.max(1, (24 * aMaterialAmount) / M), Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature())));
- }
-
- /**
- * @param aStack the stack to be recycled.
- * @param aMaterial the Material.
- * @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, GT_Materials aMaterial, long aMaterialAmount, boolean aAllowAlloySmelter) {
- if (aStack == null || aMaterial == null || aMaterialAmount <= 0 || aMaterial.contains(SubTag.NO_SMELTING) || (aMaterialAmount > M && aMaterial.contains(SubTag.METAL)))
- return;
- aMaterialAmount /= aStack.stackSize;
-
- if (aAllowAlloySmelter)
- CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
- else
- GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
- }
-
- public static void registerReverseArcSmelting(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByProduct01, GregtechMaterialStack aByProduct02, GregtechMaterialStack aByProduct03) {
- registerReverseArcSmelting(aStack, new GregtechItemData(aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03));
- }
-
- public static void registerReverseArcSmelting(ItemStack aStack, GregtechItemData aData) {
- if (aStack == null || aData == null) return;
- aData = new GregtechItemData(aData);
-
- if (!aData.hasValidMaterialData()) return;
-
- for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
- if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) {
- tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto;
- continue;
- }
- if (tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) {
- tMaterial.mAmount /= 4;
- continue;
- }
- if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) {
- tMaterial.mAmount /= 2;
- continue;
- }
- if (tMaterial.mMaterial.contains(SubTag.NO_SMELTING)) {
- tMaterial.mAmount = 0;
- continue;
- }
- if (tMaterial.mMaterial.contains(SubTag.METAL)) {
- tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto;
- continue;
- }
- tMaterial.mAmount = 0;
- }
-
- aData = new GregtechItemData(aData);
-
- if (aData.mByProducts.length > 3) for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks())
-
- aData = new GregtechItemData(aData);
-
- if (!aData.hasValidMaterialData()) return;
-
- long tAmount = 0;
- for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks())
- tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass();
-
- RA.addArcFurnaceRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getIngotOrDust(aData.mMaterial), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(0)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(1)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 96);
- }
-
- public static void registerReverseMacerating(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByProduct01, GregtechMaterialStack aByProduct02, GregtechMaterialStack aByProduct03, boolean aAllowHammer) {
- registerReverseMacerating(aStack, new GregtechItemData(aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03), aAllowHammer);
- }
-
- public static void registerReverseMacerating(ItemStack aStack, GregtechItemData aData, boolean aAllowHammer) {
- if (aStack == null || aData == null) return;
- aData = new GregtechItemData(aData);
-
- if (!aData.hasValidMaterialData()) return;
-
- for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks())
- tMaterial.mMaterial = tMaterial.mMaterial.mMacerateInto;
-
- aData = new GregtechItemData(aData);
-
- if (!aData.hasValidMaterialData()) return;
-
- long tAmount = 0;
- for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks())
- tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass();
-
- RA.addPulveriserRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getDust(aData.mMaterial), GregtechOreDictUnificator.getDust(aData.getByProduct(0)), GregtechOreDictUnificator.getDust(aData.getByProduct(1)), GregtechOreDictUnificator.getDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 4);
-
- if (aAllowHammer) for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks())
- if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL)) {
- if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getDust(aData.mMaterial), 200, 32))
- break;
- }
- ItemStack tDust = GregtechOreDictUnificator.getDust(aData.mMaterial);
- if (tDust != null && GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1, aStack), tDust, GregtechOreDictUnificator.getDust(aData.getByProduct(0)), 100, GregtechOreDictUnificator.getDust(aData.getByProduct(1)), 100, true)) {
- if (GregTech_API.sThaumcraftCompat != null)
- GregTech_API.sThaumcraftCompat.addCrucibleRecipe(IThaumcraftCompat.ADVANCEDENTROPICPROCESSING, aStack, tDust, Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, Math.max(1, (aData.mMaterial.mAmount * 2) / M))));
- }
- }
-
- /**
- * You give this Function a Material and it will scan almost everything for adding recycling Recipes
- *
- * @param aMat a Material, for example an Ingot or a Gem.
- * @param aOutput the Dust you usually get from macerating aMat
- * @param aRecipeReplacing allows to replace the Recipe with a Plate variant
- */
- public static synchronized void registerUsagesForGT_Materials(ItemStack aMat, String aPlate, boolean aRecipeReplacing) {
- if (aMat == null) return;
- aMat = GT_Utility.copy(aMat);
- ItemStack tStack;
- GregtechItemData aItemData = GregtechOreDictUnificator.getItemData(aMat);
- if (aItemData == null || aItemData.mPrefix != GregtechOrePrefixes.ingot) aPlate = null;
- if (aPlate != null && GregtechOreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null;
-
- sMt1.func_150996_a(aMat.getItem());
- sMt1.stackSize = 1;
- Items.feather.setDamage(sMt1, Items.feather.getDamage(aMat));
-
- sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem());
- sMt2.stackSize = 1;
- Items.feather.setDamage(sMt2, 0);
-
- for (ItemStack[] tRecipe : sShapes1) {
- int tAmount1 = 0;
- for (ItemStack tMat : tRecipe) {
- if (tMat == sMt1) tAmount1++;
- }
- if (aItemData != null && aItemData.hasValidPrefixMaterialData())
- for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) {
- GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1));
- }
- }
-
- for (GT_Materials tMaterial : sRodMaterialList) {
- ItemStack tMt2 = GregtechOreDictUnificator.get(GregtechOrePrefixes.stick, tMaterial, 1);
- if (tMt2 != null) {
- sMt2.func_150996_a(tMt2.getItem());
- sMt2.stackSize = 1;
- Items.feather.setDamage(sMt2, Items.feather.getDamage(tMt2));
-
- for (int i = 0; i < sShapes1.length; i++) {
- ItemStack[] tRecipe = sShapes1[i];
-
- int tAmount1 = 0, tAmount2 = 0;
- for (ItemStack tMat : tRecipe) {
- if (tMat == sMt1) tAmount1++;
- if (tMat == sMt2) tAmount2++;
- }
- for (ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) {
- if (aItemData != null && aItemData.hasValidPrefixMaterialData())
- GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new GregtechMaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2)));
-
- if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) {
- assert aItemData != null;
- if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) {
- if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) {
- 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});
- 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});
- 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});
- break;
- }
- }
- }
- }
- }
- }
- }
- }
- }
+ /**
+ * List of GT_Materials, which are used in the Creation of Sticks. All Rod
+ * GT_Materials are automatically added to this List.
+ */
+ public static final List<GT_Materials> sRodMaterialList = new ArrayList<GT_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 ItemStack[][] sShapes1 = new ItemStack[][] {
+ {
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt1, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt1
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, null, null, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, null, null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, null, GregtechRecipeRegistrator.sMt1, null, null,
+ GregtechRecipeRegistrator.sMt2, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, null, GregtechRecipeRegistrator.sMt2, null, null,
+ GregtechRecipeRegistrator.sMt2, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2, null, null,
+ GregtechRecipeRegistrator.sMt2, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt2, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null, null,
+ GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, null, null, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, null, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt1, null, null, GregtechRecipeRegistrator.sMt2
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2, null, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt1, null, null,
+ GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null, null,
+ GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt2, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, null, null, GregtechRecipeRegistrator.sMt2, null, null, null,
+ GregtechRecipeRegistrator.sMt2
+ }, {
+ null, null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt2, null,
+ GregtechRecipeRegistrator.sMt2, null, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, null, null, GregtechRecipeRegistrator.sMt2, null, null, null,
+ null
+ }, {
+ null, null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt2, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2, null, null, null, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1, null, null, null, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, null, GregtechRecipeRegistrator.sMt2, null, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt2, null, null, GregtechRecipeRegistrator.sMt1, null, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt2, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt2, null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt2,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1,
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ null, GregtechRecipeRegistrator.sMt2, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1
+ }, {
+ GregtechRecipeRegistrator.sMt1, null, null, null, GregtechRecipeRegistrator.sMt1, null, null, null,
+ null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt1, null, null, null, null,
+ null
+ }, {
+ GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1, null,
+ GregtechRecipeRegistrator.sMt2, null, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt2, null, null
+ }, {
+ null, GregtechRecipeRegistrator.sMt1, GregtechRecipeRegistrator.sMt1,
+ GregtechRecipeRegistrator.sMt1, null, GregtechRecipeRegistrator.sMt2, null, null,
+ GregtechRecipeRegistrator.sMt2
+ }
+ };
+ private static final String[][] sShapesA = new String[][] {
+ null, null, null, {
+ "Helmet",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P
+ }, {
+ "ChestPlate",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P
+ }, {
+ "Pants",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + " " + GregtechRecipeRegistrator.s_P
+ }, {
+ "Boots", GregtechRecipeRegistrator.s_P + " " + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P
+ }, {
+ "Sword", " " + GregtechRecipeRegistrator.s_P + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H,
+ " " + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Pickaxe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_I,
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_H,
+ " " + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Shovel",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H,
+ " " + GregtechRecipeRegistrator.s_R + " ", " " + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Axe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Axe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Hoe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ " " + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Hoe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ " " + GregtechRecipeRegistrator.s_R + " "
+ }, {
+ "Sickle", " " + GregtechRecipeRegistrator.s_P + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F + " ",
+ GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Sickle", " " + GregtechRecipeRegistrator.s_P + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F + " ",
+ GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Sickle", " " + GregtechRecipeRegistrator.s_P + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F + " ",
+ GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Sickle", " " + GregtechRecipeRegistrator.s_P + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F + " ",
+ GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Sword", " " + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H,
+ " " + GregtechRecipeRegistrator.s_P + " "
+ }, {
+ "Pickaxe", " " + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_I
+ }, {
+ "Shovel", " " + GregtechRecipeRegistrator.s_R + " ", " " + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H
+ }, {
+ "Axe", GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H
+ }, {
+ "Axe", GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H
+ }, {
+ "Hoe", " " + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H
+ }, {
+ "Hoe", " " + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_H
+ }, {
+ "Spear", GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ " " + " " + GregtechRecipeRegistrator.s_R
+ }, {
+ "Spear", GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H + " ",
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + " ",
+ " " + " " + GregtechRecipeRegistrator.s_R
+ }, {
+ "Knive", GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_F
+ }, {
+ "Knive", GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Knive", GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R
+ }, {
+ "Knive", GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F,
+ GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_H
+ }, {
+ "Knive", GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F,
+ GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_H
+ }, null, null, null, null, {
+ "WarAxe",
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_H
+ }, null, null, null, {
+ "Shears", GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F
+ }, {
+ "Shears", GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F
+ }, {
+ "Scythe",
+ GregtechRecipeRegistrator.s_I + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_H,
+ GregtechRecipeRegistrator.s_R + GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_P,
+ GregtechRecipeRegistrator.s_R + " " + " "
+ }, {
+ "Scythe",
+ GregtechRecipeRegistrator.s_H + GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_I,
+ GregtechRecipeRegistrator.s_P + GregtechRecipeRegistrator.s_F + GregtechRecipeRegistrator.s_R,
+ " " + " " + GregtechRecipeRegistrator.s_R
+ }
+ };
+ public static volatile int VERSION = 508;
+
+ public static void registerMaterialRecycling(final ItemStack aStack, final GregtechItemData aData) {
+ if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack)
+ || aData == null || !aData.hasValidMaterialData() || aData.mMaterial.mAmount <= 0
+ || GT_Utility.getFluidForFilledItem(aStack, false) != null) {
+ return;
+ }
+ GregtechRecipeRegistrator.registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData,
+ aData.mPrefix == null);
+ GregtechRecipeRegistrator.registerReverseSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial,
+ aData.mMaterial.mAmount, true);
+ GregtechRecipeRegistrator.registerReverseFluidSmelting(GT_Utility.copyAmount(1, aStack),
+ aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0));
+ GregtechRecipeRegistrator.registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData);
+ }
+
+ public static void registerMaterialRecycling(final ItemStack aStack, final GT_Materials aMaterial,
+ final long aMaterialAmount, GregtechMaterialStack aByproduct) {
+ if (GT_Utility.isStackInvalid(aStack)) {
+ return;
+ }
+ if (aByproduct != null) {
+ aByproduct = aByproduct.clone();
+ aByproduct.mAmount /= aStack.stackSize;
+ }
+ GregtechOreDictUnificator.addItemData(GT_Utility.copyAmount(1, aStack),
+ new GregtechItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct));
+ }
+
+ public static void registerReverseArcSmelting(final ItemStack aStack, GregtechItemData aData) {
+ if (aStack == null || aData == null) {
+ return;
+ }
+ aData = new GregtechItemData(aData);
+
+ if (!aData.hasValidMaterialData()) {
+ return;
+ }
+
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) {
+ tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto;
+ continue;
+ }
+ if (tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) {
+ tMaterial.mAmount /= 4;
+ continue;
+ }
+ if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) {
+ tMaterial.mAmount /= 2;
+ continue;
+ }
+ if (tMaterial.mMaterial.contains(SubTag.NO_SMELTING)) {
+ tMaterial.mAmount = 0;
+ continue;
+ }
+ if (tMaterial.mMaterial.contains(SubTag.METAL)) {
+ tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto;
+ continue;
+ }
+ tMaterial.mAmount = 0;
+ }
+
+ aData = new GregtechItemData(aData);
+
+ if (aData.mByProducts.length > 3) {
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ aData = new GregtechItemData(aData);
+ }
+ }
+
+ if (!aData.hasValidMaterialData()) {
+ return;
+ }
+
+ long tAmount = 0;
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass();
+ }
+
+ GT_Values.RA.addArcFurnaceRecipe(aStack, new ItemStack[] {
+ GregtechOreDictUnificator.getIngotOrDust(aData.mMaterial),
+ GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(0)),
+ GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(1)),
+ GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(2))
+ }, null, (int) Math.max(16, tAmount / GT_Values.M), 96);
+ }
+
+ public static void registerReverseArcSmelting(final ItemStack aStack, final GT_Materials aMaterial,
+ final long aMaterialAmount, final GregtechMaterialStack aByProduct01,
+ final GregtechMaterialStack aByProduct02, final GregtechMaterialStack aByProduct03) {
+ GregtechRecipeRegistrator.registerReverseArcSmelting(aStack,
+ new GregtechItemData(aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aMaterialAmount),
+ aByProduct01, aByProduct02, aByProduct03));
+ }
+
+ /**
+ * @param aStack
+ * the stack to be recycled.
+ * @param aMaterial
+ * the Material.
+ * @param aMaterialAmount
+ * the amount of it in Material Units.
+ */
+ public static void registerReverseFluidSmelting(final ItemStack aStack, final GT_Materials aMaterial,
+ final long aMaterialAmount, final GregtechMaterialStack aByproduct) {
+ if (aStack == null || aMaterial == null || aMaterial.mSmeltInto.mStandardMoltenFluid == null
+ || !aMaterial.contains(SubTag.SMELTING_TO_FLUID)
+ || GT_Values.L * aMaterialAmount / (GT_Values.M * aStack.stackSize) <= 0) {
+ return;
+ }
+ GT_Values.RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, aStack), aByproduct == null ? null
+ : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL)
+ ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE)
+ ? GregtechOreDictUnificator.getDust(GT_Materials._NULL, aByproduct.mAmount / 2)
+ : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GregtechOreDictUnificator
+ .getDustOrIngot(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) : null
+ : GregtechOreDictUnificator.getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount),
+ aMaterial.mSmeltInto.getMolten(GT_Values.L * aMaterialAmount / (GT_Values.M * aStack.stackSize)), 10000,
+ (int) Math.max(1, 24 * aMaterialAmount / GT_Values.M),
+ Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature())));
+ }
+
+ public static void registerReverseMacerating(final ItemStack aStack, GregtechItemData aData,
+ final boolean aAllowHammer) {
+ if (aStack == null || aData == null) {
+ return;
+ }
+ aData = new GregtechItemData(aData);
+
+ if (!aData.hasValidMaterialData()) {
+ return;
+ }
+
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ tMaterial.mMaterial = tMaterial.mMaterial.mMacerateInto;
+ }
+
+ aData = new GregtechItemData(aData);
+
+ if (!aData.hasValidMaterialData()) {
+ return;
+ }
+
+ long tAmount = 0;
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass();
+ }
+
+ GT_Values.RA.addPulveriserRecipe(aStack, new ItemStack[] {
+ GregtechOreDictUnificator.getDust(aData.mMaterial),
+ GregtechOreDictUnificator.getDust(aData.getByProduct(0)),
+ GregtechOreDictUnificator.getDust(aData.getByProduct(1)),
+ GregtechOreDictUnificator.getDust(aData.getByProduct(2))
+ }, null, (int) Math.max(16, tAmount / GT_Values.M), 4);
+
+ if (aAllowHammer) {
+ for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) {
+ if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL)) {
+ if (GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack),
+ GregtechOreDictUnificator.getDust(aData.mMaterial), 200, 32)) {
+ break;
+ }
+ }
+ }
+ }
+ final ItemStack tDust = GregtechOreDictUnificator.getDust(aData.mMaterial);
+ if (tDust != null && GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1, aStack), tDust,
+ GregtechOreDictUnificator.getDust(aData.getByProduct(0)), 100,
+ GregtechOreDictUnificator.getDust(aData.getByProduct(1)), 100, true)) {
+ if (GregTech_API.sThaumcraftCompat != null) {
+ GregTech_API.sThaumcraftCompat.addCrucibleRecipe(IThaumcraftCompat.ADVANCEDENTROPICPROCESSING, aStack,
+ tDust, Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO,
+ Math.max(1, aData.mMaterial.mAmount * 2 / GT_Values.M))));
+ }
+ }
+ }
+
+ public static void registerReverseMacerating(final ItemStack aStack, final GT_Materials aMaterial,
+ final long aMaterialAmount, final GregtechMaterialStack aByProduct01,
+ final GregtechMaterialStack aByProduct02, final GregtechMaterialStack aByProduct03,
+ final boolean aAllowHammer) {
+ GregtechRecipeRegistrator.registerReverseMacerating(aStack,
+ new GregtechItemData(aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aMaterialAmount),
+ aByProduct01, aByProduct02, aByProduct03),
+ aAllowHammer);
+ }
+
+ /**
+ * @param aStack
+ * the stack to be recycled.
+ * @param aMaterial
+ * the Material.
+ * @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(final ItemStack aStack, final GT_Materials aMaterial,
+ long aMaterialAmount, final boolean aAllowAlloySmelter) {
+ if (aStack == null || aMaterial == null || aMaterialAmount <= 0 || aMaterial.contains(SubTag.NO_SMELTING)
+ || aMaterialAmount > GT_Values.M && aMaterial.contains(SubTag.METAL)) {
+ return;
+ }
+ aMaterialAmount /= aStack.stackSize;
+
+ if (aAllowAlloySmelter) {
+ CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(GT_Utility.copyAmount(1, aStack),
+ GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
+ }
+ else {
+ GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1, aStack),
+ GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount));
+ }
+ }
+
+ /**
+ * You give this Function a Material and it will scan almost everything for
+ * adding recycling Recipes
+ *
+ * @param aMat
+ * a Material, for example an Ingot or a Gem.
+ * @param aOutput
+ * the Dust you usually get from macerating aMat
+ * @param aRecipeReplacing
+ * allows to replace the Recipe with a Plate variant
+ */
+ public static synchronized void registerUsagesForGT_Materials(ItemStack aMat, String aPlate,
+ final boolean aRecipeReplacing) {
+ if (aMat == null) {
+ return;
+ }
+ aMat = GT_Utility.copy(aMat);
+ ItemStack tStack;
+ final GregtechItemData aItemData = GregtechOreDictUnificator.getItemData(aMat);
+ if (aItemData == null || aItemData.mPrefix != GregtechOrePrefixes.ingot) {
+ aPlate = null;
+ }
+ if (aPlate != null && GregtechOreDictUnificator.getFirstOre(aPlate, 1) == null) {
+ aPlate = null;
+ }
+
+ GregtechRecipeRegistrator.sMt1.func_150996_a(aMat.getItem());
+ GregtechRecipeRegistrator.sMt1.stackSize = 1;
+ Items.feather.setDamage(GregtechRecipeRegistrator.sMt1, Items.feather.getDamage(aMat));
+
+ GregtechRecipeRegistrator.sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem());
+ GregtechRecipeRegistrator.sMt2.stackSize = 1;
+ Items.feather.setDamage(GregtechRecipeRegistrator.sMt2, 0);
+
+ for (final ItemStack[] tRecipe : GregtechRecipeRegistrator.sShapes1) {
+ int tAmount1 = 0;
+ for (final ItemStack tMat : tRecipe) {
+ if (tMat == GregtechRecipeRegistrator.sMt1) {
+ tAmount1++;
+ }
+ }
+ if (aItemData != null && aItemData.hasValidPrefixMaterialData()) {
+ for (final ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) {
+ GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial,
+ aItemData.mMaterial.mAmount * tAmount1));
+ }
+ }
+ }
+
+ for (final GT_Materials tMaterial : GregtechRecipeRegistrator.sRodMaterialList) {
+ final ItemStack tMt2 = GregtechOreDictUnificator.get(GregtechOrePrefixes.stick, tMaterial, 1);
+ if (tMt2 != null) {
+ GregtechRecipeRegistrator.sMt2.func_150996_a(tMt2.getItem());
+ GregtechRecipeRegistrator.sMt2.stackSize = 1;
+ Items.feather.setDamage(GregtechRecipeRegistrator.sMt2, Items.feather.getDamage(tMt2));
+
+ for (int i = 0; i < GregtechRecipeRegistrator.sShapes1.length; i++) {
+ final ItemStack[] tRecipe = GregtechRecipeRegistrator.sShapes1[i];
+
+ int tAmount1 = 0, tAmount2 = 0;
+ for (final ItemStack tMat : tRecipe) {
+ if (tMat == GregtechRecipeRegistrator.sMt1) {
+ tAmount1++;
+ }
+ if (tMat == GregtechRecipeRegistrator.sMt2) {
+ tAmount2++;
+ }
+ }
+ for (final ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) {
+ if (aItemData != null && aItemData.hasValidPrefixMaterialData()) {
+ GregtechOreDictUnificator.addItemData(tCrafted,
+ new GregtechItemData(aItemData.mMaterial.mMaterial,
+ aItemData.mMaterial.mAmount * tAmount1, new GregtechMaterialStack(tMaterial,
+ OrePrefixes.stick.mMaterialAmount * tAmount2)));
+ }
+
+ if (aRecipeReplacing && aPlate != null && GregtechRecipeRegistrator.sShapesA[i] != null
+ && GregtechRecipeRegistrator.sShapesA[i].length > 1) {
+ assert aItemData != null;
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements,
+ aItemData.mMaterial.mMaterial + "." + GregtechRecipeRegistrator.sShapesA[i][0],
+ true)) {
+ if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) {
+ switch (GregtechRecipeRegistrator.sShapesA[i].length) {
+ case 2:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] {
+ GregtechRecipeRegistrator.sShapesA[i][1],
+ GregtechRecipeRegistrator.s_P.charAt(0), aPlate,
+ GregtechRecipeRegistrator.s_R.charAt(0),
+ OrePrefixes.stick.get(tMaterial),
+ GregtechRecipeRegistrator.s_I.charAt(0), aItemData
+ });
+ break;
+ case 3:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] {
+ GregtechRecipeRegistrator.sShapesA[i][1],
+ GregtechRecipeRegistrator.sShapesA[i][2],
+ GregtechRecipeRegistrator.s_P.charAt(0), aPlate,
+ GregtechRecipeRegistrator.s_R.charAt(0),
+ OrePrefixes.stick.get(tMaterial),
+ GregtechRecipeRegistrator.s_I.charAt(0), aItemData
+ });
+ break;
+ default:
+ GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[] {
+ GregtechRecipeRegistrator.sShapesA[i][1],
+ GregtechRecipeRegistrator.sShapesA[i][2],
+ GregtechRecipeRegistrator.sShapesA[i][3],
+ GregtechRecipeRegistrator.s_P.charAt(0), aPlate,
+ GregtechRecipeRegistrator.s_R.charAt(0),
+ OrePrefixes.stick.get(tMaterial),
+ GregtechRecipeRegistrator.s_I.charAt(0), aItemData
+ });
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}