As the title says, Function command returns wrong number of commands executed for embedded functions.
As far as I see, this wrong number of command is considered by the maxCommandChainLength game rule.
A data pack to replicate this issue is available in the attachment section here. (dp.zip)
Example: Given two functions:
liach:output
function liach:output/do
liach:output/do
say Expected to have 2 commands ran in the function liach:output
Execution result of liach:output (Looks wrong)
[liach] Expected to have 2 commands ran in the function liach:output
Executed 3 commands from function 'liach:output'
Execution result of liach:output/do (Looks right)
[liach] Expected to have 2 commands ran in the function liach:output
Executed 1 commands from function 'liach:output/do'
What I expect for execution result of liach:output
[liach] Expected to have 2 commands ran in the function liach:output
Executed 2 commands from function 'liach:output'
The data pack containing these 2 functions is attached below (note that there is a few unrelated functions for testing other bugs)
I am working on a solution that fixes this bug, MC-143266, MC-143269, and MC-126946 at the same time. Will update when I get progress.
Attachments
Comments 4
In fact, this should have affected all minecraft versions in which function is present (i.e. all versions above minecraft 1.12)
This feature was removed in 23w41a.
That means
function
command will no longer return (or even display) number of commands run during execution
Fixes have been found and are packed in a mod I wrote.
https://github.com/liachmodded/MC-126946-128565/tree/2cbe0650ebe385027e484e7496fc63ebba690cad
Edit: This fix is not comprehensive; a better one needs some modification to brigadier.
Edit2: I confused the issue; the "incomprehensive fix" refers to that for embedded functions returning 0 as command result. (functions return 0 when called in another function)