-
Bug
-
Resolution: Fixed
-
23w41a
-
None
-
Confirmed
-
Commands
-
Very Important
-
Platform
The bug
maxCommandChainLength and maxCommandForkCount are only obtained and copied when commands are executed at the top level, which creates a new execution context. Changes in these gamerules usually do not affect execution under that execution context.
However, because functions executed as advancement rewards are also executed at the top level, you can execute a function under another execution context with possibly modified maxCommandChainLength and maxCommandForkCount. Considering MC-143266, this behavior may be unintentional.
How to reproduce
/function mc-265773:test_4
→ Both 1 and 2 are printed
/function mc-265773:test_3
→ Only 1 is printed
/function mc-265773:test_4
→ Both 1 and 2 are printed
These results imply that maxCommandChainLength modified in a function affects the execution of a function executed as a advancement reward.
data/mc-265773/advancements/a.json
{ "criteria": { "": { "trigger": "impossible" } }, "rewards": { "function": "mc-265773:a" } }
data/mc-265773/functions/a.mcfunction
advancement revoke @s only mc-265773:a say 1 say 2
data/mc-265773/functions/test_3.mcfunction
gamerule maxCommandChainLength 3 advancement grant @s only mc-265773:a
data/mc-265773/functions/test_4.mcfunction
gamerule maxCommandChainLength 4 advancement grant @s only mc-265773:a