use of com.builtbroken.mc.lib.json.imp.IJsonGenObject in project Engine by VoltzEngine-Project.
the class JsonContentLoader method process.
/**
* Called to process a json element entry into a
* generated object
*
* @param key - json processor key
* @param element - data
* @return true if it was processed and added to the generated object list
*/
public boolean process(String key, JsonElement element) {
final JsonProcessor processor = processors.get(key);
if (processor != null) {
if (processor.canProcess(key, element)) {
IJsonGenObject data = processor.process(element);
data.register();
if (data instanceof IRegistryInit) {
((IRegistryInit) data).onRegistered();
}
return generatedObjects.add(data);
} else {
// TODO add error handling
}
}
return false;
}
use of com.builtbroken.mc.lib.json.imp.IJsonGenObject in project Engine by VoltzEngine-Project.
the class JsonContentLoader method postInit.
@Override
public void postInit() {
processEntries();
for (IJsonGenObject obj : generatedObjects) {
if (obj instanceof IPostInit) {
((IPostInit) obj).onPostInit();
}
if (obj instanceof IRecipeContainer) {
List<IRecipe> recipes = new ArrayList();
((IRecipeContainer) obj).genRecipes(recipes);
for (IRecipe recipe : recipes) {
if (recipe != null && recipe.getRecipeOutput() != null) {
GameRegistry.addRecipe(recipe);
}
}
}
}
}
Aggregations