aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-05-15 13:07:19 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-05-15 13:07:19 +1000
commit83abafec38764fd6f562ce5320fc446ddaad6ff6 (patch)
tree742e274310177bfc56ad7f76145b2227a50bfa66
parent6d4c465858fe1a199628de86edff1152f97faa52 (diff)
downloadGT5-Unofficial-83abafec38764fd6f562ce5320fc446ddaad6ff6.tar.gz
GT5-Unofficial-83abafec38764fd6f562ce5320fc446ddaad6ff6.tar.bz2
GT5-Unofficial-83abafec38764fd6f562ce5320fc446ddaad6ff6.zip
Should be loading recipes, but getting nullpoints on #20 of RECIPES_GREGTECH.java
-rw-r--r--src/Java/miscutil/core/common/CommonProxy.java1
-rw-r--r--src/Java/miscutil/core/common/compat/COMPAT_HANDLER.java5
-rw-r--r--src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java29
-rw-r--r--src/Java/miscutil/core/lib/CORE.java2
-rw-r--r--src/Java/miscutil/core/util/UtilsItems.java10
-rw-r--r--src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java14
-rw-r--r--src/Java/miscutil/gregtech/api/util/GregtechRecipe.java81
-rw-r--r--src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java18
8 files changed, 65 insertions, 95 deletions
diff --git a/src/Java/miscutil/core/common/CommonProxy.java b/src/Java/miscutil/core/common/CommonProxy.java
index 54a0e18d9b..3af77bc742 100644
--- a/src/Java/miscutil/core/common/CommonProxy.java
+++ b/src/Java/miscutil/core/common/CommonProxy.java
@@ -73,6 +73,7 @@ public class CommonProxy {
public void postInit(FMLPostInitializationEvent e) {
registerOreDict();
+ COMPAT_HANDLER.loadGregAPIRecipes();
}
public void registerNetworkStuff(){
diff --git a/src/Java/miscutil/core/common/compat/COMPAT_HANDLER.java b/src/Java/miscutil/core/common/compat/COMPAT_HANDLER.java
index 7c39859a1a..ee2ba9e230 100644
--- a/src/Java/miscutil/core/common/compat/COMPAT_HANDLER.java
+++ b/src/Java/miscutil/core/common/compat/COMPAT_HANDLER.java
@@ -5,6 +5,7 @@ import static miscutil.core.util.UtilsItems.removeCraftingRecipe;
import java.util.LinkedList;
import java.util.Queue;
+import miscutil.core.handler.registration.RECIPES_GREGTECH;
import miscutil.core.lib.LoadedMods;
public class COMPAT_HANDLER {
@@ -60,4 +61,8 @@ public class COMPAT_HANDLER {
removeCraftingRecipe(item);
}
}
+
+ public static void loadGregAPIRecipes(){
+ RECIPES_GREGTECH.run();
+ }
}
diff --git a/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java
new file mode 100644
index 0000000000..07250e51fa
--- /dev/null
+++ b/src/Java/miscutil/core/handler/registration/RECIPES_GREGTECH.java
@@ -0,0 +1,29 @@
+package miscutil.core.handler.registration;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+import miscutil.core.lib.CORE;
+import miscutil.core.util.Utils;
+
+public class RECIPES_GREGTECH {
+
+ public static void run(){
+ Utils.LOG_INFO("Loading Recipes through GregAPI for Industrial Multiblocks.");
+ execute();
+ }
+
+ private static void execute(){
+ Utils.LOG_INFO("Loading Recipes for Industrial Coking Oven.");
+
+ CORE.RA.addCokeOvenRecipe(
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Emerald, 1L), //Input 1
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Emerald, 1L), //Input 2
+ Materials.Water.getFluid(100L), //Fluid Input 1
+ Materials.Lava.getFluid(500L), //Fluid Output
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Diamond, 1L), //Item Output
+ 20, //Time in seconds?
+ 120); //EU
+ }
+
+}
diff --git a/src/Java/miscutil/core/lib/CORE.java b/src/Java/miscutil/core/lib/CORE.java
index afec1ef301..d24420f841 100644
--- a/src/Java/miscutil/core/lib/CORE.java
+++ b/src/Java/miscutil/core/lib/CORE.java
@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import miscutil.core.creative.AddToCreativeTab;
+import miscutil.gregtech.api.interfaces.internal.IGregtech_RecipeAdder;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -19,6 +20,7 @@ public class CORE {
public static final int GREG_FIRST_ID = 760;
public static Map PlayerCache;
public static final String[] VOLTAGES = {"ULV","LV","MV","HV","EV","IV","LuV","ZPM","UV","MAX"};
+ public static IGregtech_RecipeAdder RA;
@SideOnly(Side.CLIENT)
public static IIconRegister GT_BlockIcons, GT_ItemIcons;
diff --git a/src/Java/miscutil/core/util/UtilsItems.java b/src/Java/miscutil/core/util/UtilsItems.java
index 4323420959..6f26b2c3db 100644
--- a/src/Java/miscutil/core/util/UtilsItems.java
+++ b/src/Java/miscutil/core/util/UtilsItems.java
@@ -199,6 +199,16 @@ public class UtilsItems {
String[] fqrnSplit = fqrn.split(":");
return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
}
+
+ // TODO
+ /*public static FluidStack getFluidStack(Materials m, int Size) // fqrn = fully qualified resource name
+ {
+ String[] fqrnSplit = fqrn.split(":");
+
+ FluidStack x = (FluidStack) "Materials."+m+".getFluid"(Size);
+
+ return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
+ }*/
public static Item getItemInPlayersHand(){
Minecraft mc = Minecraft.getMinecraft();
diff --git a/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index 049611149e..8aa77d75ba 100644
--- a/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -5,18 +5,18 @@ import net.minecraftforge.fluids.FluidStack;
public interface IGregtech_RecipeAdder {
/**
- * Adds a FusionreactorRecipe
+ * Adds a Coke Oven Recipe
*
- * @param aOptimize = EU needed for heating up (must be >= 0)
- * @param aInput1 = first Input (can be null, and respects StackSize)
+ * @param aInput1 = first Input (not null, and respects StackSize)
+ * @param aInputb = second Input (can be null, and respects StackSize)
* @param aOutput1 = Output of the Creosote (not null, and respects StackSize)
- * @param bInput1 = first solid Input (not null, and respects StackSize)
- * @param bOutput1 = Output of the Coal/coke (can be null, and respects StackSize)
+ * @param aFluidInput = fluid Input (can be null, and respects StackSize)
+ * @param aOutput = Output of the Coal/coke (can be null, and respects StackSize)
* @param aDuration = Duration (must be >= 0)
* @param aEUt = EU needed for heating up (must be >= 0)
- * @param aSpecialValue = EU needed for heating up (must be >= 0)
* @return true if the Recipe got added, otherwise false.
*/
- public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue);
+ //public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue);
+ public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt);
}
diff --git a/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java b/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java
index 4fe870a830..56b573f5ae 100644
--- a/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java
+++ b/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java
@@ -1,6 +1,5 @@
package miscutil.gregtech.api.util;
-import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.enums.GT_Values.E;
import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
import static gregtech.api.enums.GT_Values.W;
@@ -10,7 +9,6 @@ import gregtech.api.objects.GT_FluidStack;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
@@ -258,7 +256,7 @@ public class GregtechRecipe {
*/
public static final Collection<Gregtech_Recipe_Map> sMappings = new ArrayList<Gregtech_Recipe_Map>();
//public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true);
- public static final GT_Recipe_Map sCokeOvenRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "mu.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true);
+ public static final GT_Recipe_Map sCokeOvenRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true);
//public static final Gregtech_Recipe_Map sCokeOvenRecipes = new Gregtech_Recipe_Map(new HashSet<GregtechRecipe>(200), "mu.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 1, 1, E, 1, E, true, true);
@@ -604,79 +602,4 @@ public class GregtechRecipe {
return null;
}
}
-
- /**
- * Special Class for Furnace Recipe handling.
- */
- public static class GT_Recipe_Map_Furnace extends GT_Recipe_Map_NonGTRecipes {
- public GT_Recipe_Map_Furnace(Collection<GregtechRecipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) {
- super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed);
- }
-
- @Override
- public GregtechRecipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GregtechRecipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) {
- if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null) return null;
- if (aRecipe != null && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) return aRecipe;
-
- try {
- ItemStack tRecipeOutputs = mods.railcraft.api.crafting.RailcraftCraftingManager.cokeOven.getRecipe(GT_Utility.copyAmount(1, aInputs[0])).getOutput();
- if (tRecipeOutputs != null) {
- //aRecipe = new GregtechRecipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, tRecipeOutputs(new ItemStack[tRecipeOutputs.size()]), null, null, null, null, 800, 2, 0);
- aRecipe.mCanBeBuffered = false;
- aRecipe.mNeedsEmptyOutput = true;
- return aRecipe;
- }
- } catch (NoClassDefFoundError e) {
- if (D1) GT_Log.err.println("Railcraft Not loaded");
- } catch (NullPointerException e) {/**/}
-
-
- ItemStack tOutput = GT_ModHandler.getSmeltingOutput(aInputs[0], false, null);
- return tOutput == null ? null : new GregtechRecipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, null, null, 128, 4, 0);
- }
-
- @Override
- public boolean containsInput(ItemStack aStack) {
- return GT_ModHandler.getSmeltingOutput(aStack, false, null) != null;
- }
- }
-}
-
-
-/**
- * Special Class for Macerator/RockCrusher Recipe handling.
- */
-/*public static class GT_Recipe_Map_Macerator extends GT_Recipe_Map {
- public GT_Recipe_Map_Macerator(Collection<GregtechRecipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) {
- super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed);
- }
-
- @Override
- public GregtechRecipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GregtechRecipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) {
- if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || !GregTech_API.sPostloadFinished)
- return super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs);
- aRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs);
- if (aRecipe != null) return aRecipe;
-
- try {
- ItemStack tRecipeOutputs = mods.railcraft.api.crafting.RailcraftCraftingManager.cokeOven.getRecipe(GT_Utility.copyAmount(1, aInputs[0])).getOutput();
- if (tRecipeOutputs != null) {
- aRecipe = new GregtechRecipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aInputs[0])}, tRecipeOutputs(new ItemStack[tRecipeOutputs.size()]), null, null, null, null, 800, 2, 0);
- aRecipe.mCanBeBuffered = false;
- aRecipe.mNeedsEmptyOutput = true;
- return aRecipe;
- }
- } catch (NoClassDefFoundError e) {
- if (D1) GT_Log.err.println("Railcraft Not loaded");
- } catch (NullPointerException e) {}
-
- ItemStack tComparedInput = GT_Utility.copy(aInputs[0]);
- ItemStack[] tOutputItems = GT_ModHandler.getMachineOutput(tComparedInput, ic2.api.recipe.Recipes.macerator.getRecipes(), true, new NBTTagCompound(), null, null, null);
- return GT_Utility.arrayContainsNonNull(tOutputItems) ? new GregtechRecipe(false, new ItemStack[]{GT_Utility.copyAmount(aInputs[0].stackSize - tComparedInput.stackSize, aInputs[0])}, tOutputItems, null, null, null, null, 400, 2, 0) : null;
- }
-
- @Override
- public boolean containsInput(ItemStack aStack) {
- return super.containsInput(aStack) || GT_Utility.arrayContainsNonNull(GT_ModHandler.getMachineOutput(GT_Utility.copyAmount(64, aStack), ic2.api.recipe.Recipes.macerator.getRecipes(), false, new NBTTagCompound(), null, null, null));
- }
-}*/
+} \ No newline at end of file
diff --git a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java
index 6b4b4c7122..e81080aaa2 100644
--- a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java
+++ b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java
@@ -1,7 +1,6 @@
package miscutil.gregtech.common;
import gregtech.api.GregTech_API;
-import gregtech.api.util.GT_Recipe;
import miscutil.gregtech.api.interfaces.internal.IGregtech_RecipeAdder;
import miscutil.gregtech.api.util.GregtechRecipe;
import net.minecraft.item.ItemStack;
@@ -9,26 +8,27 @@ import net.minecraftforge.fluids.FluidStack;
public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
- @Override
+ /*@Override
public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) {
- /*if (bInput1 == null || aOutput1 == null || bOutput1 == null || aDuration < 1 || aEUt < 1) {
+ if (bInput1 == null || aOutput1 == null || bOutput1 == null || aDuration < 1 || aEUt < 1) {
return false;
- }*/
+ }
GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(aOptimize, aInputs, aOutputs, aSpecial, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue);
return true;
- }
+ }*/
- public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration) {
+ @Override
+ public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) {
if (((aInput1 == null) && (aFluidInput == null)) || ((aOutput == null) && (aFluidOutput == null))) {
return false;
}
- if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("chemicalreactor", aOutput, aDuration)) <= 0)) {
+ if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) {
return false;
}
- if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("chemicalreactor", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) {
+ if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) {
return false;
}
- GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, 30, 0);
+ GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0);
return true;
}
}