Jump to content

Supersaver

Members
  • Posts

    1
  • Joined

  • Last visited

Supersaver's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi everyone, I’m working on a Minecraft mod and encountering an issue with a custom sound not playing when triggered. Here’s the setup: Problem: * A custom sound (killstreak_music) should play when a milestone (5 kills) is reached, but it doesn’t trigger in-game. * The .ogg file is in the correct directory (assets/killstreaksword/sounds/) and registered in sounds.json. sounds.json: { "killstreak_music": { "sounds": ["Finale.ogg"] } } The .ogg file plays fine in other media players, but the /playsound command doesn’t detect it. What I’ve Tried: * Confirmed file path and name match exactly. * Reloaded resources (F3 + T) and re-exported the file using Audacity. * Added debug logs to my code to verify if the sound event is being retrieved. Here’s the relevant part of my code where I attempt to play the sound: private static final ResourceLocation SOUND_LOCATION = ResourceLocation.fromNamespaceAndPath("killstreaksword", "killstreak_music"); private void playKillstreakMusic(Level world, Player player) { SoundEvent soundEvent = ForgeRegistries.SOUND_EVENTS.getValue(SOUND_LOCATION); if (soundEvent == null) { System.out.println("Sound event not found: " + SOUND_LOCATION); } else { world.playSound(null, player.getX(), player.getY(), player.getZ(), soundEvent, SoundSource.PLAYERS, 1.0F, 1.0F); } } Could this be a file encoding or registration issue? Are there additional steps I’m missing to ensure Minecraft detects the sound? Any guidance or suggestions would be greatly appreciated. Thanks in advance!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.