Jump to content

Recommended Posts

Posted

Use one of the World#playSoundXXX methods and insert a valid sound file name (open Minecraft's 'sounds.json' file to find valid sound names).

 

An example from inside an Entity sub-class that plays the xp orb sound:

worldObj.playSoundAtEntity(
this, // the entity at which to play the sound
"random.orb", // sound file name from sounds.json
1.0F, // volume (randomize if you want)
0.5F * ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.8F) // pitch that has lots some randomness
);

Posted

Apparently it can't play the sound as it is unkown... I used this:

 

worldObj.playSoundAtEntity(this, "random.eat1", 1.0F, 0.5F * ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.8F));

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.