I have a function triggered by an advancement that is supposed to give the player nausea and strength. It looks like this:
tellraw @s [{"text":"[","color":"dark_aqua"},{"selector":"@s","color":"dark_aqua"},{"text":"] ","color":"dark_aqua"},{"text":"I feel ill...","color":"aqua"}]
effect give @s minecraft:nausea 30 3 true
effect give @s minecraft:strength 30 1 true
advancement revoke @s only dark_magic:hidden/drink_blood
This is triggered by the player drinking a retextured milk bucket (a blood-filled bucket), which works fine. The advancement which triggers the function is very simple and looks like this:
{
"criteria": {
"drink_blood": {
"trigger": "minecraft:consume_item",
"conditions": {
"item": {
"item": "minecraft:milk_bucket",
"nbt": "{BloodBucket:1b,CustomModelData:1}"
}
}
}
},
"rewards": {
"function": "dark_magic:progression/story_dialogue/i_feel_ill"
}
}
When I drink a milk bucket with the custom NBT tag BloodBucket:1b
, it works: the /tellraw
triggers, and the advancement is revoked, reseting everything so I can drink it again and it will still work. However, the /effect
commands don't work. I can run the function manually from the chat, as in /function dark_magic:progression/story_dialogue/i_feel_ill
, and the effects work fine, but when run by the advancement, they don't work at all.
Does anyone know why this is? Moreover, does anyone know how to get around this? I know I could tag the player as drank_blood
or something and /schedule
a function for 1 tick later which executes the effects as all players tagged with drank_blood
and removes the tag, but that seems unnecessarily complicated for something as simple as giving an effect.
Am I doing something wrong with a selector or missing something simple, or is this just not possible and I'll need to do the /schedule
method?
/schedule
wouldn't even help you, because it ignores all context: bugs.mojang.com/browse/MC-154325 What happens if you execute the function manually?/tellraw
and/advancement
commands work, but the/effect
ones don't. I knew that/schedule
ignored any/execute
instructions, but I didn't know that was unintended. I hope it gets fixed because it's pretty annoying. That is what the tag is for: to give context so it could be executed by the server and still work.