Interface IRecipeOutputExtension
- All Known Subinterfaces:
RecipeOutput, ScopedRecipeOutput
- All Known Implementing Classes:
ConditionalRecipeOutput, RecipeOutputWrapper
public interface IRecipeOutputExtension
Extra methods for
RecipeOutput.-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ResourceKey<Recipe<?>> key, Recipe<?> recipe, @Nullable AdvancementHolder advancement, ICondition... conditions) Generates a recipe with the given conditions.private RecipeOutputself()default RecipeOutputwithConditions(ICondition... conditions) Builds a wrapper around this recipe output that adds conditions to all received recipes.default ScopedRecipeOutputwithContext(UnaryOperator<RecipeContextBuilder> builder) Scopes theRecipeOutputto use a specific context.
-
Method Details
-
self
-
accept
void accept(ResourceKey<Recipe<?>> key, Recipe<?> recipe, @Nullable AdvancementHolder advancement, ICondition... conditions) Generates a recipe with the given conditions. -
withConditions
Builds a wrapper around this recipe output that adds conditions to all received recipes.- Parameters:
conditions- The conditions to apply to the recipe output.- Returns:
- The wrapped recipe output.
-
withContext
Scopes the
RecipeOutputto use a specific context.This should be used via a
try-with-resources block:// In some `RecipeProvider` subclass @Override protected void buildRecipes() { try (var _ = this.output.withContext( builder -> builder.forMod("examplemod") .withConditions( NeoForgeConditions.modLoaded("examplemod") ) )) { // Sets the recipe id to "examplemod:diamond_to_apple". // Will only load if "examplemod" is present. this.shapeless(RecipeCategory.MISC, Items.APPLE) .requires(Items.DIAMOND) .unlockedBy(getHasName(Items.APPLE), this.has(Items.APPLE)) .save(this.output, "diamond_to_apple"); // ... } }- Parameters:
builder- A unary operator used to construct the context.- Returns:
- A scoped recipe output.
-