-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.21.1] Processing Recipe Rework #7945
base: mc1.21.1/dev
Are you sure you want to change the base?
[1.21.1] Processing Recipe Rework #7945
Conversation
Update for JEI integration
|
Is there any part of this bit of the PR that would also be applicable to 1.20.1? |
Fixes #8048.
Overview
This PR reworked the Processing Recipe system in order to:
Codec
/StreamCodec
basedRecipeSerializer
system in 1.21.1ProcessingRecipe
andProcessingRecipeParams
, the recipe id is no longer retrievable upon deserialization so recipes should not ask for its own id upon construction.AllRecipeTypes
fromProcessingRecipe
so addons can create their own processing recipe typesProcessingRecipe
generic andProcessingRecipeParams
extensible soProcessingRecipe
with more context (likeItemApplicationRecipe
) can be created without having to injecting extra context to the baseProcessingRecipeParams
.Usage
To create a custom
ProcessingRecipe
with customProcessingRecipeParams
, takeItemApplicationRecipe
as an example:ProcessingRecipeParams
class:ItemApplicationRecipeParams
, add your own field (boolean keepHeldItem
) to it;MapCodec
for the params class by grouping aMapCodec
with all fields inProcessingRecipeParams
handled and your own fieldMapCodec
s, the prior can be created fromProcessingRecipeParams.codec(Supplier<P>)
:encode
anddecode
methods for network (de)serialization, and create aStreamCodec
for the params class usingProcessingRecipeParams.streamCodec(Supplier<P>)
:MapCodec
andStreamCodec
from the params', usingMapCodec#xmap
andStreamCodec#map
, and create your ownRecipeSerializer
with them.ProcessingRecipeBuilder
, you may optionally specify a generic factory interface for input if you wish to use the params for multiple recipes so they can share the builder class:IRecipeTypeInfo
, and use the recipe builder in datagen.