-
Notifications
You must be signed in to change notification settings - Fork 420
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
Update Model Loading API to 1.21.4 #4243
Merged
modmuss50
merged 7 commits into
FabricMC:1.21.4
from
PepperCode1:pr/1.21.4/model-loading-api
Nov 30, 2024
Merged
Update Model Loading API to 1.21.4 #4243
modmuss50
merged 7 commits into
FabricMC:1.21.4
from
PepperCode1:pr/1.21.4/model-loading-api
Nov 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Split model modifier events and callbacks - one set for static models and one set for block models - This is necessary because static models use UnbakedModel and are baked with settings while block models use GroupableModel and are not baked with settings - This cleans up the Identifier/ModelIdentifier getters - OnLoad for block models was not added because the unbaked block model map is not a cache and block models cannot inherit from other models - Make DelegatingUnbakedModel a record to allow accessing the delegate ID - Remove BuiltinItemRenderer, BuiltinItemRendererRegistry, and BuiltinItemRendererRegistryImpl as they were replaced by a TAW to SpecialModelTypes.ID_MAPPER
- The functionality of ModelResolver could be perfectly replicated with ModelModifier.OnLoad with OVERRIDE_PHASE - The functionality of BlockStateResolver could be perfectly replicated with ModelModifier.BeforeBakeBlock with OVERRIDE_PHASE - Fix log warning caused by half_red_sand.json not defining particle sprite
8 tasks
- BeforeBakeBlock runs too late to allow modifying how models are grouped, so OnLoadBlock is necessary to allow that - OnLoadBlock only runs for models which were actually loaded from blockstate files, so BlockStateResolver is necessary to allow adding models for blocks without a corresponding blockstate file - Add UnwrappableBakedModel - Moved and renamed from FRAPI's WrapperBakedModel (original will be deleted in separate PR) - Implement it and interface inject it on vanilla's WrapperBakedModel - Add new static UnwrappableBakedModel#unwrap method which accepts a Predicate saying when to stop unwrapping - Add WrapperUnbakedModel which simply delegates all method calls to a different UnbakedModel
PepperCode1
added
the
priority:high
High priority PRs that need review and work now. Review these first.
label
Nov 27, 2024
….21.4/model-loading-api
- Remove BeforeBake, AfterBake, BeforeBakeBlock, AfterBakeBlock - Remove DelegatingUnbakedModel - Add WrapperGroupableModel - Add documentation and extra constructor to WrapperUnbakedModel
modmuss50
approved these changes
Nov 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
last call
If you care, make yourself heard right away!
port
Porting existing code to a different version
priority:high
High priority PRs that need review and work now. Review these first.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UnbakedModel
and are baked with settings while block models useGroupableModel
and are not baked with settingsIdentifier
/ModelIdentifier
gettersBlockState
directly toModelModifier.OnLoadBlock
BeforeBake
andAfterBake
can be perfectly replicated withOnLoad
since it is now possible to replace anyUnbakedModel
with any otherUnbakedModel
(not justJsonUnbakedModel
) in 1.21.4BeforeBakeBlock
andAfterBakeBlock
can be perfectly replicated withOnLoadBlock
andGroupableModel
no longer extendsUnbakedModel
Baker
, but ran after model discovery was done, so using the baker could be unreliableBeforeBakeBlock
andAfterBakeBlock
run after the creation of block model groups is done, so replacing the block model using these events would not update the block model groupsModelModifier.OnLoad
can now accept anull
model, which is a model that was requested during resolution but does not have a corresponding JSON file; RemoveModelResolver
as its functionality can now be perfectly replicated withModelModifier.OnLoad
withOVERRIDE_PHASE
Baker
Nullable
annotations to match vanilla changesUnwrappableBakedModel
WrapperBakedModel
(original will be deleted in Port FRAPI to 1.21.4 and refactor #4247)WrapperBakedModel
UnwrappableBakedModel#unwrap
method which accepts aPredicate
saying when to stop unwrappingWrapperUnbakedModel
which simply delegates all method calls to a differentUnbakedModel
WrapperGroupableModel
which simply delegates all method calls to a differentGroupableModel
DelegatingUnbakedModel
asGroupableModel
no longer extendsUnbakedModel
, soBlockModelResolver
s can no longer use it, which was its original purpose; it is also not suitable for use inModelModifier.OnLoad
as returning one would affect all child models, which is usually not the desired behaviorBuiltinItemRenderer
,BuiltinItemRendererRegistry
, andBuiltinItemRendererRegistryImpl
(part of Rendering v1, not Model Loading API v1) as they were replaced by a TAW toSpecialModelTypes.ID_MAPPER