-
-
Notifications
You must be signed in to change notification settings - Fork 213
[1.21.5] Add model loading plugins to replace ModelEvent.ModifyBakingResult
#1884
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
base: 1.21.x
Are you sure you want to change the base?
Conversation
Last commit published: 7947f32e41a0a9fc23a37f15c2b8c71fdf51eaf6. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #1884' // https://github.com/neoforged/NeoForge/pull/1884
url 'https://prmaven.neoforged.net/NeoForge/pr1884'
content {
includeModule('net.neoforged', 'neoforge')
includeModule('net.neoforged', 'testframework')
}
}
} MDK installationIn order to setup a MDK using the latest PR version, run the following commands in a terminal. mkdir NeoForge-pr1884
cd NeoForge-pr1884
curl -L https://prmaven.neoforged.net/NeoForge/pr1884/net/neoforged/neoforge/21.5.29-beta-pr-1884-model_loading_plugins/mdk-pr1884.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip To test a production environment, you can download the installer from here. |
3c4627c
to
4b1c988
Compare
src/main/java/net/neoforged/neoforge/client/model/loadingplugin/ModelLoadingPluginManager.java
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/client/model/loadingplugin/ModelLoadingPluginManager.java
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/client/event/ModelEvent.java
Outdated
Show resolved
Hide resolved
4b1c988
to
6135c07
Compare
@XFactHD, this PR introduces breaking changes.
|
Any update on merging this? |
This is probably not going to be merged in the current state because of the drastic vanilla changes to model handling in 1.21.5, which is right around the corner. |
fcbc5bb
to
49ee251
Compare
It's effectively equivalent to the item before bake modifier
ModelEvent.ModifyBakingResult
ModelEvent.ModifyBakingResult
src/client/java/net/neoforged/neoforge/client/model/loadingplugin/ModelModifier.java
Outdated
Show resolved
Hide resolved
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public sealed interface ModelModifier { |
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.
We should make sure that each of these has a clear use case.
|
||
package net.neoforged.neoforge.client.model.loadingplugin; | ||
|
||
public interface ModelLoadingPlugin { |
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.
We could also fold standalone models into the plugin system. (Possibly just deprecating the current API, or rewriting it as a wrapper on top of a plugin).
|
||
package net.neoforged.neoforge.client.model.loadingplugin; | ||
|
||
public interface ModelLoadingPlugin { |
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.
Of course javadoc is still missing everywhere.
This PR adds model loading plugins which are intended to replace
ModelEvent.ModifyBakingResult
. These allow more precise model wrapping, including wrapping unbaked models. Another benefit of this API design is that it allows mods which implement on-demand model loading/baking a lot more control and improves compatibility between those mods and ones using the model wrapping APIs.As is probably very obvious, this PR is very heavily inspired by Fabric API's model loading APIs and therefor has an almost 100% overlap in terms of API surface and injection points.
The model loading plugins provide seven entrypoints into the model loading and baking process:
ModelEvent.ModifyBakingResult
)Apart from the missing documentation, there are still a few questions open: