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

Teleporting an entity from another dimension can cause UUID duplication in entity sections

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3, Minecraft 1.14.3 Pre-Release 4, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 1, Minecraft 1.14.4 Pre-Release 2, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, 1.15.2, 20w18a, 20w20b, 20w21a, 1.16 Pre-release 5, 1.16.1, 20w29a, 1.16.2 Pre-release 1, 1.16.2, 1.16.3, 1.16.4 Pre-release 1
    • Fix Version/s: 20w45a
    • Confirmation Status:
      Confirmed
    • Category:
      Entities

      Description

      The bug

      When teleporting an entity from another dimension, the entity is added to the entity sections in the destination dimension even though there are already entities with the same UUID as the teleported entity.

      How to reproduce

      1. Mark the chunk [0, 0] in the overworld and the end to be force loaded.
        /execute in minecraft:overworld run forceload add 0 0
      2. /execute in minecraft:the_end run forceload add 0 0
      3. Let the overworld be the destination dimension and add an entity with the UUID 0-0-0-0-24ee6.
        /execute in minecraft:overworld run summon minecraft:item_frame 0 0 0 {UUID: [I; 0, 0, 0, 151270], Fixed: true, CustomName: '"151270"'}
      4. Let the end be the origin dimension and add an entity with the UUID 0-0-0-0-24ee6.
        /execute in minecraft:the_end run summon minecraft:item_frame 0 0 0 {UUID: [I; 0, 0, 0, 151270], Fixed: true, CustomName: '"151270"'}
      5. Teleport the entity in the end to the overworld.
        /execute in minecraft:the_end as @e[x=0, y=0, z=0, dx=0] in minecraft:overworld run teleport @s 0 0 0

        Keeping entity minecraft:item_frame that already exists with UUID 00000000-0000-0000-0000-000000024ee6

      6. Check entities in the entity sections.
        /execute in minecraft:overworld run say @e[x=0, y=0, z=0, dx=0]

        151270, 151270, the entity in the end is added to the entity sections in the overworld. The entity sections in the overworld now have two entities with the same UUID 0-0-0-0-24ee6.

      Code analysis

      // net.minecraft.server.level.ServerLevel
      
      public void addFromAnotherDimension(Entity entity) {
          boolean forcedLoading = entity.forcedLoading;
          entity.forcedLoading = true;
      
          // Since this level already has an entity with the same UUID as `entity`, the game warns about UUID duplication and does not add `entity` to this level.
          this.addWithUUID(entity);
          entity.forcedLoading = forcedLoading;
      
          // However, `entity` is added to the entity sections in this level without UUID check.
          // UUID duplication in entity sections causes here.
          this.updateChunkPos(entity);
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              intsuc intsuc
              Votes:
              13 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: