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

Team NBT tag adds entity to team even if it was not spawned in the world

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.9.4, Minecraft 17w06a, Minecraft 1.12.2, Minecraft 18w11a, Minecraft 1.13.1
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.

      How to reproduce

      1. Create a scoreboard team
        /team add testTeam
        
      2. Set the time to day
        /time set day
        
      3. Place a spawner which would spawn a mob and add it to a team
        /setblock ~ ~ ~ mob_spawner{SpawnData:{id:"zombie",Team:"testTeam"}}
        
      4. Look at the team size
        /team list testTeam
        

        → You should see that the number of entities in the team is greater than 0 even though no entity was spawned

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              draconicus draconicus
            • Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: