henkelmax / sound-physics-remastered

A Minecraft mod that provides realistic sound attenuation, reverberation, and absorption through blocks.
GNU General Public License v3.0
69 stars 22 forks source link

[1.18.1] Zombie Awareness Compatibility #21

Closed Darkosto closed 2 years ago

Darkosto commented 2 years ago

Is your feature request related to a problem? Please describe. Hello! I just downloaded Zombie Awareness and it seems like a number of game sounds (such as Zombies taking damage) are missing when using Sound Physics. Disabling sound physics allows the sounds to come back. Are you able to look into support for this mod?

MC: 1.18.1 Sound Physics: 1.1.8.1-1.0.3 Zombie Awareness: 1.18.1-1.12 Forge: 39.0.9

https://www.curseforge.com/minecraft/mc-mods/zombie-awareness

Thank you! Darkosto

henkelmax commented 2 years ago

I can't look into this issue, since their code for 1.18 is closed source. Unfortunately this will make it harder to find a solution...

jackg2527 commented 2 years ago

Thanks for trying. Posted on ZA but no response from mod owner :-/

Corosauce commented 2 years ago

Ah my bad never actually pushed the new branches, fixed.

Figured as much we both mixin to similar areas, mine might be too invasive, I'm redirecting the broadcast call in playSound so i can hook in and get the coordinates of the sound playing that lack player references (forge doesnt provide this without a player), I just need to hook and call my method, not change any functionality, if there is a cleaner mixin to use I'm open to trying it out, examples encouraged :D

Its these that conflict maybe? Yours: https://github.com/henkelmax/sound-physics-remastered/blob/1.18.1/common/src/main/java/com/sonicether/soundphysics/mixin/ServerWorldMixin.java

Mine: https://github.com/Corosauce/ZombieAwareness/blob/1.18/src/main/java/com/corosus/zombieawareness/mixin/MixinPlaySound.java

henkelmax commented 2 years ago

Its these that conflict maybe? Yours: https://github.com/henkelmax/sound-physics-remastered/blob/1.18.1/common/src/main/java/com/sonicether/soundphysics/mixin/ServerWorldMixin.java

Mine: https://github.com/Corosauce/ZombieAwareness/blob/1.18/src/main/java/com/corosus/zombieawareness/mixin/MixinPlaySound.java

Yeah these mixins might not work together, but even if my mixin wouldn't work at that place, it wouldn't cause any big issues (At least on my side).

I don't know how mixin conflicts are handled, but it might be that my mixin gets prioritized in that case and thus your code never gets executed and that's what's causing no sounds to be played...

Instead of using redirect, you could use @Inject with LocalCapture: image https://fabricmc.net/wiki/tutorial:mixin_examples

It should do the same without causing incompatibilities.

I could also try setting a lower priority of the mixin on my side if that's not possible.

Corosauce commented 2 years ago

Resolved :+1:

Thanks for the insight, it was just what it needed, I don't fully understand why it was breaking specific sounds before, but I reproduced the issue then fixed it with this: https://github.com/Corosauce/ZombieAwareness/commit/db926bdbd7b2ce87ce9d1d485feb58cdedf84a1d

You can test with this ZA release once curse approves it: https://www.curseforge.com/minecraft/mc-mods/zombie-awareness/files/3603741

henkelmax commented 2 years ago

Awesome! Thanks!

henkelmax commented 2 years ago

Tested it and it seems to work fine

Darkosto commented 2 years ago

Thank you @henkelmax and @Corosauce for resolving this!

jackg2527 commented 2 years ago

Ditto that! Much appreciated.