--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
@@ -27,6 +27,10 @@
 import net.minecraft.world.phys.Vec3D;
 import org.slf4j.Logger;
 
+// CraftBukkit start
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
 public class TileEntityEndGateway extends TileEntityEnderPortal {
 
     private static final Logger LOGGER = LogUtils.getLogger();
@@ -143,7 +147,7 @@
     public Vec3D getPortalPosition(WorldServer worldserver, BlockPosition blockposition) {
         BlockPosition blockposition1;
 
-        if (this.exitPortal == null && worldserver.dimension() == World.END) {
+        if (this.exitPortal == null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
             blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
             blockposition1 = blockposition1.above(10);
             TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
