Posted July 10, 20178 yr Hi everyone, I want to play default minecraft sound: world.playSound(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, "liquid.splash", SoundCategory.AMBIENT, 1.0f, 1.0f, true); But it doesn't work. I don't know how to play it HELP ME PLS Edited July 10, 20178 yr by IvanSteklow Solved
July 10, 20178 yr World::playSound takes a SoundEvent as it's 4th parameter, not a string. Vanilla SoundEvents can be found at net.minecraft.init.SoundEvents. You should also use the overload that takes an EntityPlayer as it's first parameter as the method you are using will only work on the client. All that is explained in the docs here.
July 10, 20178 yr Author 8 minutes ago, V0idWa1k3r said: World::playSound takes a SoundEvent as it's 4th parameter, not a string. Vanilla SoundEvents can be found at net.minecraft.init.SoundEvents. You should also use the overload that takes an EntityPlayer as it's first parameter as the method you are using will only work on the client. All that is explained in the docs here. So, 'cause I have only to blockpos, how to get nearest player?
July 10, 20178 yr https://mcforge.readthedocs.io/en/latest/effects/sounds/#world-playsound-pxyzecvp. A player can be null on a server and then all the players nearby will hear it. And if your side is the client - there is only 1 player on the client(if that is the case you can also use the overload you were using originaly).
July 10, 20178 yr Author 48 minutes ago, V0idWa1k3r said: https://mcforge.readthedocs.io/en/latest/effects/sounds/#world-playsound-pxyzecvp. A player can be null on a server and then all the players nearby will hear it. And if your side is the client - there is only 1 player on the client(if that is the case you can also use the overload you were using originaly). So thanks!
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.