mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
Don't put entities removed during the portal exit event into an invalid state
This commit is contained in:
parent
ef2b574c6a
commit
408a9050ba
@ -5,10 +5,10 @@ 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 f99feb964e4da1bcb49fc643e207115fe4c3c68b..304f7c1fe35e18f6331de02a3db2b8c84e22eaa2 100644
|
||||
index 7802d3d9274c9083a89b9f62441194e8a0d8975b..060fbc163b0ee8fc0baa4e18d18d25830353e0a9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3329,6 +3329,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3329,6 +3329,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
worldserver = shapedetectorshape.world;
|
||||
@ -21,7 +21,12 @@ index f99feb964e4da1bcb49fc643e207115fe4c3c68b..304f7c1fe35e18f6331de02a3db2b8c8
|
||||
+ 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()) {
|
||||
+ event.callEvent();
|
||||
+ if (this.isRemoved()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.isCancelled() && event.getTo() != null) {
|
||||
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ yaw = event.getTo().getYaw();
|
||||
@ -32,7 +37,7 @@ index f99feb964e4da1bcb49fc643e207115fe4c3c68b..304f7c1fe35e18f6331de02a3db2b8c8
|
||||
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);
|
||||
@@ -3348,8 +3365,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3348,8 +3370,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
if (entity != null) {
|
||||
entity.restoreFrom(this);
|
||||
|
@ -122,7 +122,7 @@ index 1d0f87185a8a74394bc2da29828407fd4210754c..d6429d721116aac2a4df8d0b217e9efc
|
||||
|
||||
private void tickPassenger(Entity vehicle, Entity passenger) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d28c3834aeefc8ab553c366a037549f46fb7cfc3..b421f4f8f32dd3df97ba465e6d865d23fc0afda8 100644
|
||||
index 7065d61551a88c04e2e1ba44448a7ae74ad7bf43..ac62a7f286832406390d9186b633974eb136061e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1024,7 +1024,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -182,7 +182,7 @@ index d28c3834aeefc8ab553c366a037549f46fb7cfc3..b421f4f8f32dd3df97ba465e6d865d23
|
||||
}
|
||||
|
||||
private boolean isStateClimbable(BlockState state) {
|
||||
@@ -4219,7 +4261,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4224,7 +4266,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void setDeltaMovement(Vec3 velocity) {
|
||||
@ -192,7 +192,7 @@ index d28c3834aeefc8ab553c366a037549f46fb7cfc3..b421f4f8f32dd3df97ba465e6d865d23
|
||||
}
|
||||
|
||||
public void addDeltaMovement(Vec3 velocity) {
|
||||
@@ -4305,7 +4349,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4310,7 +4354,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
// Paper end - fix MC-4
|
||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f0971946e3683733d5f12888263ebe2996aa0df0..602f0ea9a0a077df7dd4b8964d442cfaca25d37e 100644
|
||||
index 0a8868609535754a318c3c845c9821a5e8c09b65..3164ba33d61a1969df3d42849d593a8de867a8ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3444,6 +3444,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -22,7 +22,7 @@ index f0971946e3683733d5f12888263ebe2996aa0df0..602f0ea9a0a077df7dd4b8964d442cfa
|
||||
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
||||
|
||||
nbttagcompound.remove("Dimension");
|
||||
@@ -3525,10 +3532,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3530,10 +3537,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (worldserver.getTypeKey() == LevelStem.END) { // CraftBukkit
|
||||
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Guard against invalid entity positions
|
||||
Anything not finite should be blocked and logged
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 32d7f615982f73dd985b919aae071d426ad08ca9..a92c3b7dbd4bd352ba1d2ed3310c8993ea3ea921 100644
|
||||
index 420716136301b231a6228577dc8a63a58fa80292..d3802079724d994bc8187198810f21857d26f4c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4443,11 +4443,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4448,11 +4448,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Player Entity Tracking Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 869062266419beca820d95a40b6a8a5ce8a31e1f..3ca30e0351e3ccb9bcb9094f4337f62c42a8afc5 100644
|
||||
index 0bce657c8f7b98dfc6bb59c81d22c0172df21115..b1f5de9d80ee46ea8e61f6b8009fdd38424db7fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4013,9 +4013,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4018,9 +4018,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
EnchantmentHelper.doPostDamageEffects(attacker, target);
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ 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 3ca30e0351e3ccb9bcb9094f4337f62c42a8afc5..414f635fd591d1b89806c7980bc3734753dcc8c4 100644
|
||||
index b1f5de9d80ee46ea8e61f6b8009fdd38424db7fa..4951bcbda4b8003e78d60c986351be011d96ede2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3669,7 +3669,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3674,7 +3674,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
Location enter = bukkitEntity.getLocation();
|
||||
Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ index 8547e7ff2f1f5b7701fb0f3c3010c14601a5f83e..fff7ad7a45f310783ac96b44575ad3db
|
||||
this.players.remove(entityplayer);
|
||||
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1e5d17f955f4c46973928310db987119c15c707b..99e28690aa8705da91e6def598e11a1c98612fa9 100644
|
||||
index c078271ac68ea1f2906c05d843c944649316e537..57be4397c5a52580f6b466c67a6974312d7995de 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -246,11 +246,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -1186,7 +1186,7 @@ index 1e5d17f955f4c46973928310db987119c15c707b..99e28690aa8705da91e6def598e11a1c
|
||||
@Override
|
||||
public CommandSender getBukkitSender(CommandSourceStack wrapper) {
|
||||
return this.getBukkitEntity();
|
||||
@@ -4651,6 +4663,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4656,6 +4668,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return;
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
@ -1194,7 +1194,7 @@ index 1e5d17f955f4c46973928310db987119c15c707b..99e28690aa8705da91e6def598e11a1c
|
||||
if (this.removalReason == null) {
|
||||
this.removalReason = reason;
|
||||
}
|
||||
@@ -4661,12 +4674,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4666,12 +4679,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload)
|
||||
this.levelCallback.onRemove(reason);
|
||||
|
Loading…
Reference in New Issue
Block a user