-
Notifications
You must be signed in to change notification settings - Fork 0
Sound
Omar Mohamed edited this page Mar 24, 2026
·
2 revisions
Represents a sound with a namespaced ID, volume, pitch, and optional world position.
Creates a new Sound object.
-
Parameters:
-
soundId—String— Namespaced sound ID (e.g."minecraft:entity.player.levelup") -
volume—Double -
pitch—Double -
position—Position
-
make pos new Position(0, 64, 0)
make snd new Sound("minecraft:block.note_block.harp", 1.0, 1.0, pos)
player.playSound(snd)Returns the namespaced sound ID.
-
Returns:
String
Returns the volume of the sound.
-
Returns:
Double
Returns the pitch of the sound.
-
Returns:
Double
Returns the world position this sound is associated with.
-
Returns:
Position
Sets the namespaced sound ID.
-
Parameters:
-
soundId—String
-
Sets the volume.
-
Parameters:
-
volume—Double
-
Sets the pitch.
-
Parameters:
-
pitch—Double
-
Sets the world position.
-
Parameters:
-
position—Position
-
make pos new Position(0, 64, 0)
make snd new Sound("minecraft:entity.player.levelup", 1.0, 1.0, pos)
~ Modify after creation
snd.setPitch(1.5)
snd.setVolume(0.5)
snd.setSoundId("minecraft:block.note_block.bell")
player.playSound(snd)Returns a string representation of this sound.
-
Returns:
String— e.g."Sound{name=minecraft:entity.player.levelup, volume=1.0, pitch=1.0, position=Position{x=0, y=64, z=0}}"
make pos new Position(0, 64, 0)
make snd new Sound("minecraft:ambient.cave", 0.8, 1.0, pos)
say snd.toString()GET IN TOUCH - omar@merakistudios.dev
© 2026 Omar Mohamed. All Rights Reserved.