Posted July 31, 201411 yr Hi there! I finally able to set up a moving sound effect that follows the player and stops when i want it. But it can be only heard by the player who created the sound. How can i make my sound for others to hear it? Sounds are played in a CLIENT tick handler right now. Thanks!
July 31, 201411 yr If you can, play the sound on the server directly via worldObj.playSoundAtEntity or worldObj.playSoundEffect (both of which will automatically play the sound for nearby clients, though I haven't looked into the exact mechanics going on under the hood); otherwise, you need to send your sound in a packet to the server and from there re-broadcast the packet to nearby players. http://i.imgur.com/NdrFdld.png[/img]
July 31, 201411 yr Author I can't use them because they play the sound at a given pos. My sounds follows the player. I have looked up how minecart does it but i cant find the method where its playing its sounds.
July 31, 201411 yr Author The sounds plays from the player when he holds down the right mouse button if an item is held. I want to use onUpdate() but i cant play client sounds on it what is understandable. I don't want to play the sound every time and my sounds its already working based on the MovingSoundsMinecart. Except the sound is connected to the player. I playing my sounds with Minecraft.getMinecraft().getSoundHandler.playSound(sound) tight now client side. I can't realy know other ways to do it, but others cant hear the sounds. With pakets it can cause lag? I it nessecaryt to use them? Thanks.
July 31, 201411 yr Author Everything is based on the MovingSoundMinecart except i changed TileEntity to EntityPlayer. Here is my code so you can understand it: http://pastebin.com/Paxp1jfz Its not a problem, this is how i want it to work. The problem is others can't hear that sounds. I playing sounds like so: ISound start = new PatronusSoundEvent("patronus:PatronusStart", mc.thePlayer, 1.0F, 1.0F); Minecraft.getMinecraft().getSoundHandler().playSound(start);
August 1, 201411 yr Author I just left it there by accident. The packet sending did the trick so thank you diesieben.
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.