Skip to content

Recipe API for API8#2082

Merged
Faithcaio merged 1 commit intoapi-8from
api8/recipe
Feb 23, 2020
Merged

Recipe API for API8#2082
Faithcaio merged 1 commit intoapi-8from
api8/recipe

Conversation

@Faithcaio
Copy link
Contributor

@Faithcaio Faithcaio commented Jan 18, 2020

SpongeAPI | SpongeCommon

Recipe Types

  • CRAFTING
    • ShapedRecipe
    • ShapelessRecipe
    • SpecialRecipe (Recipes with coded conditions/results and no recipebook entry)
  • AbstractCookingRecipe
    • SMELTING FurnaceRecipe
    • BLASTING BlastingRecipe
    • SMOKING SmokingRecipe
    • CAMPFIRE_COOKING CampfireCookingRecipe
  • STONECUTTING StonecuttingRecipe

Registry

The old specialised RecipeRegistries get replaced by the one RecipeRegistry with RecipeType Parameters where needed.

  • Optional<Recipe> getById(CatalogKey)
  • Collection<Recipe> getAll()
  • Collection<T> getAllOfType(RecipeType<T>)
  • Collection<T> findByResult(RecipeType<T>, ItemStackSnapshot)
  • Optional<Recipe> findMatchingRecipe(Inventory, World)
  • Optional<SmeltingRecipe> findSmeltingRecipe(RecipeType<T>, ItemStackSnapshot)
  • Optional<RecipeResult> getResult(Inventory, World)

Building Recipes

implementing Interface will not be supported anymore (replaced by SpecialCraftingRecipe)
recipes no longer have name/translation

Builders for

  • ShapedCraftingRecipe
  • ShapelessCraftingRecipe
  • SpecialCraftingRecipe (replacement for implementing interface ; possibly with emulated recipe book entry)
  • StoneCutterRecipe
  • SmeltingRecipe (RecipeType determines in what block it works - requires multiple registration for different types)

new Builder Features

  • exp for SmeltingRecipe
  • cooktime for SmeltingRecipe
  • copy ingredients from other recipe (to replace it)
  • group (grouping recipes in the recipe book)

Ingredients

Ingredients for the recipe book are lists of:
net.minecraft.item.crafting.Ingredient.SingleItemList (one item matching and item id)
net.minecraft.item.crafting.Ingredient.TagList (all items matching an item tag)
SpecialRecipes don't use Ingredients, but instead implement boolean matching(inventory, world)
By providing exemplary ingredients we can maybe emulate the recipe book entry.

Registration

Only during RegistryEvent.Catalog<Recipe>.
A recipe matching the same ingredients as another recipe will override it.


related mc classes

net.minecraft.item.crafting
net.minecraft.data.RecipeProvider

@Faithcaio Faithcaio added status: input wanted api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) system: crafting labels Jan 18, 2020
@Faithcaio Faithcaio changed the base branch from stable-7 to api-8 January 18, 2020 16:47
@Faithcaio Faithcaio force-pushed the api8/recipe branch 3 times, most recently from c444883 to 3a940b2 Compare February 7, 2020 22:26
@Faithcaio Faithcaio marked this pull request as ready for review February 16, 2020 09:15
@Faithcaio Faithcaio requested a review from gabizou as a code owner February 16, 2020 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) status: input wanted system: crafting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant