Posted January 3, 20187 yr So basically if you're on a server the sound doesn't work and the client gives you this error: [main/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1161) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] 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:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:45) ~[PositionedSoundRecord.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40) ~[PositionedSoundRecord.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:509) ~[WorldClient.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:497) ~[WorldClient.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleSoundEffect(NetHandlerPlayClient.java:1828) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:78) ~[SPacketSoundEffect.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:13) ~[SPacketSoundEffect.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 15 more [17:48:46] [main/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1161) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] 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:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:45) ~[PositionedSoundRecord.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40) ~[PositionedSoundRecord.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:509) ~[WorldClient.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:497) ~[WorldClient.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleSoundEffect(NetHandlerPlayClient.java:1828) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:78) ~[SPacketSoundEffect.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:13) ~[SPacketSoundEffect.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 15 more [17:48:46] [main/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1161) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] 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:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:45) ~[PositionedSoundRecord.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40) ~[PositionedSoundRecord.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:509) ~[WorldClient.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:497) ~[WorldClient.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleSoundEffect(NetHandlerPlayClient.java:1828) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:78) ~[SPacketSoundEffect.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:13) ~[SPacketSoundEffect.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 15 more [17:48:47] [main/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1161) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] 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:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:45) ~[PositionedSoundRecord.class:?] at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40) ~[PositionedSoundRecord.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:509) ~[WorldClient.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:497) ~[WorldClient.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleSoundEffect(NetHandlerPlayClient.java:1828) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:78) ~[SPacketSoundEffect.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:13) ~[SPacketSoundEffect.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 15 more The server gives no errors whatsoever and my code is not referenced in the stacktrace. Any ideas? This is my sound code on my mob: @Override protected SoundEvent getAmbientSound() { return SoundRegistry.grump; } grump being a regular SoundEvent. EDIT: PositionedSoundRecord contains this as line 43-46: 43 private PositionedSoundRecord(SoundEvent soundIn, SoundCategory categoryIn, float volumeIn, float pitchIn, boolean repeatIn, int repeatDelayIn, ISound.AttenuationType attenuationTypeIn, float xIn, float yIn, float zIn) 44 { 45 this(soundIn.getSoundName(), categoryIn, volumeIn, pitchIn, repeatIn, repeatDelayIn, attenuationTypeIn, xIn, yIn, zIn); 46 } Line 40 is a constructor pointing to this one. From my understand one of the constructing values are null creating this error. I just cannot understand this. Sound should work normally!!! This is a sound in my sounds.json(pointed to by the SoundEvent via ResourceLocation, but I know that works, don't worry about it) "grump": { "replace": false, "category": "entity", "sounds": [ "derpcats:grump" ] }, Edited January 4, 20187 yr by hiotewdew All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 4, 20187 yr Some of the vanilla sound methods run on the server and send packets to all listeners (players). Other methods act like renderers, only existing or running on the client, often downstream from the packet handlers. Unfortunately, much of the naming is similar, so Minecraft's sound system is confusing. IIRC, PositionedSound is client-side only. You need to analyze these classes and then organize your code so that you make decisions on the server that cause sounds to be rendered on the client. In many cases, you do not need to design your own packets and handlers; vanilla will handle that for you. I recommend setting some breakpoints and then stepping through the process for some vanilla sound in debug mode. That'll show you in a hurry what calls what where. You should also read about sound in the Forge docs. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
January 4, 20187 yr Author 3 hours ago, jeffryfisher said: Some of the vanilla sound methods run on the server and send packets to all listeners (players). Other methods act like renderers, only existing or running on the client, often downstream from the packet handlers. Unfortunately, much of the naming is similar, so Minecraft's sound system is confusing. IIRC, PositionedSound is client-side only. You need to analyze these classes and then organize your code so that you make decisions on the server that cause sounds to be rendered on the client. In many cases, you do not need to design your own packets and handlers; vanilla will handle that for you. I recommend setting some breakpoints and then stepping through the process for some vanilla sound in debug mode. That'll show you in a hurry what calls what where. You should also read about sound in the Forge docs. I feel like there's a different problem because I am NOT calling any functions to play sounds except in some cases, but in the cases that I don't, there is literally no time I call getAmbientSound(). This is all vanilla handling it. I have a mob with functioning sound, a villager, using default villager sounds. Yet my other mobs all extend a base class, which extends EntityAnimal, which is exactly what I have my villager extending. It makes no sense. The SoundEvents seem to be correct. I read the Forge docs several times already and nothing there has worked. All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 6, 20187 yr I think that positioned sound is a client-side only class. Have you stepped through these things in the debugger? Actually walking the processes will clarify the client-server architecture for you. Even if I could remember every detail, I couldn't write in words what an execution walk-through can show you. Please step through these processes in the debugger. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.