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
api: Add support for playing sound with an "emitter" #316
Conversation
api/src/main/java/net/kyori/adventure/audience/ForwardingAudience.java
Outdated
Show resolved
Hide resolved
Just a thought: it's worth noting that whilst this does fix #315, it doesn't "fix" the subsequent problem of having a method to play sounds coming from the audience member (unless an implementation decides to use The issue arises from the fact that if you have a for (Player player : world.getPlayers()) {
player.playSound(sound, player);
} However, this does mean that there isn't a cross-platform way to signal you'd like a sound to be played from each member of the audience and it is a potential problem with Adventure that there isn't a way to indicate this. Firstly, I believe that it should be specified exactly what happens with the |
|
Yeah I suppose that could work - I think it does potentially confuse the idea of |
e45b8ae
to
b3f0482
Compare
Rebased and added further clarification to the Javadocs for the added method/interface. |
Following on from zml's comment in #330 (comment), I have updated this PR to add |
206948e
to
540e39b
Compare
540e39b
to
853bd0f
Compare
This is a simple PR that adds the concept of a sound "player". The interface for
Sound.Player
is intentionally empty, as the way the client/server identifies a sound player is with the entity ID, an implementation detail that some platforms may not wish to expose.The general idea is that a native implementation will implement
Sound.Player
on their entity class, allowing it to be passed directly as an argument into theplaySound
method. For platforms, they could provide utility methods to convert their entity class to an implementation of theSound.Player
interface which provides an entity object, or some other form of identifier. This can then be used to convert to the platform specific way of sending the entity sound effect packet.Alternatively, the
Sound.Player
could provide an integer ID, but this is just exposing what is essentially a magic number, not something as constant as, say, a UUID. I'm also not 100% sold on thePlayer
part, I think it's potentially too confusing with the actual player. Perhaps something likeSound.Maker
orSound.EntitySource
?