mojira.dev
MC-260576

Incomplete 'execute summon' command still runs

Trying to execute summon with (partial) subcommands (those that follow syntax but do not have all the required parameters) often works in ways you don't expect it to.

Try to run:

/execute at @e summon tnt

Nothing happens.

Now try to run:

/execute at @e summon tnt at

or

/execute at @e summon tnt as

or any other subcommand.

Even though the command isn't completed (run ...) the command still succeeds and summons the entity. At the very least you'd expect the sub command to end in

execute ... if ...

for example. This would be valid since you expect if/unless to work as a test. Also execute store should work. However, for summon, it would not make sense to end the command with a partial sub command.

Expected to work

/execute at @e summon tnt

(currently doesn't work. Should spawn once)

/execute at @e summon tnt summon tnt

(currently only spawns once, but should spawn twice.)

Attachments

Comments 7

Did you forget to write "run" in the command in the description?

Dhranios, the description is correct.

It may be working as intented to summon entities without the run subcommand.
“/execute at @e summon tnt” doing not work is due to Brigadier. In CommandDispatcher::execute(ParseResult<S>), the redirect modifier is applied only if the context has a child. This was reasonable before /execute summon is added. But now it needs to be changed: the redirect modifier should be applied whether or not there is a child.

But incomplete subcommands (e.g /execute summon tnt at) being valid is caused by MC-256419 or MC-165773

i ran this in 1.19.4 -pre 1:
/execute at @p summon sheep summon sheep
and it summoned two sheep, unlike what your last line suggests,
perhaps i misunderstood what "expected to work" means

paulo khayat, are you sure you ran the command you said instead of “/execute at @p summon sheep run summon sheep”? I tested in 1.19.4-pre1, and I'm sure that the command you said summons only one sheep.

The commands in "Expected to work" are not working on my end. It works by adding "run" subcommand as you can see in attached video "Execute_tnt_Bug.mp4". Is this the correct behavior?
Retested on:
Version: Release 1.20.3 
Platform: Win 11

Incomplete command parsing now throws errors more accurately. Since the commands are incomplete ("/execute summon <id>" without anything else is not valid), the command doesn't run.
Incomplete commands not doing anything is not a bug. What was fixed was the inconsistent result from incomplete commands with /execute summon.

AgentM

boq

Confirmed

Platform

Normal

Commands

brigadier, execute, summon

1.19.4 Pre-release 1, 1.19.4, 23w14a

23w41a

Retrieved