aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0587-Add-back-EntityPortalExitEvent.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-06-16 12:56:00 +0200
committerNassim Jahnke <[email protected]>2024-06-16 12:56:00 +0200
commitdc684c60d16f66ea84467ec8e253f2a36a17a7c8 (patch)
treee516f1bd4bfbdb37a5aeee42384aade111eca3e1 /patches/server/0587-Add-back-EntityPortalExitEvent.patch
parent752f957e12e4ceb8b7d2043a4a7dbce786b7b98f (diff)
downloadPaper-dc684c60d16f66ea84467ec8e253f2a36a17a7c8.tar.gz
Paper-dc684c60d16f66ea84467ec8e253f2a36a17a7c8.zip
Remove bad server.scheduleOnMain disconnect calls from old patches
The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
Diffstat (limited to 'patches/server/0587-Add-back-EntityPortalExitEvent.patch')
-rw-r--r--patches/server/0587-Add-back-EntityPortalExitEvent.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/server/0587-Add-back-EntityPortalExitEvent.patch b/patches/server/0587-Add-back-EntityPortalExitEvent.patch
new file mode 100644
index 0000000000..ccbe08c67a
--- /dev/null
+++ b/patches/server/0587-Add-back-EntityPortalExitEvent.patch
@@ -0,0 +1,46 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Sun, 16 May 2021 09:39:46 -0700
+Subject: [PATCH] Add back EntityPortalExitEvent
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
+index 5223379e5c11c978fd85bd05ef9451aa2ddc2aa3..4ef848a32c4f149e4cc2f9a8213244c163a72bea 100644
+--- a/src/main/java/net/minecraft/world/entity/Entity.java
++++ b/src/main/java/net/minecraft/world/entity/Entity.java
+@@ -3365,7 +3365,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+ if (world instanceof ServerLevel worldserver) {
+ if (!this.isRemoved()) {
+ // CraftBukkit start
+- Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot());
++ Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), this.getXRot()); // Paper - use getXRot (doesn't respect DimensionTransition pitch)
+ // Paper start - gateway-specific teleport event
+ final EntityTeleportEvent teleEvent;
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
+@@ -3379,7 +3379,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
+ return null;
+ }
+ to = teleEvent.getTo();
+- teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
++ // Paper start - Call EntityPortalExitEvent
++ CraftEntity bukkitEntity = this.getBukkitEntity();
++ Vec3 velocity = teleportTarget.speed();
++ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(
++ bukkitEntity,
++ bukkitEntity.getLocation(), to.clone(),
++ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity)
++ );
++ event.callEvent();
++ if (this.isRemoved()) {
++ return null;
++ }
++
++ if (!event.isCancelled() && event.getTo() != null) {
++ to = event.getTo().clone();
++ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
++ }
++ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
++ // Paper end - Call EntityPortalExitEvent
+ // CraftBukkit end
+ ServerLevel worldserver1 = teleportTarget.newLevel();
+ List<Entity> list = this.getPassengers();