Topic category: Help with Minecraft modding (Java Edition)
I would like some help on how to make the game play certain music or sound based on the (y level) and the (duration) of the sound.
I used block.amethyst_block.place and block.anvil.place as a test on different y level, but when I go to the y level I set it to, every entity is spamming the same sound on that level. My game lags a lot from too much sounds.
I also want to create multiple sections on what music/sound it plays. Music only above 0 - 49, and 50 - 256+
(Its not letting me upload a picture so here you go in character form)
(start trigger) On loaded entity tick update
(flow control) If [(Y position of (Event/target entity)) > {50}]
do [Play at x: {x} y: {y} z: {z} level: {1} category: (master) sound: (block.amethyst_block.place)]
(flow control) If [(Y position of (Event/target entity)) > {0}]
do [Play at x: {x} y: {y} z: {z} level: {1} category: (master) sound: {block.anvil.place}]
I got an idea for this
make a logic player lifetime variable called 'SoundOn' with an initial value of false
then on player tick update
if get Y level of event target entity > 50 AND get global:'SoundOn' = false
do play at x y z sound
set Global:'SoundOn' to true
wait <Number of seconds sound lasts>
do set Global:'SoundOn' to false
@RexCerv ty!