mojira.dev
MC-267799

"/execute if function" cannot be run without further subcommands

Normally, any "execute if" statement can be run on its own as a test which returns a result value. For example:

/execute if dimension minecraft:overworld

This is a valid command on its own and doesn't require any further arguments - the command simply returns 1 if run from the overworld and 0 otherwise. All other forms of "execute if ___" follow this same format, except "execute if function". Trying to run execute if function on its own gives an error message, and it only works if you add further subcommands.

Linked issues

Comments 4

Could you please provide a use-case where this is useful and cannot be solved in another way in the context of commands

"/execute if function" is different because it fails when the function returns 0. Not sure if it is intended but it's useful.
If this bug would be fixed, "/execute store success ... if function ..." can be used to store 1 only if a non-zero value is returned, and store 0 if a failure or a successful 0 value is returned.

This is a feature request. Please leave feedback on feedback.minecraft.net

Conure512

(Unassigned)

Confirmed

Commands

1.20.4, 23w51b

Retrieved