Posted February 9, 20196 yr I encountered a strange issue where 1 of 7 similarly programed custom Tamable mobs in my modification has none of its sounds play when on a Server. Instead you get the default mob sounds. When played on single player, the mob sounds play as expected. I checked the server and client logs when it starts up and I don’t see any messages indicating the files are not loading. Instead, I notice a strange null pointer exception message to sections of code I do not recognize. They appear any time I suspect the mob’s sound is supposed to play, seen below (Client log): [23:47:45] [main/FATAL] [net.minecraft.client.Minecraft]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?] at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1087) [bib.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(SourceFile:34) ~[cgp.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(SourceFile:30) ~[cgp.class:?] at net.minecraft.client.multiplayer.WorldClient.func_184134_a(WorldClient.java:468) ~[bsb.class:?] at net.minecraft.client.multiplayer.WorldClient.func_184148_a(WorldClient.java:456) ~[bsb.class:?] at net.minecraft.client.network.NetHandlerPlayClient.func_184327_a(NetHandlerPlayClient.java:1674) ~[brz.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.func_148833_a(SourceFile:89) ~[kq.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.func_148833_a(SourceFile:11) ~[kq.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?] ... 9 more Does anyone know what might be happening here in this null pointer exception?
February 9, 20196 yr Looking at the code for PositionedSoundRecord, I only see one spot where a NPE could even occur: private PositionedSoundRecord(SoundEvent soundIn, SoundCategory categoryIn, float volumeIn, float pitchIn, boolean repeatIn, int repeatDelayIn, ISound.AttenuationType attenuationTypeIn, float xIn, float yIn, float zIn) { this(soundIn.getSoundName(), categoryIn, volumeIn, pitchIn, repeatIn, repeatDelayIn, attenuationTypeIn, xIn, yIn, zIn); } ...at... soundIn.getSoundName() ...meaning soundIn is probably null. It looks like this constructor is being called by the one directly above it, which is called by one of the playSound() methods in the WorldClient class...etc... All in all, I'd say that the registration for your sound somehow doesn't match on the client vs the server in that situation. The packet uses an integer id to look for the sound in the sound registry, like so: this.sound = SoundEvent.REGISTRY.getObjectById(buf.readVarInt()); You should probably post the code or a link to it, particularly everything to do with how you register the sounds
February 9, 20196 yr Author Thanks! That gave me the direction I needed. And as I started copying over the code to share, I happened to find the issue. The SoundEvent variables for the mob sounds accidentally got replaced from the SoundEvent registry handler Set when I added a new mob to the modification. I did not realize that missing something like that there would not cause a complete failure of the sound playing. Again, thank you!
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.