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

Ender dragon can teleport through end_gateway

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Minecraft 15w49a
    • Minecraft 15w34b, Minecraft 15w41b, Minecraft 15w42a, Minecraft 15w43c, Minecraft 15w44a, Minecraft 15w44b, Minecraft 15w45a, Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w47b, Minecraft 15w47c, Minecraft 15w49a, Minecraft 15w51b, Minecraft 16w02a, Minecraft 16w03a, Minecraft 16w05a, Minecraft 16w06a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9 Pre-Release 2, Minecraft 1.9 Pre-Release 3, Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.4, Minecraft 16w21a, Minecraft 16w39a, Minecraft 16w39b, Minecraft 16w39c, Minecraft 16w44a, Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12, Minecraft 17w45b, Minecraft 18w21b, Minecraft 1.13, Minecraft 18w32a, Minecraft 1.13.1-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w11b, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 5, 1.15 Pre-release 4, 1.15.1, 1.15.2, 20w06a, 20w13b, 20w17a, 1.16 Release Candidate 1, 1.16, 1.16.4, 20w49a, 20w51a, 1.16.5, 21w16a, 1.17.1, 1.18 Pre-release 8, 22w44a, 1.20.1
    • Confirmed
    • Entities
    • Low
    • Gameplay

      The bug

      Ender dragons, like most entities, use end gateways when touching them. If, for some reason, the ender dragon flies through an end portal, it will be teleported through it, away from the main island and loaded chunks.

      How to reproduce

      /execute in minecraft:the_end run tp @p 0 80 5 180 -30
      /setblock 0 ~5 0 minecraft:end_gateway{ExitPortal:{X:-100,Y:100,Z:0}} replace
      

      Update: In 1.17 snapshots it requires several tries for this but to occur. It is inconsistent for some reason.

      Code Analysis & Fix

      Code Analysis done by Thumpbacker
      The End Gateway allows all entities, including dragons to teleport through it. Simply doing a check in the canEntityTeleport method in the TheEndGatewayBlockEntity class for the ender dragon fixes this issue

      Current Code

      net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
         public static boolean canEntityTeleport(Entity p_59941_) {
                return EntitySelector.NO_SPECTATORS.test(p_59941_) && !p_59941_.getRootVehicle().isOnPortalCooldown();
         }
      

      Fixed Code

      net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
         public static boolean canEntityTeleport(Entity p_59941_) {
            //Check if the entity is the Ender Dragon fixes MC-86836 & MC-257097
            if(p_59941_ instanceof EnderDragon)
            {
               return false;
            }
            else {
               return EntitySelector.NO_SPECTATORS.test(p_59941_) && !p_59941_.getRootVehicle().isOnPortalCooldown();
            }
         }
      

            Unassigned Unassigned
            Toboe_Irbis [Helper] MichaƂ
            Votes:
            34 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              CHK: