use of crazypants.enderio.base.config.recipes.ShapedRecipe in project EnderIO by SleepyTrousers.
the class Crafting method register.
@Override
public void register(@Nonnull String recipeName) {
if (valid && active) {
final ResourceLocation recipeRL = mkRL(recipeName);
final IForgeRegistry<IRecipe> registry = ForgeRegistries.RECIPES;
if (grid != null) {
if (upgrade) {
log("ShapedRecipe.Upgrade", recipeName, recipeRL, getOutput().getItemStack(), grid.getIngredients());
registry.register(new ShapedRecipe.Upgrade(recipeRL, grid.getWidth(), grid.getHeight(), grid.getIngredients(), getOutput().getThing()));
} else {
log("ShapedRecipe", recipeName, recipeRL, getOutput().getItemStack(), grid.getIngredients());
registry.register(new ShapedRecipe(recipeRL, grid.getWidth(), grid.getHeight(), grid.getIngredients(), getOutput().getThing()));
}
if (getOutput().hasAlternatives()) {
getOutput().getAlternatives().apply(new Callback<ItemStack>() {
@Override
public void apply(@Nonnull ItemStack alternative) {
Log.debug("Providing synthetic alternative recipe to JEI for oredicted output: " + alternative + ": " + grid.getIngredients());
JeiAccessor.addAlternativeRecipe(new ShapedRecipes("", grid.getWidth(), grid.getHeight(), grid.getIngredients(), alternative));
}
});
}
} else {
if (upgrade) {
log("GenericUpgradeRecipeShapeless", recipeName, recipeRL, getOutput().getItemStack(), shapeless.getIngredients());
registry.register(new ShapelessRecipe.Upgrade(recipeRL, shapeless.getIngredients(), getOutput().getThing()));
} else {
log("ShapelessOreRecipe", recipeName, recipeRL, getOutput().getItemStack(), shapeless.getIngredients());
registry.register(new ShapelessRecipe(recipeRL, shapeless.getIngredients(), getOutput().getThing()));
}
if (getOutput().hasAlternatives()) {
getOutput().getAlternatives().apply(new Callback<ItemStack>() {
@Override
public void apply(@Nonnull ItemStack alternative) {
Log.debug("Providing synthetic alternative recipe to JEI for oredicted output: " + alternative + ": " + shapeless.getIngredients());
JeiAccessor.addAlternativeRecipe(new ShapelessRecipes("", alternative, shapeless.getIngredients()));
}
});
}
}
} else {
Log.debug("Skipping Crafting '" + (getOutput() == null ? "null" : getOutput().getItemStack()) + "' (valid=" + valid + ", active=" + active + ")");
}
}
Aggregations