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

EnderDragonPart Entity ID Desync

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Unconfirmed
    • Networking

      Description
      There is a synchronization issue with the EnderDragonPart entity IDs between the server and client. Specifically, the ID of the entity parts on the client is one less than on the server. This discrepancy leads to desynchronization when hitting the dragon, causing the server to register a hit on a different part of the Ender Dragon than the client perceives.

       How to reproduce
      1. Freeze the game /tick freeze
      2. Summon an ender dragon /summon minecraft:ender_dragon
      3. Step two ticks /tick step 2
      4. Disable the ender dragon ai /data merge entity @n[type=minecraft:ender_dragon] {NoAI:1b}
      5. Unfreeze the game /tick unfreeze

      Observe how hitting the neck with a netherite sword increases the damage, while hitting every other part of the dragon does not.
      Observe how hitting certain parts of the dragon are not registered on the server side.
      Adding a debug statement in the hurt function of the EnderDragonPart reveals that the server and client disagree on which part was hit.

      Expected behaviour
      As the code indicates, only hitting the head should increase damage.
      All hits should be registered on the server side.
      The server and client should not disagree on which part was hit.

       
      Technical Details
      The issue lies within the recreateFromPacket function in the EnderDragon class. In this function, the first dragon part in the subEntities list gets assigned the same ID as the dragon itself, instead of being assigned the ID of the dragon plus one. Similarly, all subsequent part IDs are off by one on the client side as well.

            Unassigned Unassigned
            Tomate0613 Tomate0613
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: