add recipe adding methods to the API, and a handler to get the internal class.

This commit is contained in:
Xander Victory committed 2017-11-08 11:48:59 +08:00
1 parent 26a28c13db
commit 64b2e421f7
3 files changed
+257

No files matched your search

@@ -7,11 +7,14 @@ import mekanism.api.util.BlockInfo;
import net.minecraft.block.Block;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.LogManager;
public class MekanismAPI
{
//Add a BlockInfo value here if you don't want a certain block to be picked up by cardboard boxes
private static Set<BlockInfo> cardboardBoxIgnore = new HashSet<>();
private static MekanismRecipeHelper helper = null;
/** Mekanism debug mode */
public static boolean debug = false;
@@ -45,4 +48,22 @@ public class MekanismAPI
}
public static class BoxBlacklistEvent extends Event {}
/**
* Get the instance of the recipe helper to directly add recipes.
*
* Do NOT copy/repackage this method into your package, nor use the class directly as it may change.
*
* @return {@link MekanismRecipeHelper} The handler.
*/
public static MekanismRecipeHelper recipeHelper(){
if (helper == null){
try {
helper = (MekanismRecipeHelper)Class.forName("mekanism.common.recipe.APIHandler").newInstance();
} catch (ClassNotFoundException|InstantiationException|IllegalAccessException e) {
LogManager.getLogger("MekanismAPI").error("Could not find API Handler", e);
}
}
return helper;
}
}