Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-108495

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.10.2, Minecraft 16w40a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.2, Minecraft 17w46a, Minecraft 18w02a, Minecraft 18w19b, Minecraft 1.13, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w43b, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 19w04b, Minecraft 19w07a, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14.3, 1.15.2, 20w08a, 20w12a, 1.16, 1.16.1, 20w30a, 1.16.2, 1.16.4, 20w49a, 21w03a, 21w05a, 21w05b, 21w06a, 1.17, 1.17.1, 1.18.1, 1.19.1, 1.19.2, 1.19.3, 1.19.4 Pre-release 1, 1.19.4, 23w17a, 1.20.1, 1.20.2, 23w43b, 1.20.3, 1.20.4, 24w07a, 24w10a
    • Confirmed
    • Commands
    • Low
    • Platform

      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

      searge 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.

            gegy1000 [Mojang] Gegy
            Misoloo [Helper] Misode
            Votes:
            34 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              CHK: