Play sound for only one player

Started by LaTortiia on

Topic category: Help with modding (Java Edition)

Last seen on 18:52, 20. Jan 2022
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Play sound for only one player

I'm making a mod and I need to play a sound with a very large range, but I only want 1 player to hear it, is there any way to do that?

Last seen on 15:09, 2. Sep 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
As far as I know, that is…
Thu, 10/22/2020 - 14:46

As far as I know, that is not how minecraft's sound engine works.  This might be impossible, even with custom code.  

Last seen on 05:22, 23. Feb 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
LOL, no. It is possible to…
Mon, 05/17/2021 - 21:47

LOL, no. It is possible to create a sound for only one player. All you have to do is use a custom command block in the procedures window. Find execute command and type in the text field: 

/playsound <sound> <source> <targets> [x] [y] [z] [volume] [pitch]

When doing a sound, figure out the data tag of your sound you created or just a (Minecraft:) sound. Then, pick your source, which will usually be "master" since most people sometimes mute other sounds, and master will be on most of the time. Then, If executing a sound on a player, use your target as (@p). This will find the closest player and play that sound only to them. Then x y z can be ~ ~ ~ but sometimes, just those symbols can sometimes break the sound and not play anything, so add a 1 like this: ~1 ~1 ~1, and your volume and pitch is up to you. This is about the only way to execute something like this, so good luck! Hope you like it!

Last seen on 05:22, 23. Feb 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Finished product can look…
Mon, 05/17/2021 - 21:50

Finished product can look like this --> /playsound minecraft:entity.lightning.bolt master @p ~1 ~1 ~1 1000 1