Refactor tick method to address missing ambient sounds #9815
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Create 6.0.9 on NeoForge 21.1.217, there is a bug where ContinuousSound sounds such as cog and shaft ambience are not played. This usally happens when you log in to a server or singleplayer world where there are already spinning cogs, and can be fixed in game be either reloading resources (F3-T) and thus triggering a SoundScapes.invalidateAll, or by teleporting away such that the machines get unloaded and then teleporting back (or by retoggling the ambient sound config. From my testing, this bug is a result of a desync between Create (ContinuousSound instances) and the Minecraft SoundManager. This pull request introduces a potential fix by ensuring sounds in the continuous sound list in the SoundScape class are actually playing in the Minecraft SoundManager every few ticks. I have tested in game and this patch fixes the audio bug without side effects, but it may not be the best or most idiomatic solution. Even if this is not the route taken, I would apreciate feedback on the PR and hope this is at least a good starting point.