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

Mob spawners can create fake entities client-side for certain mobs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.2, Minecraft 18w11a, Minecraft 1.13.1
    • Confirmed
    • (Unassigned)

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The bug

      Mobs spawner create fake entities client-side if the mob to spawn overrides the method net.minecraft.entity.EntityLiving.onInitialSpawn(DifficultyInstance, IEntityLivingData) to spawn additional entites.

      How to reproduce

      1. Place a spawner spawning zombies
        /setblock ~ ~ ~ spawner{SpawnData:{id:"zombie"}}
        
      2. Place a repeating command block modifying the NBT data of the spawner
        /data merge block ~ ~-1 ~ {NonExistentTag:1b}
        
      3. Go to 0, 0, 0
        /tp 0 0 0
        

        → You will see multiple chicken jockeys

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The method net.minecraft.tileentity.MobSpawnerBaseLogic.getCachedEntity() calls the method net.minecraft.entity.EntityLiving.onInitialSpawn(DifficultyInstance, IEntityLivingData) when it creates the cached entity which is supposed to be rendered. The problem is that the onInitialSpawn method might spawn additional entities. Additionally this method displays variations of the mob which are not actually spawned because the call happens independently from the server and therefor the server might spawn other variations or multiple variations during one spawning cycle if the SpawnCount is higher than 1.

      The expected behavior would be that the client does not call this method.

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: