2021-10-05 23:19:27 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
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
|
2021-12-03 22:28:15 +01:00
|
|
|
index 648987c04c6e025e86825142cacaedb7c9a1cba4..9e966aab98ffcb30c700396025d755ffdad8b7f5 100644
|
2021-10-05 23:19:27 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-12-03 22:28:15 +01:00
|
|
|
@@ -3008,6 +3008,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-10-05 23:19:27 +02:00
|
|
|
} else {
|
2021-10-07 11:05:49 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
worldserver = shapedetectorshape.world;
|
|
|
|
+
|
2021-10-05 23:19:27 +02:00
|
|
|
+ // Paper start - Call EntityPortalExitEvent
|
2021-10-07 11:05:49 +02:00
|
|
|
+ CraftEntity bukkitEntity = this.getBukkitEntity();
|
2021-10-05 23:19:27 +02:00
|
|
|
+ Vec3 position = shapedetectorshape.pos;
|
|
|
|
+ float yaw = shapedetectorshape.yRot;
|
2021-10-07 11:05:49 +02:00
|
|
|
+ float pitch = bukkitEntity.getLocation().getPitch(); // Keep entity pitch as per moveTo line below
|
2021-10-05 23:19:27 +02:00
|
|
|
+ Vec3 velocity = shapedetectorshape.speed;
|
2021-10-07 11:05:49 +02:00
|
|
|
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(bukkitEntity,
|
|
|
|
+ bukkitEntity.getLocation(), new Location(worldserver.getWorld(), position.x, position.y, position.z, yaw, pitch),
|
|
|
|
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
|
2021-10-05 23:19:27 +02:00
|
|
|
+ if (event.callEvent() && event.getTo() != null && this.isAlive()) {
|
2021-10-07 11:05:49 +02:00
|
|
|
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
|
|
|
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
2021-10-05 23:19:27 +02:00
|
|
|
+ yaw = event.getTo().getYaw();
|
|
|
|
+ pitch = event.getTo().getPitch();
|
|
|
|
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2021-10-07 11:05:49 +02:00
|
|
|
+
|
2021-10-05 23:19:27 +02:00
|
|
|
this.unRide();
|
2021-10-07 11:05:49 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
|
2021-12-03 22:28:15 +01:00
|
|
|
@@ -3021,8 +3040,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-10-05 23:19:27 +02:00
|
|
|
|
|
|
|
if (entity != null) {
|
|
|
|
entity.restoreFrom(this);
|
|
|
|
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
|
|
|
- entity.setDeltaMovement(shapedetectorshape.speed);
|
2021-10-07 11:05:49 +02:00
|
|
|
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - use EntityPortalExitEvent values
|
|
|
|
+ entity.setDeltaMovement(velocity); // Paper - use EntityPortalExitEvent values
|
2021-10-05 23:19:27 +02:00
|
|
|
worldserver.addDuringTeleport(entity);
|
2021-11-25 02:24:51 +01:00
|
|
|
if (worldserver.getTypeKey() == LevelStem.END) { // CraftBukkit
|
2021-10-05 23:19:27 +02:00
|
|
|
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
|