NeoForge icon indicating copy to clipboard operation
NeoForge copied to clipboard

Outgredients system and tag outgredients in recipes

Open IchHabeHunger54 opened this issue 5 months ago • 6 comments

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 to Ingredient/FluidIngredient.
  • Adds an associated OutgredientType<?> registry, mirroring IngredientType/FluidIngredientType.
  • Replaces ItemStack results in recipes with Outgredient<ItemStack>s, mods can similarly replace their FluidStack results with Outgredient<FluidStack>s.
  • Adds a DefaultedItemTagOutgredient that basically replaces a recipe's item field with two tag and fallback fields, with the latter optional. Similar for DefaultedFluidTagOutgredient.
    • 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.

IchHabeHunger54 avatar Jul 10 '25 18:07 IchHabeHunger54

  • [ ] 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$Factory
    • create(Ljava/lang/String;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/item/crafting/SingleItemRecipe;: ❗ API method was removed
    • create(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$Factory
    • create(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 abstract
    • create(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.

IchHabeHunger54 avatar Jul 13 '25 21:07 IchHabeHunger54

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"

KnightMiner avatar Jul 13 '25 21:07 KnightMiner

@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)

thedarkcolour avatar Jul 18 '25 05:07 thedarkcolour