Player ambience ala Dead by Daylight?

Started by swelkinn_n on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Player ambience ala Dead by Daylight?

I'm making a mod that's supposed to be similar to the game Dead by Daylight, and I'm currently stuck at trying to find a way to make the Killer player play music when another player is around. I'm not looking for some elegant system with varying sounds depending on how close they are like in the actual game, but just "if a player is near this specific player, they hear a sound."

If it needs to use a command, that's perfectly fine; the mod needs cheats/creative usage to work, but I just can't quite figure out how to get it. I'm aware of the 'Does entity exist at xyz in square cube" block, but this doesn't (seem to) let me detect the difference between what player (and would always activate regardless), and generally I can't see any way to even detect a player with any variable or NBT tag or anything with similar methods, especially since entity tick updates can only target that entity (not that source entity would help) so I've been fairly lost.

Outside of that, I also want it to be client side, since it wouldn't make sense for every player to hear the sound if only one of them are within range.