-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
[1.21] Select Music Event #862
[1.21] Select Music Event #862
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We strive to keep the size of the patches themselves as small as possible. Instead of patching Minecraft#getSituationalMusic
, you could replace the single call to it in MusicManager
with ClientHooks.getSituationalMusic()
and have that method call the original vanilla method, fire the event, and return the appropriate value. Then we no longer need a bunch of return
-> result =
patches.
ah yeah, good idea, hadn’t thought of that |
ok, changes made |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, I just have one comment
ah yeah good idea, I’ll do this when get the chance |
Honestly, I have no idea how this will work in correlation to multiple mods. For example, if a mod played situational music based upon being in a given structure while a different mod played situational music based on an item the player was wearing on their head, which one would take precedence? I'm not against the PR, but I think there should be some ordering that should be either defined or explained with some custom system or using the priority of the event listener (e.g., HIGHEST for helmet, LOW for in a structure, LOWEST for a biome/dimension. Other ideas are welcome. Also, I think the music that should be present in the event is the current music, not the one that Mojang is going to take over after yours. |
hmm yeah I can probably add some documentation stuff for the event priority stuff, good idea for the other part, I’m not 100% sure what you mean, but if you mean that you should be able to change the You can also still have the music track instantly start playing as well and stop existing music, if that’s what you meant, you just have to set the Music so that The specific use case this was initially meant for was for the Aether mod, which overrides creative music in its biomes so that it plays the biome music instead, plus one of its addons that additionally adds nighttime music tracks for the dimension Previously the Aether had used it’s own entirely new music manager, but I figured out that it wouldn’t really be necessary to have a separate one if there was a way to modify what music gets chosen based on the situation heck this got long, whoops lol, hopefully it’s not too convoluted 😂 |
I don't mean you should change the |
The issue with that is that if you wanted to somehow utilize the original default music track for the situation when choosing the new potential music track, you wouldn’t be able to if it instead gave you the current playing music (for instance, using a map to switch to a different music track if a certain one would’ve been played plus a certain condition, such as it being nighttime) pretty much, the reason it calls |
Note for my Bumblezone mod, I have a structure that should stop all other music when player is in it and plays the structure’s own music. Then there is an arena event in the structure that can be triggered that will stop the structure music and play the arena event music. Which means my use case is one where I’m going to want to override everyone else’s music. At least to me, I feel like I want high priority. Is there a reason why a helmet music should override my event music? |
most likely what you’d want to do is have the structure music be high priority, and then the event music higher priority, and have both |
I understand, though I feel as though
My general thought process was that things closer to the player in context would take higher priority, since that would be what the player is focusing on. However, it's up to the modders to determine which priority makes sense for their mod. I was just using the helmet as an example. |
ah ok I see, I didn’t see the part about having an item on the players head before lol so I was confused when telepathicgrunt mentioned helmets lol but yeah music keeps playing even if it’s not the one that would’ve been picked, so if you are in one biome with one music, which is playing, and you go to another with different music then it won’t just instantly stop the music so it won’t necessarily be the same hmm, semi-unrelated to this specific conversation, but I just realized an issue that changing it so it reassigns the music variable rather than having a separate posted variable would resolve, so that’s a good thing |
ok, changed it so it reassigns the |
hopefully I didn't overdo the javadocs lol
2ccf020
to
640ee7f
Compare
… to them, maybe some other pr forgot to do this)
Ok, made the changes requested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. A few changes because you may have misunderstood what I meant in discord.
patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/client/event/SelectMusicEvent.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some patch issues, but other than that, looks good.
okay, fixed those as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine now.
What this does is adds an event for when
Minecraft#getSituationalMusic()
gets fired, allowing for modders to change/set the music based on whatever conditions they want (that are available from the client of course)hopefully I did everything right, this is my first ever pull reqeust for either forge or neoforge, but I did follow the contributing instructions so hopefully it should be good