mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 14:06:17 +01:00
Fix EntityPortalExitEvent target location
Now uses the proper position and world as well as correct pitch Fixes #6739 Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
parent
7991c4b431
commit
bfe562224e
@ -5,37 +5,43 @@ 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
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 4f164f238177b5e2b18c76b7cc14596ec93409d1..5c0d4c5cfef969cf3864a2c055dd0a51d0cfa770 100644
|
index 4f164f238177b5e2b18c76b7cc14596ec93409d1..e17bda0d13bae337cfad5ae31b118aa7a85499fc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3179,6 +3179,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -3181,6 +3181,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
if (shapedetectorshape == null) {
|
|
||||||
return null;
|
|
||||||
} else {
|
} else {
|
||||||
|
// CraftBukkit start
|
||||||
|
worldserver = shapedetectorshape.world;
|
||||||
|
+
|
||||||
+ // Paper start - Call EntityPortalExitEvent
|
+ // Paper start - Call EntityPortalExitEvent
|
||||||
|
+ CraftEntity bukkitEntity = this.getBukkitEntity();
|
||||||
+ Vec3 position = shapedetectorshape.pos;
|
+ Vec3 position = shapedetectorshape.pos;
|
||||||
+ float yaw = shapedetectorshape.yRot;
|
+ float yaw = shapedetectorshape.yRot;
|
||||||
+ float pitch = shapedetectorshape.xRot;
|
+ float pitch = bukkitEntity.getLocation().getPitch(); // Keep entity pitch as per moveTo line below
|
||||||
+ Vec3 velocity = shapedetectorshape.speed;
|
+ Vec3 velocity = shapedetectorshape.speed;
|
||||||
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), shapedetectorshape.portalEventInfo.getTo(), this.getBukkitEntity().getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
|
+ 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));
|
||||||
+ if (event.callEvent() && event.getTo() != null && this.isAlive()) {
|
+ if (event.callEvent() && event.getTo() != null && this.isAlive()) {
|
||||||
+ position = Vec3.atLowerCornerOf(MCUtil.toBlockPosition(event.getTo()));
|
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||||
|
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||||
+ yaw = event.getTo().getYaw();
|
+ yaw = event.getTo().getYaw();
|
||||||
+ pitch = event.getTo().getPitch();
|
+ pitch = event.getTo().getPitch();
|
||||||
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
// CraftBukkit start
|
+
|
||||||
worldserver = shapedetectorshape.world;
|
|
||||||
this.unRide();
|
this.unRide();
|
||||||
@@ -3194,8 +3207,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -3194,8 +3213,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
entity.restoreFrom(this);
|
entity.restoreFrom(this);
|
||||||
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||||
- entity.setDeltaMovement(shapedetectorshape.speed);
|
- entity.setDeltaMovement(shapedetectorshape.speed);
|
||||||
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - respect EntityPortalExitEvent values
|
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - use EntityPortalExitEvent values
|
||||||
+ entity.setDeltaMovement(velocity); // Paper - respect EntityPortalExitEvent values
|
+ entity.setDeltaMovement(velocity); // Paper - use EntityPortalExitEvent values
|
||||||
worldserver.addDuringTeleport(entity);
|
worldserver.addDuringTeleport(entity);
|
||||||
if (worldserver.getTypeKey() == DimensionType.END_LOCATION) { // CraftBukkit
|
if (worldserver.getTypeKey() == DimensionType.END_LOCATION) { // CraftBukkit
|
||||||
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||||
|
Loading…
Reference in New Issue
Block a user