Jump to content

[1.11.2] Help with custom Sound


funsize888

Recommended Posts

Hello, I have been trying to get a custom sound to work for a while now, I thought I did everything right but the sound will not play in-game.

 

Here is my handler

Spoiler
package handlers;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import noahsmod.main.MyMod;
 
public class CustomSoundHandler {
 private static int size = 0;
 
 public static SoundEvent NUKE_EXPLODE;
 
 
 public static void init() {
  size = SoundEvent.REGISTRY.getKeys().size();
  
  NUKE_EXPLODE = register("block.nuke_explode");
  
 }
 
Spoiler

 


 public static SoundEvent register(String name) {
  ResourceLocation location = new ResourceLocation("nm", name);
  SoundEvent e = new SoundEvent(location);
  
  SoundEvent.REGISTRY.register(size, location, e);
  size++;
  System.out.print("REGISTERED");
  return e;
  
 }
 
}

Here is my Sounds.json:

Spoiler
{
 "block.nuke_explode": {
  "category": "block",
  "subtitle": "block.nuke_explode",
  "sounds": [ { "name": "nm:block/nuke_explode", "stream": true } ]
 }
 
 
}

My sound is located at : Workspace\src\main\resources\assets\nm\sounds\block

 

Any help is appreciated, thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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