-
Notifications
You must be signed in to change notification settings - Fork 427
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
Add UnbakedModelDeserializer
#4321
Add UnbakedModelDeserializer
#4321
Conversation
Is load conditions the same thing as resource conditions? if so, https://github.com/FabricMC/fabric/blob/1.21.4/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/impl/resource/conditions/ResourceConditionsImpl.java#L66-L87 is the implentation. If a type is not specified, the resource is loaded as normal, as if all conditions passed |
|
...rc/client/java/net/fabricmc/fabric/api/client/model/loading/v1/UnbakedModelDeserializer.java
Show resolved
Hide resolved
...rc/client/java/net/fabricmc/fabric/api/client/model/loading/v1/UnbakedModelDeserializer.java
Outdated
Show resolved
Hide resolved
...rc/client/java/net/fabricmc/fabric/api/client/model/loading/v1/UnbakedModelDeserializer.java
Outdated
Show resolved
Hide resolved
Apart from optional types and the docs TODO, the implementation looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, nice and simple API surface.
...rc/client/java/net/fabricmc/fabric/api/client/model/loading/v1/UnbakedModelDeserializer.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
* Add UnbakedModelDeserializer * Document UnbakedModelDeserializer * Allow custom model types to be optional * Update javadoc as per suggestion Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> --------- Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> (cherry picked from commit ae23723)
This pull request introduces the
UnbakedModelDeserializer
interface, which allows overriding the deserialization process of a JSON model file based on itsfabric:type
JSON key.Points to Discuss
Resolution: Yes. The behavior and syntax of this feature matches those of NeoForge and is explained in the documentation of this pull request. Resource conditions may in theory work as a functionally equivalent alternative but would be significantly less convenient to use, requiring the creation of multiple files per model.
elements
,parent
,textures
,ambientocclusion
,display
,gui_light
) be provided? If so, how?Resolution: They will not be included in this pull request but may be added in a later one.
Resolution: They will not be included in this pull request but may be added in a later one.
Resolution: None will be included in this pull request but some may be added in a later one.
UnbakedModelDeserializer
have a method to retrieve itsIdentifier
likeCustomIngredientSerializer
instead of the ID being passed to theregister
method directly?Resolution: No; not necessary.
UnbakedModelDeserializer
be generic? It represents a "type" which can create instances, and such classes are almost always generic both in Fabric API and vanilla.Resolution: No; not necessary.
Resolution: Only naming of the single added API class,
UnbakedModelDeserializer
, and its members matters. These names are already good. Class and member names in the implementation can be changed at any later time.TODO