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

When creating an exit end gateway, the method findPortalPosition does not return a proper BlockPos

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.2, 20w09a, 20w18a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      Note: The description is based on a decompiled version of Minecraft 1.15.2 using yarn. This issue is barely noticeable without enabling debug logging or looking at the source code.

      The net.minecraft.block.entity.EndGatewayBlockEntity.findPortalPosition(WorldChunk worldChunk) method always returns the position of the block in the southeast corner of the worldChunk, regardless of whether it is a valid block or not.

      I've also tested this in Minecraft 1.9.4, 1.12, 1.13.2 and 1.14. It seems that this has been an issue since 1.14.

      How to reproduce

      1. Enable Log4j debug logging and launch the game
      2. Create a default world with seed 1327593420388419957
      3. Enter the end dimension
      4. Kill the ender dragon, then enter the entrance gateway
      5. Open latest.log in (Minecraft directory)\logs and search for "Found block at"
      6. Note that the coordinates are {x=-833, y=63, z=-609} and the block there is minecraft:air

      Code analysis

      This issue is likely caused by the net.minecraft.util.BlockPos.iterate(int minX, int maxX, ...) method returning a BlockPos from an instance of BlockPos.Mutable (unlike in 1.12, where the method returns a new BlockPos instead).

      Possible fix

      Change one line of code in findPortalPosition(WorldChunk worldChunk)

      blockPos3 = blockPos4;
      

      to

      blockPos3 = blockPos4.toImmutable();
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            coderoctopus coderoctopus
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              CHK: