Jump to content

Custom sounds added by separate texture pack kicking from server [1.19.2][SOLVED]


RInventor7

Recommended Posts

Hi! My mod contains some custom sounds, that work perfectly fine, because they’re properly registered. I have a custom block entity. On right click it open a screen with textbox where you can type in a name (e.g. snd1). The player/mod user has a custom texture pack containing the sound file named snd1 and a proper sounds.json containing an entry for snd1. A custom entity should now in some situations play the custom sound which name has been entered by player.  At the moment the code I use for an entity to play the sound looks like this: (the filename it gets from the block entity)

ResourceLocation resource1 = new ResourceLocation(MyMod.MOD_ID + ":" + filename);
SoundEvent se1 = new SoundEvent(resource1);
entity.playSound(se1, 1.0f, 1.0f);

It works fine in singleplayer. As soon as I test it on server it kicks the player when it tries to play the sound and gives the following error: 

java.lang.IllegalArgumentException: Can't find id for 'net.minecraft.sounds.SoundEvent@937bd60' in map Registry[ResourceKey[minecraft:root / minecraft:sound_event] (Experimental)]

See full debug log.

Registering the sounds with DeferredRegister during RegistryEvent is not possible because I do not know how many sounds will the player have and what their names would be.

 

What can I do to get it working on the server? Is it even possible? Thanks in advance.

Edited by RInventor7
Solved
Link to comment
Share on other sites

51 minutes ago, RInventor7 said:

What can I do to get it working on the server? Is it even possible? Thanks in advance.

I mean, if the sound isn't in the mod itself, you can't expect anyone else to be able to hear it. You would need to register a sound event for it. You could work your way around it in numerous different capacities, but they would require the player to download the sound through another client, which is a security issue and will not be supported here. The best we can provide guidance on is only have it play for the specific client.

Link to comment
Share on other sites

  • 2 weeks later...
  • RInventor7 changed the title to Custom sounds added by separate texture pack kicking from server [1.19.2][SOLVED]

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.