Jump to content

[1.9.4] Registering SoundEvent ignoring my modid?


coolAlias

Recommended Posts

public static SoundEvent SOUND_LEVELUP;

// Called from main class during FMLPreInitializationEvent
public static void registerSounds() {
	SOUND_LEVELUP = registerSound(new ResourceLocation(ModInfo.ID, "levelup"));
	// etc.
}
private static SoundEvent registerSound(ResourceLocation location) {
	final SoundEvent sound = new SoundEvent(location).setRegistryName(location);
	return GameRegistry.register(sound);
}

 

During the loading process just before the SoundSystem starts, I receive an error message like the following for every single sound listed in my sounds.json file:

File minecraft:sounds/special/levelup.ogg does not exist, cannot add it to event dynamicswordskills:levelup

Note how it appears to be searching for the file with the 'minecraft' domain rather than my mod id, even though it shows the correct resource location just after that.

 

I'm using Forge 1.9.4-12.17.0.1976.

 

What am I doing wrong?

Link to comment
Share on other sites

The sound events in your sounds.json file have their resource domain set automatically from the file's resource domain, but the individual sound files used by the sound events don't, they need to be specified manually.

 

Replace special/levelup with dynamicswordskills:special/levelup in your sounds.json file.

Edited by Choonster
Fixed sound file path
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Just now, coolAlias said:

Thanks!

 

I do find it a little odd that the modid needs to be specified in the sounds.json file now - are there any cases where one would want to specify something else? Because you can always fetch sounds from Minecraft or other mods using the registry.

 

It's possible that you'd want to create a sound event that consists of a combination of vanilla files not present in any existing sound event.

 

For example, a sound event consisting of minecraft:block/chorus_flower/grow1, minecraft:dig/cloth1 and youmod:foo/bar. There's no existing sound event with this combination of sound files.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.