use of vazkii.patchouli.api.IVariableProvider in project bewitchment by MoriyaShiine.
the class OilCraftingProcessor method setup.
@Override
public void setup(IVariableProvider variables) {
String recipeId = variables.get("recipe").asString();
RecipeManager manager = MinecraftClient.getInstance().world.getRecipeManager();
recipe = (OilRecipe) manager.get(new Identifier(recipeId)).filter(recipe -> recipe.getType().equals(BWRecipeTypes.OIL_RECIPE_TYPE)).orElseThrow(IllegalArgumentException::new);
}
use of vazkii.patchouli.api.IVariableProvider in project bewitchment by MoriyaShiine.
the class RitualProcessor method setup.
@Override
public void setup(IVariableProvider variables) {
String recipeId = variables.get("recipe").asString();
RecipeManager manager = MinecraftClient.getInstance().world.getRecipeManager();
recipe = (RitualRecipe) manager.get(new Identifier(recipeId)).filter(recipe -> recipe.getType().equals(BWRecipeTypes.RITUAL_RECIPE_TYPE)).orElseThrow(IllegalArgumentException::new);
}
use of vazkii.patchouli.api.IVariableProvider in project Miskatonic-Mysteries-Fabric by cybercat5555.
the class ChemistryProcessor method setup.
@Override
public void setup(IVariableProvider variables) {
String recipeId = variables.get("recipe").asString();
RecipeManager manager = MinecraftClient.getInstance().world.getRecipeManager();
recipe = (ChemistryRecipe) manager.get(new Identifier(recipeId)).filter(recipe -> recipe.getType().equals(MMRecipes.CHEMISTRY_RECIPE)).orElseThrow(IllegalArgumentException::new);
}
use of vazkii.patchouli.api.IVariableProvider in project Patchouli by VazkiiMods.
the class BookTemplate method compile.
public void compile(BookContentsBuilder builder, IVariableProvider variables) {
if (compiled) {
return;
}
createProcessor();
components.removeIf(Objects::isNull);
if (processor != null) {
IVariableProvider processorVars = variables;
if (encapsulation != null) {
processorVars = encapsulation.wrapProvider(variables);
}
try {
processor.setup(processorVars);
} catch (Exception e) {
throw new RuntimeException("Error setting up template processor", e);
}
}
for (TemplateInclusion include : inclusions) {
if (include.template == null || include.template.isEmpty() || include.as == null || include.as.isEmpty()) {
throw new IllegalArgumentException("Template inclusion must define both \"template\" and \"as\" fields.");
}
include.upperMerge(encapsulation);
include.process(processor);
BookTemplate template = createTemplate(book, builder, include.template, include);
template.compile(builder, variables);
components.addAll(template.components);
}
for (TemplateComponent c : components) {
c.compile(variables, processor, encapsulation);
}
compiled = true;
}
use of vazkii.patchouli.api.IVariableProvider in project bewitchment by MoriyaShiine.
the class CurseProcessor method setup.
@Override
public void setup(IVariableProvider variables) {
String recipeId = variables.get("recipe").asString();
RecipeManager manager = MinecraftClient.getInstance().world.getRecipeManager();
recipe = (CurseRecipe) manager.get(new Identifier(recipeId)).filter(recipe -> recipe.getType().equals(BWRecipeTypes.CURSE_RECIPE_TYPE)).orElseThrow(IllegalArgumentException::new);
}
Aggregations