2022-12-17 18:36:02 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
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
|
2024-06-13 17:45:43 +02:00
|
|
|
index b2dad4867371f4976ceb6a6a2129b314e02f50aa..51f1f00e9e68abb9a098a193f8201715ae73a8e4 100644
|
2022-12-17 18:36:02 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2024-05-26 21:51:15 +02:00
|
|
|
@@ -3518,7 +3518,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
2022-12-17 18:36:02 +01:00
|
|
|
Location enter = bukkitEntity.getLocation();
|
2023-05-12 13:10:08 +02:00
|
|
|
Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
|
2022-12-17 18:36:02 +01:00
|
|
|
|
|
|
|
- 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;
|