aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
authorJordan Byrne <draknyte1@hotmail.com>2017-12-18 13:22:13 +1000
committerJordan Byrne <draknyte1@hotmail.com>2017-12-18 13:22:13 +1000
commitb9fe3352840abe0846834cefd578895ec6f5e520 (patch)
tree416885a2c65de3ee61b6bccc4f128f197c92464a /src/Java/gtPlusPlus/xmod/gregtech
parent86dac7e948cff5c9b975ff86fef149377285eab8 (diff)
downloadGT5-Unofficial-b9fe3352840abe0846834cefd578895ec6f5e520.tar.gz
GT5-Unofficial-b9fe3352840abe0846834cefd578895ec6f5e520.tar.bz2
GT5-Unofficial-b9fe3352840abe0846834cefd578895ec6f5e520.zip
+ Added Trinium and Trinium related Alloys.
+ Added more recycling recipes. $ Fixed bad materials in component assembler recipes.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java128
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java2
2 files changed, 108 insertions, 22 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
index f7e294ad0b..d0651f783c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
@@ -7,30 +7,40 @@ import java.util.Map;
import org.apache.commons.lang3.reflect.FieldUtils;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.array.Pair;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
public class RecipeGen_Recycling implements Runnable {
final Material toGenerate;
- static Map mNameMap;
+ public static Map<String, ItemStack> mNameMap;
public RecipeGen_Recycling(final Material M) {
this.toGenerate = M;
- mNameMap = this.getNameMap();
+ if (mNameMap == null){
+ mNameMap = this.getNameMap();
+ }
+ if (mNameMap != null){
+ generateRecipes(this.toGenerate);
+ }
}
@Override
public void run() {
- generateRecipes(this.toGenerate);
+
}
public static void generateRecipes(final Material material) {
@@ -46,14 +56,20 @@ public class RecipeGen_Recycling implements Runnable {
Utils.LOG_INFO("Found " + mValidPrefixesAsString.length + " valid OreDict prefixes.");
if (mValidPrefixesAsString.length >= 1) {
for (final OrePrefixes validPrefix : mValidPrefixesAsString) {
-
try {
- final ItemStack tempStack = ItemUtils
- .getItemStackOfAmountFromOreDict(validPrefix + material.getLocalizedName(), 1);
-
- if ((tempStack != null) && (tempStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken))) {
+
+ if (material.getState() != MaterialState.SOLID){
+ continue;
+ }
+
+ final ItemStack tempStack = get(validPrefix, material, 1);
+ final ItemStack mDust = getDust(material, validPrefix);
+ final Pair<OrePrefixes, ItemStack> mData = getDustData(material, validPrefix);
+ int mFluidAmount = (int) GT_Utility.translateMaterialToFluidAmount(mData.getKey().mMaterialAmount, true);
+
+ //Maceration
+ if (tempStack != null) {
// mValidItems[mSlotIndex++] = tempStack;
- final ItemStack mDust = getDust(material, validPrefix);
if ((mDust != null) && GT_ModHandler.addPulverisationRecipe(tempStack, mDust)) {
Utils.LOG_INFO("Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle "
+ tempStack.getDisplayName() + " and obtain " + mDust.getDisplayName());
@@ -65,9 +81,30 @@ public class RecipeGen_Recycling implements Runnable {
}
}
}
+
+ //Arc Furnace
+ if (tempStack != null) {
+
+ }
+
+ //Fluid Extractor
+ if (tempStack != null) {
+ // mValidItems[mSlotIndex++] = tempStack;
+ if ((mDust != null) && GT_Values.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, 8)) {
+ Utils.LOG_INFO("Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle "
+ + tempStack.getDisplayName() + " and obtain " + mDust.getDisplayName());
+ }
+ else {
+ Utils.LOG_INFO("Recycle Recipe: " + material.getLocalizedName() + " - Failed");
+ if (mDust == null) {
+ Utils.LOG_INFO("Invalid Dust output.");
+ }
+ }
+ }
+
}
catch (final Throwable t) {
- // t.printStackTrace();
+ t.printStackTrace();
// Utils.LOG_INFO("Returning Null. Throwable Info:
// "+t.getMessage());
// Utils.LOG_INFO("Throwable Info: "+t.toString());
@@ -79,28 +116,69 @@ public class RecipeGen_Recycling implements Runnable {
}
}
+ public static Pair<OrePrefixes, ItemStack> getDustData(final Material aMaterial, final OrePrefixes aPrefix) {
+ return getDustData(aMaterial, aPrefix.mMaterialAmount);
+ }
+
+ public static Pair<OrePrefixes, ItemStack> getDustData(final Material aMaterial, final long aMaterialAmount) {
+ ItemStack mDust = null;
+ OrePrefixes mPrefix = null;
+
+ if (aMaterial == null || aMaterialAmount <= 0) {
+ return null;
+ }
+ if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) {
+ mDust = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M);
+ mPrefix = OrePrefixes.dust;
+ }
+ if ((mDust == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) {
+ mDust = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M);
+ mPrefix = OrePrefixes.dustSmall;
+ }
+ if ((mDust == null) && (((aMaterialAmount * 9) >= M))) {
+ mDust = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M);
+ mPrefix = OrePrefixes.dustTiny;
+ }
+
+ if (mPrefix != null && mDust != null){
+ Utils.LOG_INFO("Built valid dust pair.");
+ return new Pair<OrePrefixes, ItemStack>(mPrefix, mDust);
+ }
+ else {
+ Utils.LOG_INFO("mPrefix: "+(mPrefix!=null));
+ Utils.LOG_INFO("mDust: "+(mDust!=null));
+ }
+ Utils.LOG_INFO("Failed to build valid dust pair.");
+ return null;
+ }
+
public static ItemStack getDust(final Material aMaterial, final OrePrefixes aPrefix) {
return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount);
}
-
+
public static ItemStack getDust(final Material aMaterial, final long aMaterialAmount) {
if (aMaterialAmount <= 0) {
return null;
}
ItemStack rStack = null;
if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) {
+ Utils.LOG_INFO("Trying to get a Dust");
rStack = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M);
}
if ((rStack == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) {
+ Utils.LOG_INFO("Trying to get a Small Dust");
rStack = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M);
}
if ((rStack == null) && (((aMaterialAmount * 9) >= M))) {
+ Utils.LOG_INFO("Trying to get a Tiny Dust");
rStack = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M);
}
if (rStack == null) {
Utils.LOG_INFO("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(1));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(2));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(3));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(4));
}
return rStack;
@@ -114,18 +192,13 @@ public class RecipeGen_Recycling implements Runnable {
return get(aName, aReplacement, aAmount, true, true);
}
- public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final long aAmount) {
+ public static ItemStack get(final OrePrefixes aPrefix, final Material aMaterial, final long aAmount) {
return get(aPrefix, aMaterial, null, aAmount);
}
- public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final ItemStack aReplacement,
+ public static ItemStack get(final OrePrefixes aPrefix, final Material aMaterial, final ItemStack aReplacement,
final long aAmount) {
- /*
- * if (OrePrefixes.mPreventableComponents.contains(aPrefix) &&
- * aPrefix.mDisabledItems.contains(aMaterial)) { return aReplacement;
- * //TODO }
- */
- return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true);
+ return get(aPrefix.name()+Utils.sanitizeString(aMaterial.getLocalizedName()), aReplacement, aAmount, false, true);
}
public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount,
@@ -134,6 +207,8 @@ public class RecipeGen_Recycling implements Runnable {
Utils.LOG_INFO("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(1));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(2));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(3));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(4));
return null;
}
if (!mNameMap.containsKey(aName.toString()) && aMentionPossibleTypos) {
@@ -148,10 +223,13 @@ public class RecipeGen_Recycling implements Runnable {
Utils.LOG_INFO("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(1));
Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(2));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(3));
+ Utils.LOG_INFO("Called from method: " + ReflectionUtils.getMethodName(4));
return null;
}
final ItemStack tStack = (ItemStack) mNameMap.get(aName.toString());
if (GT_Utility.isStackValid(tStack)) {
+ Utils.LOG_INFO("Found valid stack.");
return GT_Utility.copyAmount(aAmount, new Object[] { tStack });
}
return GT_Utility.copyAmount(aAmount, getOres(aName).toArray());
@@ -161,17 +239,25 @@ public class RecipeGen_Recycling implements Runnable {
final String aName = (aOreName == null) ? "" : aOreName.toString();
final ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
if (GT_Utility.isStringValid(aName)) {
- rList.addAll(getOres(aName));
+ Utils.LOG_INFO("Making a list of all OreDict entries for "+aOreName+".");
+ if (rList.addAll(OreDictionary.getOres(aName))){
+ Utils.LOG_INFO("Added "+rList.size()+" elements to list.");
+ }
+ else {
+ Utils.LOG_INFO("Failed to Add Collection from oreDictionary, forcing an entry.");
+ rList.add(ItemUtils.getItemStackOfAmountFromOreDict((String) aOreName, 1));
+ }
}
return rList;
}
- public Map getNameMap() {
+ public Map<String, ItemStack> getNameMap() {
Map<String, ItemStack> tempMap;
try {
tempMap = (Map<String, ItemStack>) FieldUtils.readStaticField(GT_OreDictUnificator.class, "sName2StackMap",
true);
if (tempMap != null) {
+ Utils.LOG_INFO("Found 'sName2StackMap' in GT_OreDictUnificator.class.");
return tempMap;
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
index 86ce88311e..33e17c8c0e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
@@ -241,7 +241,7 @@ public class GregtechComponentAssembler {
private static boolean addRecipePump(int tier, Materials main, Materials pipe, Materials cable) {
try {
- ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, main, 1);
+ ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, cable, 1);
ItemStack screwStack = ItemUtils.getGregtechOreStack(OrePrefixes.screw, main, 1);
ItemStack rotorStack = ItemUtils.getGregtechOreStack(OrePrefixes.rotor, main, 1);
ItemStack pipeStack = ItemUtils.getGregtechOreStack(OrePrefixes.pipeMedium, pipe, 1);