Function not fully running from advancement reward, but runs normally when using `/function`
Hello!
For my modpack, I need to run some commands on world creation. I made an advancement with the
Continue to help postminecraft:tick
trigger, which runs my function. And for all I can tell, it runs the function partially (?)
Here is the function:
# Prevent the function from running on rejoin # TODO does this actually work? say "Executing function init..." execute if data storage minecraft:world created run return 1 data modify storage minecraft:world created set value 1 say "Executing function init (for real this time)..." # Place initial cube say "Placing blocks..." fill -10 -1 -10 10 20 10 minecraft:bedrock fill -3 0 -3 3 6 3 minecraft:air setblock 0 0 0 minecraft:torch say "Placed blocks!" # Give initial items say "Giving items..." clear @a give @a minecraft:dirt give @a minecraft:oak_sapling give @a supplementaries:flax_seeds say "Gave items!" # Teleport player into the cube say "Teleporting player..." tp @a 0 0 0 setworldspawn 0 0 0 spawnpoint @a 0 0 0 say "Teleported player!"
Now what happens is that no blocks get placed, but I am given the starter items and am teleported to 0/0/0, ending up with me falling into the void (I use a void world preset). Curiously, when I use /function
to run that exact same function, the blocks are placed as expected. I tried some things, including the say
commands to verify it's actually running, and commenting out everything that isn't the fill
and setblock
commands, to no avail.