Jump to content

Recommended Posts

Posted (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 by IvanSteklow
Solved
  • Like 1
Posted

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.

  • Like 1
Posted
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?

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.