--- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -131,7 +_,7 @@
 
     @Nullable
     public Vec3 getPortalPosition(ServerLevel level, BlockPos pos) {
-        if (this.exitPortal == null && level.dimension() == Level.END) {
+        if (this.exitPortal == null && level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END) { // CraftBukkit - work in alternate worlds
             BlockPos blockPos = findOrCreateValidTeleportPos(level, pos);
             blockPos = blockPos.above(10);
             LOGGER.debug("Creating portal at {}", blockPos);
