Skip to content
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 a way to animate armor models in HumanoidArmorLayer #1541

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

GizmoTheMoonPig
Copy link
Contributor

Hello again!

I have a custom armor model that I'm rendering via HumanoidArmorLayer, as it should be. The armor model has some extra bits that I would like to animate to sway, similar to how the player's arms do. There's one small issue though: HumanoidArmorLayer doesn't call setupAnim or prepareMobModel anywhere, making it impossible to do so. I don't really want to handle this through a custom layer as everything else works perfectly, so I drafted up this PR to fix my issue.

This PR adds a new method to IClientItemExtensions that allows for calling animation methods in the armor model if desired. This is called right before the model is rendered, meaning you can manipulate parts of the model (moving or rotating) as you so desire.

Please let me know if anything needs changing or if my documentation needs updating. I'll fix it as soon as I can. Thanks for looking over this!

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@sciwhiz12 sciwhiz12 added enhancement New (or improvement to existing) feature or request rendering Related to rendering 1.21.1 Targeted at Minecraft 1.21.1 labels Sep 15, 2024
@KnightMiner
Copy link
Contributor

KnightMiner commented Sep 19, 2024

I never had issues animating humanoid armor layers using the Forge hook, did something change recently that caused issues?

Remember the method to swap the model from the vanilla model to the modded model takes in the original as a parameter; there is a method I recall using to copy the armor properties over from the old model. See this test mod for reference.

@GizmoTheMoonPig
Copy link
Contributor Author

copying properties isnt my problem here: getting that to work is straightforward enough. I want to have pieces of the armor animate on their own terms.

For example, take the armor model displayed below: (amphibious armor from the Betweenlands)
2024-09-13_11 09 48
The specific use case here is to make the various fins and the whiskers on the model passively swing, not dependent on player movement or anything. This used to be done through the model's setupAnim method (done here), the same way the player's passive arm bob is done or how rotating something like the blaze's rods happens. Now here's the issue: the model's setupAnim is not called anywhere in the armor layer (it used to in 1.12!), meaning animations using things like the limb swing and whatnot isnt possible without doing some wacky workarounds. I would prefer to just be able to call setupAnim in the extensions and call it a day.

@pupnewfster pupnewfster merged commit b92c510 into neoforged:1.21.x Sep 26, 2024
6 checks passed
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.1.62.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.1 Targeted at Minecraft 1.21.1 enhancement New (or improvement to existing) feature or request rendering Related to rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants