Skip to content

Add support for baking multiple models in the standalone API #2135

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

Merged
merged 1 commit into from
Apr 20, 2025

Conversation

SquidDev
Copy link
Contributor

The current standalone model API currently is designed around baking a single model, loaded from the resource pack. However, Minecraft's other model APIs (e.g. ItemModel.Unbaked) work differently, with consumers being responsible for marking dependencies, fetching model(s) from the bakery, and baking them.

This adds similar support to the standalone model system, with the addition of a new interface.

public interface UnbakedStandaloneModel<T> extends ResolvableModel {
    T bake(ModelBaker baker);
}

This allows mods to implement dynamic models for their modded game content, in the style of ItemModel. See this discussion on Discord for more context.

In the future it would make sense to remove the modelId from StandaloneModelKey (as it is no longer tied to a single model), and have an API closer to Fabric's (FabricMC/fabric#4565). I've not done so for now, as it felt like an unnecessary breaking change, but happy to do so now if preferred!

@neoforged-automation neoforged-automation bot added the 1.21.5 Targeted at Minecraft 1.21.5 label Apr 13, 2025
@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@SquidDev SquidDev changed the title Add support for backing multiple models in the standalone API Add support for baking multiple models in the standalone API Apr 14, 2025
@Technici4n
Copy link
Member

We might want to wait for model loading plugins, and see how this would fit into that system?

@SquidDev
Copy link
Contributor Author

I would 100% be in favour of just pulling in Fabric's model loading API. However, #1884 seems incredibly WIP at this point, so it didn't feel worth pushing this back — I feel this is a fairly standalone change that we'll want either way.

@Matyrobbrt Matyrobbrt added enhancement New (or improvement to existing) feature or request area: rendering Related to rendering labels Apr 20, 2025
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Technici4n Technici4n merged commit f19956a into neoforged:1.21.x Apr 20, 2025
7 checks passed
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.5.49-beta.

@SquidDev
Copy link
Contributor Author

Thanks all!

@SquidDev SquidDev deleted the extra-models branch April 20, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.5 Targeted at Minecraft 1.21.5 area: rendering Related to rendering enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants