Skip to content

playsound

Daedalus1400 edited this page May 18, 2017 · 2 revisions

Description:

The playsound action plays a sound for the player. The sound is played client side only.

Added in release version 0.3.0

Arguments:

type

Must be "playsound".

sound

Accepts a string. Valid values are the name of any sound event registered in Minecraft. Vanilla sound names can be found on the official wiki page. For non-vanilla sounds, the string must match the string returned by

soundevent.getRegistryName().getResourcePath()

where "soundevent" is the SoundEvent object registered by the mod during initialization.
Note that SoundEvents may have multiple sound files associated with them. It is not possible to select which sound file is played from a SoundEvent.

category

Accepts a string. Indicates which volume slider in the menu affects this sound. Valid values are:

  1. ambient
  2. blocks
  3. hostile
  4. master
  5. music
  6. player
  7. record
  8. voice
  9. weather

Default value is "ambient".

volume

Accepts a number. Default is 1.

pitch

Accepts a number. Default is 1.

chance

Accepts a number. Default value is 1.

Example Usage:

The following example will play the ambient cave noises to the player:

{"type": "playsound", "sound": "ambient.cave"}

Clone this wiki locally