Mojira Archive
MC-108495

Non-LivingBase entities can be on a team (and show color) but can't be targeted using team=

The bug

If you add a dropped item (or any Non-LivingBase entities) to a team, it follows the color team rule fine. The problem is, you can't target it with team=

Note

[Mojang] Searge (Michael Stoyke) added a comment - 10/Aug/14 12:17 AM
Only living entities can be on a team, items are not living entities, only mobs, animals, villagers and players are.

This is not correct, as it has the color, it is on the team, so it can be added fine. The only problem is that it can't be targeted via team=

How to reproduce

  1. /team add Test
  2. /team modify Test color red
  3. drop an item and run
    /data merge entity @e[type=item,sort=nearest,limit=1] {CustomName:"{\"text\":\"Test\"}",CustomNameVisible:1b}
  4. /team join Test @e[type=item,sort=nearest,limit=1]
  5. see the red name, indicating it's on the team
  6. /say @e[type=item,team=Test]
    The command will not say "Test"

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The method net.minecraft.command.EntitySelector.getTeamPredicates(...).new Predicate() {...}.apply(Entity) returns false if the entity is not an instance of EntityLivingBase even though the method net.minecraft.entity.Entity.getTeam() is correctly implemented for all entities.