diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders')
5 files changed, 250 insertions, 13 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java index f43aae74b6..c596bf0a4c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java @@ -35,6 +35,14 @@ public class RecipeGen_AlloySmelter implements Runnable{ material.getGear(1), (int) Math.max(material.getMass() * 2L, 1L), 2 * tVoltageMultiplier); + + //Ingot + GT_Values.RA.addAlloySmelterRecipe( + material.getNugget(9), + ItemList.Shape_Mold_Ingot.get(1), + material.getIngot(1), + (int) Math.max(material.getMass() * 2L, 1L), + 2 * tVoltageMultiplier); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index d66649850a..6d1da0881e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -4,13 +4,19 @@ import java.util.ArrayList; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.*; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; +import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; public class RecipeGen_BlastSmelter implements Runnable{ @@ -87,10 +93,10 @@ public class RecipeGen_BlastSmelter implements Runnable{ } if (duration <= 0){ - int second = 20; + final int second = 20; duration = 14*second*mMaterialListSize; } - + Utils.LOG_WARNING("[BAS] Size: "+mMaterialListSize); @@ -125,7 +131,7 @@ public class RecipeGen_BlastSmelter implements Runnable{ } if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){ Utils.LOG_WARNING("[BAS] Success, Also added a Fluid Extractor recipe."); - } + } } } else { @@ -189,11 +195,21 @@ public class RecipeGen_BlastSmelter implements Runnable{ //Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier components = new ItemStack[9]; inputStackCount=0; + FluidStack componentsFluid = null; for (int irc=0;irc<M.getComposites().size();irc++){ if (M.getComposites().get(irc) != null){ final int r = (int) M.vSmallestRatio[irc]; inputStackCount = inputStackCount+r; - components[irc] = M.getComposites().get(irc).getDustStack(r); + if ((M.getComposites().get(irc).getStackMaterial().getState() != MaterialState.SOLID) && ((M.getComposites().get(irc).getDustStack(r) == null) || (M.getComposites().get(irc).getDustStack(r) == ItemUtils.getSimpleStack(ModItems.AAA_Broken)))){ + final int xr = M.getComposites().get(irc).getPartsPerOneHundred(); + if ((xr > 0) && (xr <= 100)){ + final int mathmatics = (xr <= 10 ? 1000 : ((xr/10)*1000)); + componentsFluid = FluidUtils.getFluidStack(M.getComposites().get(irc).getStackMaterial().getFluid(mathmatics), mathmatics); + } + } + else { + components[irc] = M.getComposites().get(irc).getDustStack(r); + } } } @@ -230,7 +246,7 @@ public class RecipeGen_BlastSmelter implements Runnable{ //Adds Recipe if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 500)){ Utils.LOG_WARNING("[BAS] Success."); } else { @@ -238,7 +254,7 @@ public class RecipeGen_BlastSmelter implements Runnable{ } } else { - if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 240)){ Utils.LOG_WARNING("[BAS] Success."); } else { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index a8a4cf963f..46bf36c445 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -177,7 +177,7 @@ public class RecipeGen_DustGeneration implements Runnable{ //Add Shapeless recipe for low tier alloys. if (tVoltageMultiplier <= 30){ if (RecipeUtils.addShapedGregtechRecipe(inputStacks, outputStacks)){ - Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success"); + Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success"); } else { Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Failed"); @@ -194,7 +194,7 @@ public class RecipeGen_DustGeneration implements Runnable{ } - public static boolean addMixerRecipe_Standalone(Material material){ + public static boolean addMixerRecipe_Standalone(final Material material){ final ItemStack[] inputStacks = material.getMaterialComposites(); final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); //Is this a composite? @@ -264,14 +264,14 @@ public class RecipeGen_DustGeneration implements Runnable{ } else { Utils.LOG_INFO("inputStackSize == NUll - "+material.getLocalizedName()); - } + } } else { Utils.LOG_INFO("InputStacks is out range 1-4 - "+material.getLocalizedName()); - } + } } else { - Utils.LOG_INFO("InputStacks == NUll - "+material.getLocalizedName()); + Utils.LOG_INFO("InputStacks == NUll - "+material.getLocalizedName()); } return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java new file mode 100644 index 0000000000..cf48516354 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -0,0 +1,197 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import static gregtech.api.enums.GT_Values.M; + +import java.util.ArrayList; +import java.util.Map; + +import org.apache.commons.lang3.reflect.FieldUtils; + +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.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_Recycling implements Runnable{ + + final Material toGenerate; + static Map mNameMap; + + public RecipeGen_Recycling(final Material M){ + this.toGenerate = M; + mNameMap = this.getNameMap(); + } + + @Override + public void run() { + generateRecipes(this.toGenerate); + } + + public static void generateRecipes(final Material material){ + + Utils.LOG_INFO("Generating Recycling recipes for "+material.getLocalizedName()); + + final OrePrefixes[] mValidPrefixesAsString = { + OrePrefixes.ingot, + OrePrefixes.ingotHot, + OrePrefixes.nugget, + OrePrefixes.plate, + OrePrefixes.plateDense, + OrePrefixes.plateDouble, + OrePrefixes.plateTriple, + OrePrefixes.plateQuadruple, + OrePrefixes.plateQuintuple, + OrePrefixes.stick, + OrePrefixes.stickLong, + OrePrefixes.bolt, + OrePrefixes.screw, + OrePrefixes.ring, + OrePrefixes.rotor, + OrePrefixes.gearGt, + OrePrefixes.gearGtSmall + }; + + 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))){ + //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()); + } + else { + Utils.LOG_INFO("Recycle Recipe: "+material.getLocalizedName()+" - Failed"); + if (mDust == null){ + Utils.LOG_INFO("Invalid Dust output."); + } + } + } + } catch (final Throwable t){ + t.printStackTrace(); + Utils.LOG_INFO("Returning Null. Throwable Info: "+t.getMessage()); + Utils.LOG_INFO("Throwable Info: "+t.toString()); + Utils.LOG_INFO("Throwable Info: "+t.getCause().toString()); + + } + + } + } + } + + + + 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)))) { + rStack = get(OrePrefixes.dust, aMaterial, aMaterialAmount / M); + } + if ((rStack == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) { + rStack = get(OrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M); + } + if ((rStack == null) && (((aMaterialAmount * 9) >= M))) { + 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)); + } + + return rStack; + } + + public static ItemStack get(final Object aName, final long aAmount) { + return get(aName, null, aAmount, true, true); + } + + public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount) { + return get(aName, aReplacement, aAmount, true, true); + } + + public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final long aAmount) { + return get(aPrefix, aMaterial, null, aAmount); + } + + public static ItemStack get(final OrePrefixes aPrefix, final Object aMaterial, final ItemStack aReplacement, + final long aAmount) { + if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) { + return aReplacement; + } + return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); + } + + public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount, + final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) { + if (aNoInvalidAmounts && (aAmount < 1L)) { + 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)); + return null; + } + if (!mNameMap.containsKey(aName.toString()) && aMentionPossibleTypos) { + Utils.LOG_INFO("Unknown Key for Unification, Typo? " + aName); + } + return GT_Utility.copyAmount(aAmount, new Object[]{mNameMap.get(aName.toString()), + getFirstOre(aName, aAmount), aReplacement}); + } + + + public static ItemStack getFirstOre(final Object aName, final long aAmount) { + if (GT_Utility.isStringInvalid(aName)) { + 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)); + return null; + } + final ItemStack tStack = (ItemStack) mNameMap.get(aName.toString()); + if (GT_Utility.isStackValid(tStack)) { + return GT_Utility.copyAmount(aAmount, new Object[]{tStack}); + } + return GT_Utility.copyAmount(aAmount, getOres(aName).toArray()); + } + + public static ArrayList<ItemStack> getOres(final Object aOreName) { + final String aName = (aOreName == null) ? "" : aOreName.toString(); + final ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + if (GT_Utility.isStringValid(aName)) { + rList.addAll(getOres(aName)); + } + return rList; + } + + public Map getNameMap(){ + Map<String, ItemStack> tempMap; + try { + tempMap = (Map<String, ItemStack>) FieldUtils.readStaticField(GT_OreDictUnificator.class, "sName2StackMap", true); + if (tempMap != null){ + return tempMap; + } + } + catch (final IllegalAccessException e) { + e.printStackTrace(); + } + Utils.LOG_INFO("Invalid map stored in GT_OreDictUnificator.class, unable to find sName2StackMap field."); + return null; + } + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java index 6c25b697a2..79ff583607 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -23,8 +23,24 @@ public class RecipeGen_ShapedCrafting implements Runnable{ public static void generateRecipes(final Material material){ Utils.LOG_WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + + //Nuggets + GT_ModHandler.addShapelessCraftingRecipe( + material.getIngot(1), + new Object[]{ + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1) + }); + //Plates - + //Single Plate Shaped/Shapeless GT_ModHandler.addCraftingRecipe( material.getPlate(1), |