mojira.dev
MC-309873

/playsound not working in data pack but does work when written out

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_sound
tag @s add whoopie_played
playsound whoopie-cushions:block.whoopie-cushion.whoop block @a ~ ~ ~ 1 1
tellraw @a test

This 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_sound

it 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

Thank you for helping us improve Minecraft! We saved your files:

[media]

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 ...

whoops, you’re right

Sammy Hamdani

(Unassigned)

Unconfirmed

26.3 Snapshot 3

Retrieved