mojira.dev
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

@unknown 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.

Linked issues

Attachments

Comments 10

Asteraoth

Confirmed for 18w30b

Francielly

Confirmed for 1.16.1 and 20w30a

Avoma

Can confirm in 20w49a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

ligmads

still exists in 1.20.

Squid Eevee

can confirm in 24w07a.

Nuclearinferno

I feel like this should have a higher priority since it is inconsistent with other team related behaviour, confuses new datapack developers, limits datapack capabilities unnessesarily and seems not to hard to fix (people have already proposed solutions).

Octember

Can confirm in 1.21 Pre-release 2.

user-f2760

Misode

gegy

Confirmed

Platform

Low

Commands

entity, scoreboard-teams, selector, team

Minecraft 1.10.2, Minecraft 16w40a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11.2, Minecraft 1.12, ..., 23w43b, 1.20.3, 1.20.4, 24w07a, 24w10a

25w05a

Retrieved