aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0802-Improve-PortalEvents.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0802-Improve-PortalEvents.patch')
-rw-r--r--patches/server/0802-Improve-PortalEvents.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/patches/server/0802-Improve-PortalEvents.patch b/patches/server/0802-Improve-PortalEvents.patch
new file mode 100644
index 0000000000..8ab28ebae1
--- /dev/null
+++ b/patches/server/0802-Improve-PortalEvents.patch
@@ -0,0 +1,26 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Thu, 15 Dec 2022 10:33:39 -0800
+Subject: [PATCH] Improve PortalEvents
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
+index 9163d565c63db3bffcbe1b002e315c31b726d6a3..661f630b38dff4aa760e7939ff80b1361d426565 100644
+--- a/src/main/java/net/minecraft/world/entity/Entity.java
++++ b/src/main/java/net/minecraft/world/entity/Entity.java
+@@ -3518,7 +3518,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+ Location enter = bukkitEntity.getLocation();
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
+
+- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
++ // Paper start
++ final org.bukkit.PortalType portalType = switch (cause) {
++ case END_PORTAL -> org.bukkit.PortalType.ENDER;
++ case NETHER_PORTAL -> org.bukkit.PortalType.NETHER;
++ default -> org.bukkit.PortalType.CUSTOM;
++ };
++ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, portalType);
++ // Paper end
+ event.getEntity().getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) {
+ return null;