-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 17w48a, Minecraft 17w49a, Minecraft 17w49b, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w06a, Minecraft 18w08b, Minecraft 18w11a, Minecraft 18w16a, Minecraft 18w19b, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre5, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w44a, Minecraft 19w02a, Minecraft 19w08a, Minecraft 19w11b, Minecraft 1.14.3, 1.14.4, 19w40a, 19w46b, 20w07a, 20w17a, 1.18.2, 1.19.2, 22w42a, 1.20.6, 24w18a, 24w40a
-
Confirmed
-
Commands
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... |
---|---|
/tag ... add | It has too many tags, or already has the tag |
/tag ... remove | It doesn't have the tag |
/scoreboard players enable | The trigger is already enabled for that player |
/recipe give | The player already knows the recipe |
/recipe take | The player doesn't know the recipe |
/playsound | The player is "too far away" |
/enchant | It's not a mob/player It's not holding anything It's holding an incompatible item It's holding an item with incompatible enchantments |
/effect give | It's not a mob/player It's immune to the effect It has a stronger effect already |
/effect clear ... | It's not a mob/player It doesn't have the effect |
/effect clear | It's not a mob/player It doesn't have any effects |
/clear ... | No matching items were found |
/advancement grant | The player already has the advancement |
/advancement revoke | The player doesn't have the advancement |
/advancement grant ... only ... | The player already has the criterion |
/advancement revoke ... only ... | 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
- is duplicated by
-
MC-121735 Using /tag add or remove if some entities already have the tag shows that it was successful for all
- Resolved
-
MC-124979 /enchant feedback text is inaccurate if not all entities could receive the enchantment
- Resolved
-
MC-131048 Command '/tag @e remove tagname' says it removed tag from all entities, and not just the ones with the tag
- Resolved
-
MC-155058 /tag in functions broken
- Resolved
-
MC-271517 Entities immune to some/all effects show as being affected when using @e
- Resolved
-
MC-277394 Tag remove command returned incorrect count when do not use the target selector variable
- Resolved
- relates to
-
MC-123068 The number of advancements said to be revoked from the player are incorrect
- Open
-
MC-125061 Feedback text for successful "/recipe take *" doesn't account for locked recipes
- Open