From b831784aedb7979e111f550198ef22ac29cae7a6 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 7 May 2022 08:48:29 -0700 Subject: [PATCH] Only log for passenger / vehicle world mismatch Exception thrown may corrupt passenger/vehicle state --- ...sure-entity-passenger-world-matches-ridden-entity.patch | 7 ++++--- .../0885-Guard-against-invalid-entity-positions.patch | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/server/0884-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0884-Ensure-entity-passenger-world-matches-ridden-entity.patch index 7de0352dbb..4631b0e228 100644 --- a/patches/server/0884-Ensure-entity-passenger-world-matches-ridden-entity.patch +++ b/patches/server/0884-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -6,16 +6,17 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity Bad plugins doing this would cause some obvious problems... diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8b57a24d4e8469dfbfb4eb2d11ca616e1db98598..26911884384d5e8afd1b43360494b793374f505f 100644 +index 8b57a24d4e8469dfbfb4eb2d11ca616e1db98598..122fa578adbba8aa5e7c253c59f45cac6a0d2223 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2590,6 +2590,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2590,6 +2590,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } protected boolean addPassenger(Entity entity) { // CraftBukkit + // Paper start + if (entity.level != this.level) { -+ throw new IllegalArgumentException("Entity passenger world must match"); ++ LOGGER.error("Entity passenger world must match, cannot add " + entity + " as passenger to " + this, new Throwable()); ++ return false; + } + // Paper end if (entity == this) throw new IllegalArgumentException("Entities cannot become a passenger of themselves"); // Paper - issue 572 diff --git a/patches/server/0885-Guard-against-invalid-entity-positions.patch b/patches/server/0885-Guard-against-invalid-entity-positions.patch index a9bce43337..f1c8c2b89b 100644 --- a/patches/server/0885-Guard-against-invalid-entity-positions.patch +++ b/patches/server/0885-Guard-against-invalid-entity-positions.patch @@ -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 26911884384d5e8afd1b43360494b793374f505f..49cf3601df7b145d49b1fe9a71ba0bc60c5394b3 100644 +index 122fa578adbba8aa5e7c253c59f45cac6a0d2223..03ba63163650463040815562e4e76a92758f8661 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4090,11 +4090,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4091,11 +4091,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); }