Posted February 18, 20232 yr 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 February 26, 20232 yr by RInventor7 Solved
February 18, 20232 yr 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.
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.