The bug
When a command affects multiple entities, it's often the case that the command fails for some entities and succeeds for others. For example, adding a tag to some entities that already have it and others that don't. The command result
usually reflects how many entities were successfully affected, but the command feedback message often includes all entities, even unaffected ones.
Affected commands
Each of these commands behaves similarly:
result
is the number of affected entities.If none were affected, an error is shown.
❌ If any were affected, the success message includes the total number of entities found by the selector, not just the affected ones.
❌ The "single success" message only appears if the selector only found one entity; it does not appear when it found multiple but only one was affected.
Command | An entity is unaffected if... |
---|---|
| It has too many tags, or already has the tag |
| It doesn't have the tag |
| The trigger is already enabled for that player |
| The player already knows the recipe |
| The player doesn't know the recipe |
| The player is "too far away" |
| It's not a mob/player |
| It's not a mob/player |
| It's not a mob/player |
| It's not a mob/player |
| No matching items were found |
| The player already has the advancement |
| The player doesn't have the advancement |
| The player already has the criterion |
| The player doesn't have the criterion |
/advancement
poses a unique challenge. The result
is simply the number of changes applied to any player, meaning the many-to-many scenario currently does not know (A) how many advancements found were changed on at least one player, and (B) how many players found had at least one advancement changed. Those are the two numbers that should in theory appear in the feedback message.
/recipe
and /clear
also currently only keep track of a running total for their result
. They need to also keep track of how many players were affected to appear in the feedback message.
For all other commands, simply substituting the existing result
into the feedback message would resolve the issue.
How to reproduce
/tag @e[sort=nearest,limit=5] add test
/tag @e[sort=nearest,limit=6] add test
Expected result
Added tag 'test' to 5 entities
Added tag 'test' to (some specific entity)
Observed result
Added tag 'test' to 5 entities
Added tag 'test' to 6 entities
Confirmed for 1.13-pre2