Outgredients system and tag outgredients in recipes
This pull requests adds an "outgredients" API, which is similar to Neo's ingredients API but for recipe outputs. It also adds tag outgredients that pull from a priority list in the config. This is a partial revival of #539 .
- Introduces a new
Outgredient<?>interface that operates in a similar fashion toIngredient/FluidIngredient. - Adds an associated
OutgredientType<?>registry, mirroringIngredientType/FluidIngredientType. - Replaces
ItemStackresults in recipes withOutgredient<ItemStack>s, mods can similarly replace theirFluidStackresults withOutgredient<FluidStack>s. - Adds a
DefaultedItemTagOutgredientthat basically replaces a recipe'sitemfield with twotagandfallbackfields, with the latter optional. Similar forDefaultedFluidTagOutgredient.- The defaulted outgredients read the tag preferences from datapack files and a config.
- Other result types are possible. For example, a config toggle-dependent result would be a possibility.
- Patches the recipe builders for support.
- In order to not bloat patch sizes further, moves both new and existing Neo-added static helpers to extension interfaces.
- Adds a loot entry type that makes use of the item tag priorities.
An example JSON usage could be as follows:
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"###",
"###"
],
"key": {
"#": {
"tag": "c:ingots/tin"
}
},
"result": {
"neoforge:outgredient_type": "neoforge:defaulted_item_tag",
"tag": "c:storage_blocks/tin",
"fallback": "mymod:tin_block",
"count": 1
}
}
See also the associated Discord brainstorming thread for initial discussion about this idea and the PR. Opening as draft so that we can actually look at code. This is not yet tested and not yet complete.
- [ ] Publish PR to GitHub Packages
@IchHabeHunger54, this PR introduces breaking changes. Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them. Last checked commit: e0f6b40323514a4e2682b28d0eaf779f1273dea8.
Compatibility checks
neoforge (:neoforge)
net/minecraft/world/item/crafting/SingleItemRecipe$Factorycreate(Ljava/lang/String;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/item/crafting/SingleItemRecipe;: ❗ API method was removedcreate(Ljava/lang/String;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/neoforged/neoforge/common/crafting/outgredient/Outgredient;)Lnet/minecraft/world/item/crafting/SingleItemRecipe;: ❗ Method was made abstract
net/minecraft/world/item/crafting/AbstractCookingRecipe$Factorycreate(Ljava/lang/String;Lnet/minecraft/world/item/crafting/CookingBookCategory;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/neoforged/neoforge/common/crafting/outgredient/Outgredient;FI)Lnet/minecraft/world/item/crafting/AbstractCookingRecipe;: ❗ Method was made abstractcreate(Ljava/lang/String;Lnet/minecraft/world/item/crafting/CookingBookCategory;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraft/world/item/ItemStack;FI)Lnet/minecraft/world/item/crafting/AbstractCookingRecipe;: ❗ API method was removed
Marking as ready for review to get a first round of reviews in. Three things I would like to note:
- There are no tests yet, I hope to get around to writing those in the next days, ideally tomorrow.
- Yes, the breaking changes are on purpose. I did not see a clean way around them, so here we are.
- I'd ask the inevitable bikeshedding on the name "outgredient" to be delayed until all other details are hammered out.
Please don't call it "outgredients". That name is pretty easy to spell wrong as it's not a real word.
I have custom output types in many of my mods, they are just called "ItemOutput" or if you want a generic name "Recipe output". In JSON you can say "output_type". Result is also a good name as it's what vanilla uses everywhere for outputs.
I just can't take this idea seriously when you call it "outgredients"
@IchHabeHunger54, this pull request has conflicts, please resolve them for this PR to move forward.
Please don't call it "outgredients". That name is pretty easy to spell wrong as it's not a real word.
I have custom output types in many of my mods, they are just called "ItemOutput" or if you want a generic name "Recipe output". In JSON you can say "output_type". Result is also a good name as it's what vanilla uses everywhere for outputs.
I just can't take this idea seriously when you call it "outgredients"
I also find Outgredients to be a silly name. I call my implementation of it TagResult as they're specifically tied to tags, and there's already an unrelated RecipeOutput class elsewhere (I assume this name would follow the ItemOutput/RecipeOutput naming scheme)