public class XmlRecipeLoader
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlRecipeLoader.XmlRecipeException
Error that can occur while reading xml recipes.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<java.lang.String,IRecipeConditionHandler> |
RECIPE_CONDITION_HANDLERS |
| Constructor and Description |
|---|
XmlRecipeLoader(java.io.InputStream is,
java.lang.String fileName)
Make a new loader for the given file.
|
| Modifier and Type | Method and Description |
|---|---|
static net.minecraft.item.ItemStack |
getPredefinedItem(java.lang.String key)
Get a predefined item by key.
|
static boolean |
isPredefinedValue(java.lang.String value)
Check if a value has been predefined.
|
void |
loadRecipes(boolean crashOnInvalidRecipe)
Load the recipes for this instance.
|
static void |
registerPredefinedItem(java.lang.String key,
net.minecraft.item.ItemStack item)
Register a new predefined item.
|
static void |
registerPredefinedValue(java.lang.String value)
Register a new predefined value that can be used in
PredefinedRecipeConditionHandler. |
static void |
registerRecipeConditionHandler(java.lang.String type,
IRecipeConditionHandler handler)
Register a new recipe condition handler.
|
static void |
registerRecipeTypeHandler(java.lang.String type,
IRecipeTypeHandler handler)
Register a new recipe type handler.
|
void |
setValidator(java.io.InputStream xsdIs)
Set the XSD validator.
|
void |
validate()
Validate the xml file.
|
public static final java.util.Map<java.lang.String,IRecipeConditionHandler> RECIPE_CONDITION_HANDLERS
public XmlRecipeLoader(java.io.InputStream is,
java.lang.String fileName)
is - The stream containing xml recipes.fileName - The file name, used for debugging.public static void registerRecipeTypeHandler(java.lang.String type,
IRecipeTypeHandler handler)
type - The type name.handler - The handler instance.public static void registerRecipeConditionHandler(java.lang.String type,
IRecipeConditionHandler handler)
type - The type name.handler - The handler instance.public static void registerPredefinedItem(java.lang.String key,
net.minecraft.item.ItemStack item)
key - The key of the item.item - The item.public static net.minecraft.item.ItemStack getPredefinedItem(java.lang.String key)
key - The key of the item.public static void registerPredefinedValue(java.lang.String value)
PredefinedRecipeConditionHandler.value - The key to register.public static boolean isPredefinedValue(java.lang.String value)
value - The key to check.public void setValidator(java.io.InputStream xsdIs)
xsdIs - The inputstream for the validator.public void validate()
throws XmlRecipeLoader.XmlRecipeException
XmlRecipeLoader.XmlRecipeException - If the file was invalid.public void loadRecipes(boolean crashOnInvalidRecipe)
throws XmlRecipeLoader.XmlRecipeException
crashOnInvalidRecipe - If the loader should crash when an invalid recipe has been found.
Will skip recipe otherwise.XmlRecipeLoader.XmlRecipeException - If something went wrong.