I have attached my data- and resource packs. A tellraw, which has the same requirements, seems to work. I have tried various variations of the commands to no avail. The main snippets are:
execute as @e[type=minecraft:cushion] if data entity @s data.whoopie_cushion if entity @s[tag=!whoopie_played] on passengers on vehicle run function whoopie-cushions:play_soundtag @s add whoopie_played
playsound whoopie-cushions:block.whoopie-cushion.whoop block @a ~ ~ ~ 1 1
tellraw @a testThis runs the tellraw, but does not play the sound. When running
/execute as @e[type=minecraft:cushion] if data entity @s data.whoopie_cushion on passengers on vehicle run function whoopie-cushions:play_soundit works though. This means when running through the tick function, it runs the function but the playsound does not play, whilst when it is run as a command it runs the function and the playsound plays. That means the function works on it’s own, and run’s on it’s own, and since I used “execute as …” it also means it is not a context problem. Therefore, it must be a bug!
Attachments
Comments 3
The sound is probably too far away to be heard. execute as <entity> doesn’t change the position that the command is executed from, so the sound will still play from the world origin even though the cushion is making the sound. Try execute as @e[type=cushion] at @s ...
Thank you for helping us improve Minecraft! We saved your files: