Jump to content

[Solved]Unable to play empty soundEvent (1.12.2)


Cyp86

Recommended Posts

I'm trying to create a custom disk for minecraft. Here is what i did:

 

This is my new item (MyItemDisk) :

public static final Item DISK_1 = new MyItemDisk("disk_1", Disks.DISK_1);

 

This is my class MyItemDisk :

public class MyItemDisk extends ItemRecord implements IHasModel { //IHasModel is for rendering
	public MyItemDisk(String name,SoundEvent sound) {
        super(name,sound);

        setRegistryName(name);
        setUnlocalizedName(name+".ctm");
        setCreativeTab(CreativeTabs.SEARCH); //Because I have a custom creative tab with all the items that have ".ctm" in their unlocalized names
      
	ModItems.ITEMS.add(this); //to register the item
	}
  
	@Override //IHasModel
	public void registerModels() {
		Main.proxy.registerItemRenderer(this, 0, "inventory");
	}
	
}

 

Here is Disks.DISK_1 (the SoundEvent) :

public class Disks {
	public static final SoundEvent DISK_1 = new SoundEvent(new ResourceLocation("ctm:records.disk_1")).setRegistryName("disk_1");
}

 

And finally I register the SoundEvent :

 

@SubscribeEvent
	public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) {	
		event.getRegistry().register(Disks.DISK_1);		
}

 

And here is my sounds.json :

 

{
    "records.disk_1": {
        "category": "record",
        "sounds": [
            {
                "name": "records/disk_1",
                "stream": true
            }
        ]
    }
}

 

I checked the other thread that I could found and most of the time, the problem was with a wrong folder name but I don't think that it's my issue, is it ?

 

(ps:the sound is in ogg format in "\src\main\resources\assets\ctm\sounds\records")

 

Here is what my folder looks like :

image.png.b4841ee184c3cc151e0e0ed0b4d7da59.png

 

And the error :

 

Quote

[14:26:06] [main/WARN] [net.minecraft.client.audio.SoundManager]: Unable to play empty soundEvent: ctm:records.disk_1

 

Edited by Cyp86
Solved
Link to comment
Share on other sites

20 minutes ago, Cyp86 said:

"name": "records/disk_1",

If I recall correctly a sound name should be prefixed by your modid.

"name": "ctm:records/disk_1"

33 minutes ago, Cyp86 said:

I checked the other thread that I could found and most of the time, the problem was with a wrong folder name but I don't think that it's my issue, is it ?

If the file can't be found the startup log will contain a message that a file at a given resource location could not be found.

  • Thanks 2
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.

Announcements



×
×
  • Create New...

Important Information

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