2021-10-05 21:19:27 +00: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
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 13:37:33 +00:00
|
|
|
index 2ede042815b2c51a6f506d3c99eca01db78529dc..fae9aa88bc672b3ac17dcbbf077a57cd3254a723 100644
|
2021-10-05 21:19:27 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 13:37:33 +00:00
|
|
|
@@ -3288,6 +3288,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-10-05 21:19:27 +00:00
|
|
|
} else {
|
2021-10-07 09:05:49 +00:00
|
|
|
// CraftBukkit start
|
|
|
|
worldserver = shapedetectorshape.world;
|
2021-10-05 21:19:27 +00:00
|
|
|
+ // Paper start - Call EntityPortalExitEvent
|
|
|
|
+ Vec3 position = shapedetectorshape.pos;
|
|
|
|
+ float yaw = shapedetectorshape.yRot;
|
2024-02-01 09:15:57 +00:00
|
|
|
+ float pitch = this.getXRot(); // Keep entity pitch as per moveTo line below
|
2021-10-05 21:19:27 +00:00
|
|
|
+ Vec3 velocity = shapedetectorshape.speed;
|
2024-02-01 09:15:57 +00:00
|
|
|
+ CraftEntity bukkitEntity = this.getBukkitEntity();
|
2021-10-07 09:05:49 +00: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));
|
2023-08-08 07:48:55 +00:00
|
|
|
+ event.callEvent();
|
|
|
|
+ if (this.isRemoved()) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!event.isCancelled() && event.getTo() != null) {
|
2021-10-07 09:05:49 +00:00
|
|
|
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
2024-02-01 09:15:57 +00:00
|
|
|
+ position = CraftLocation.toVec3D(event.getTo());
|
2021-10-05 21:19:27 +00:00
|
|
|
+ yaw = event.getTo().getYaw();
|
|
|
|
+ pitch = event.getTo().getPitch();
|
|
|
|
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
|
|
|
+ }
|
2024-01-19 11:30:04 +00:00
|
|
|
+ // Paper end - Call EntityPortalExitEvent
|
2022-02-12 13:20:33 +00:00
|
|
|
if (worldserver == this.level) {
|
|
|
|
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
|
|
|
|
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 13:37:33 +00:00
|
|
|
@@ -3307,8 +3329,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-10-05 21:19:27 +00: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);
|
2024-01-19 11:30:04 +00:00
|
|
|
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - EntityPortalExitEvent
|
|
|
|
+ entity.setDeltaMovement(velocity); // Paper - EntityPortalExitEvent
|
2023-12-06 04:46:41 +00:00
|
|
|
// CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
|
|
|
|
if (this.inWorld) {
|
|
|
|
worldserver.addDuringTeleport(entity);
|