Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.