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

Fix earmuff behavior for long-running sounds #5863

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Fix earmuff behavior for long-running sounds #5863

merged 2 commits into from
Feb 13, 2024

Conversation

malte0811
Copy link
Collaborator

As discussed on Disord starting here: The previous implementation only applied attenuation when starting the sound, so long-running sounds did not update when earmuffs were equipped/unequipped. The new approach uses a Mixin, but can handle such sounds correctly.

Note that this PR is on 1.20.4 since for a compatible implementation we need the injectors from MixinExtras. This library is provided by NF on 1.20.4, but not on 1.20.1.

Previously the earmuffs would only affect sounds when they started, i.e.
a sound started before putting on earmuffs would never get attenuated
while a sound started while wearing earmuffs would be attenuated
forever.
Copy link
Owner

@BluSunrize BluSunrize left a comment

Choose a reason for hiding this comment

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

Pretty clean use of Mixins, I'd say.
Could be interesting to see what happens when multiple mods do this, haha.

@BluSunrize
Copy link
Owner

Followup question: Is this something we should have considered for 1.20.1?

@malte0811
Copy link
Collaborator Author

Could be interesting to see what happens when multiple mods do this

It will "just work" with multiple mods, and that's essentially why it isn't on 20.1: this clean and compatible implementation only works with MixinExtras, which isn't provided by NeoForge on 20.1. I can try to put something together, but it will probably be much more complex.

@malte0811 malte0811 merged commit 972ee1e into 1.20.4 Feb 13, 2024
5 checks passed
@malte0811 malte0811 deleted the fix-earmuffs branch February 13, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants