IvanSteklow Posted July 10, 2017 Posted July 10, 2017 (edited) 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, 2017 by IvanSteklow Solved 1 Quote
V0idWa1k3r Posted July 10, 2017 Posted July 10, 2017 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. 1 Quote
IvanSteklow Posted July 10, 2017 Author Posted July 10, 2017 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? 1 Quote
V0idWa1k3r Posted July 10, 2017 Posted July 10, 2017 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). Quote
IvanSteklow Posted July 10, 2017 Author Posted July 10, 2017 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! 1 Quote
Recommended Posts
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.