diff options
Diffstat (limited to 'patches/server/0841-Ensure-entity-passenger-world-matches-ridden-entity.patch')
-rw-r--r-- | patches/server/0841-Ensure-entity-passenger-world-matches-ridden-entity.patch | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0841-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0841-Ensure-entity-passenger-world-matches-ridden-entity.patch new file mode 100644 index 0000000000..e28f96f729 --- /dev/null +++ b/patches/server/0841-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +Date: Thu, 31 Mar 2022 05:11:37 -0700 +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 fd536e670036a365f6d0e8c168ef4b5fdf597615..4aa46029c42dc8a87a354fe6215ce78c59879bf2 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2685,6 +2685,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + protected boolean addPassenger(Entity entity) { // CraftBukkit ++ // Paper start ++ if (entity.level != this.level) { ++ 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 + if (entity.getVehicle() != this) { + throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); |