mojira.dev
MC-44517

@e target selector not working with some commands

@e target selector does not work with some commands I think would make sense to be possible. This includes /give and /clear, and I will use those as examples. There are other commands which could benefit from @e, although I will need to look up the format to test them.

What I expected to happen was...:
When using /give and /clear with an entity target selector (@e), I would be able to respectively give the entity an item and clear the entities inventory or specific items.

What actually happened was...:
For each entity, you receive the message "The player cannot be found," meaning that the commands do not support entities. This is a lack of control which @e would benefit to include.

Steps to Reproduce:
1. Have commands enabled and be within 5 blocks of a zombie, then copy and paste either of these commands into chat:

/give @e[type=Zombie,r=5,c=-1] minecraft:stone_sword

/clear @e[type=Zombie,r=5,c=-1] minecraft:stone_sword 0 0

2. Instead of the zombie respectively being given a stone block or returning if it has a stone block, you will receive the message: That player cannot be found

Comments 12

Actually, there are two problems with your commands that are unrelated to the @e selector : the first one is because the player selector designs who gets to hear the sounds, not the actual position of the sound.
The second ones comes from another unrelated bug : MC-44545

Ah... Okay, So spreadplayers work and your explanation of playsound... I forgot about that... So what about /clear, /enchant, and /give? Any word on those?

Updated the description to discuss correct commands which don't work.

Mobs don't actually have inventories, even though some of them can hold items and wear armor.

Although they still act as slots in a way, so it'd be a way to pass them armor. You could just make sure they have pickup set to true and summon items on them, but then there's the chance of players picking them up, as well as forcing mobs to be artificially spawned.

2 more comments

I have another example for consideration:

/kill @e[rm=1]

If you use this more than a few times, you can start to get lots of Entity Cannot be Found warnings.

Is this still a concern in the current Minecraft version 14w21b / Launcher version 1.4.4 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Confirmed for 14w21b.

Maybe entities are not yet supported by these commands.

Examples:
Usage: /give <player> <item> [amount] [data] {dataTag]
Usage: /clear [player] [item] [data] [maxCount] [dataTag]

The cannot find player error probably occurs because it expects a player name to be used, not entity names/ the @e selector.

A possible work around would be the use of the replace item command, though this command may not have been added when this issue was reported.
Tested in 1.8.3

The clear and give command don't work in the 1.11 snapshots, too!

megascience

michael

Unconfirmed

/clear, /enchant, /give, command, entity, selector

Minecraft 14w02b, Minecraft 14w02c, Minecraft 14w03b, Minecraft 14w04a, Minecraft 14w04b, ..., Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w10b, Minecraft 14w10c, Minecraft 14w21b

Retrieved