I use Cyclic Soundproofing blocks in my machine rooms on DW20, and they muffle all machine sounds except for Mekanism machines. I believe this proposal could cover Mekanism machines as well with no to minimal side effects. As Cyclic and Mekanism end up in many of the same modpacks, increased interoperability between them will be a definite player experience improvement.
I haven't read the Mekanism source in detail, just enough to find the root cause and potential implementation strategy I'm giving here, so I don't know if this is feasible.
Mekanism uses tickable sounds for their machine sounds (See TileTickableSound here: https://github.com/mekanism/Mekanism/blob/1.20.4/src/main/java/mekanism/client/sound/SoundHandler.java), effectively masking them from the Cyclic soundproofing block. A check on TickableSoundInstance instances to see if they're created/managed by Mekanism TileTickableSound, and if so, considering them also muffleable may be possible.
I have found that Mekanism TileTickableSounds have soundCategory=SoundSource.BLOCKS, and it seems likely that the majority of environmental and background music TickableSoundInstances will not have that category value, so this may be feasible by changing event.getSound() instanceof TickableSoundInstance to (event.getSound() instanceof TickableSoundInstance && event.getSoundCategory() != SoundSource.BLOCKS) in the onPlaySound handler.
I may be missing something, and that would cast too wide a net, but this might be a simple addition for Mekanism compatiblity.
I use Cyclic Soundproofing blocks in my machine rooms on DW20, and they muffle all machine sounds except for Mekanism machines. I believe this proposal could cover Mekanism machines as well with no to minimal side effects. As Cyclic and Mekanism end up in many of the same modpacks, increased interoperability between them will be a definite player experience improvement.
I haven't read the Mekanism source in detail, just enough to find the root cause and potential implementation strategy I'm giving here, so I don't know if this is feasible.
Mekanism uses tickable sounds for their machine sounds (See TileTickableSound here: https://github.com/mekanism/Mekanism/blob/1.20.4/src/main/java/mekanism/client/sound/SoundHandler.java), effectively masking them from the Cyclic soundproofing block. A check on
TickableSoundInstance
instances to see if they're created/managed by MekanismTileTickableSound
, and if so, considering them also muffleable may be possible.I have found that Mekanism
TileTickableSound
s havesoundCategory=SoundSource.BLOCKS
, and it seems likely that the majority of environmental and background musicTickableSoundInstance
s will not have that category value, so this may be feasible by changingevent.getSound() instanceof TickableSoundInstance
to(event.getSound() instanceof TickableSoundInstance && event.getSoundCategory() != SoundSource.BLOCKS)
in theonPlaySound
handler.I may be missing something, and that would cast too wide a net, but this might be a simple addition for Mekanism compatiblity.