AmbientSounds 6

AmbientSounds 6

54M Downloads

[1.12.2-v3.0.18] Rain / Snow Stops All Sounds

Ameranth opened this issue ยท 6 comments

commented

Hello again!

Working some more on a sound engine, and I think the logic for raining stops sounds which don't define raining=true/false when it rains--including things like thunder and wind. I believe the problem is here, in AmbientCondition.java, because it returns null for any sound that has no raining data when it rains:

if (raining != null && raining ? !env.raining : env.overallRaining)
	return null;

Perhaps it should be something like this?:

if (raining != null && (raining ? !env.raining : env.overallRaining))
	return null;

This way sounds with no raining data will always play.

Apologies if I've misunderstood the code!

commented

Update: Another result of this issue is that rain sound (from this mod) isn't played at all, because even though its region selector has raining=true, its sound selector has no definition for raining.

commented

I'm not exactly sure what you mean, can you maybe provide an example?

commented

Thank you for the reply!

Sorry, I will try to clarify:

  • No sounds from AmbientSounds3 play when it rains, because of this code in AmbientCondition.java:
if (raining != null && raining ? !env.raining : env.overallRaining)
	return null;
  • This code has two problems:

    1. Any sound or region in engine.json without raining=true/false will be like it has raining=false. This is incorrect, because some sounds are wanted all the time, like for example wind.
    2. Even rain and thunderstorm sounds do not play when it rains, because engine.json does not have raining=true in their regions and sounds, which this code requires (they only have it in the region).
  • To fix both problems, the code should be changed so that sounds and regions without raining=true/false will play no matter if it rains or not.

    • Using this code instead should fix it (parenthesis around (raining ? !env.raining : env.overallRaining) is the change):
if (raining != null && (raining ? !env.raining : env.overallRaining))
	return null;
  • Here is another example of a sound that should play all the time, but does not when it rains because of this problem--in engine.json, the region "cave-ambience" on line 303:
{
  "name": "cave-ambience",
  "regions": [ "cave" ],
  "min-height-relative": {
	"max": -2,
	"fade": 2
  },
  "light": {
	"max": 8,
	"fade": 2
  },
  "blocks": {
	"materials": [ "rock" ]
  },
  "sounds": [
	{
	  "name": "suspense",
	  "files": [ "ambientsounds:suspense.cave1", "ambientsounds:suspense.cave2" ],
	  "length": {
		"min": 400,
		"max": 700
	  },
	  "transition": 200
	}
  ]
}

This should play cave sounds always, but it will not during rain because it does not have raining=true/false.

commented

I have been experiencing this too, and its kind of unnerving to have everything go silent. I have used Corgi Taco's weather mod and similar things happen with their custom weather conditions, everything goes silent in cloudy weather for example.

commented

Changes have been made in the newest version. Sorry that it took me so long.

commented

No apology is necessary; you've been kind enough to take time out of your day to address the issue, so thank you very much!

I can't wait to try the new patch!