mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
1e7dd72f15
The game uses 0.95d now
27 lines
1.5 KiB
Diff
27 lines
1.5 KiB
Diff
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
|
|
index 89defc6e1e95fdd7d76ae3af0282066819831c9e..7da95c2c02493c8a472488d7f8e6f63fbe807c8e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -3765,7 +3765,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
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;
|