--- a/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
@@ -59,8 +_,15 @@
 
     @Override
     protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
+        if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
         if (entity.canUsePortal(false)) {
+            // CraftBukkit start - Entity in portal
+            org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level), org.bukkit.PortalType.ENDER); // Paper - add portal type
+            level.getCraftServer().getPluginManager().callEvent(event);
+            if (event.isCancelled()) return; // Paper - make cancellable
+            // CraftBukkit end
             if (!level.isClientSide() && level.dimension() == Level.END && entity instanceof ServerPlayer serverPlayer && !serverPlayer.seenCredits) {
+                if (level.paperConfig().misc.disableEndCredits) {serverPlayer.seenCredits = true; return;} // Paper - Option to disable end credits
                 serverPlayer.showEndCredits();
             } else {
                 entity.setAsInsidePortal(this, pos);
@@ -73,7 +_,7 @@
     public TeleportTransition getPortalDestination(ServerLevel level, Entity entity, BlockPos pos) {
         LevelData.RespawnData respawnData = level.getRespawnData();
         ResourceKey<Level> resourceKey = level.dimension();
-        boolean flag = resourceKey == Level.END;
+        boolean flag = level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
         ResourceKey<Level> resourceKey1 = flag ? respawnData.dimension() : Level.END;
         BlockPos blockPos = flag ? respawnData.pos() : ServerLevel.END_SPAWN_POINT;
         ServerLevel level1 = level.getServer().getLevel(resourceKey1);
@@ -85,7 +_,7 @@
             float f1;
             Set<Relative> set;
             if (!flag) {
-                EndPlatformFeature.createEndPlatform(level1, BlockPos.containing(bottomCenter).below(), true);
+                EndPlatformFeature.createEndPlatform(level1, BlockPos.containing(bottomCenter).below(), true, entity); // CraftBukkit
                 f = Direction.WEST.toYRot();
                 f1 = 0.0F;
                 set = Relative.union(Relative.DELTA, Set.of(Relative.X_ROT));
@@ -97,15 +_,24 @@
                 f1 = respawnData.pitch();
                 set = Relative.union(Relative.DELTA, Relative.ROTATION);
                 if (entity instanceof ServerPlayer serverPlayer) {
-                    return serverPlayer.findRespawnPositionAndUseSpawnBlock(false, TeleportTransition.DO_NOTHING);
+                    return serverPlayer.findRespawnPositionAndUseSpawnBlock(false, TeleportTransition.DO_NOTHING, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.END_PORTAL); // CraftBukkit
                 }
 
                 bottomCenter = entity.adjustSpawnLocation(level1, blockPos).getBottomCenter();
             }
 
-            return new TeleportTransition(
-                level1, bottomCenter, Vec3.ZERO, f, f1, set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET)
-            );
+            // CraftBukkit start
+            set.removeAll(Relative.ROTATION); // remove relative rotation flags to simplify event mutation
+            float absoluteYaw = !flag ? f : entity.getYRot() + f;
+            float absolutePitch = entity.getXRot() + f1;
+            org.bukkit.craftbukkit.event.CraftPortalEvent event = entity.callPortalEvent(entity, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(bottomCenter, level1, absoluteYaw, absolutePitch), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+            if (event == null) {
+                return null;
+            }
+            org.bukkit.Location to = event.getTo();
+
+            return new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3(to), Vec3.ZERO, to.getYaw(), to.getPitch(), set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL);
+            // CraftBukkit end
         }
     }
 
