aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch')
-rw-r--r--patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch
new file mode 100644
index 0000000000..7de0352dbb
--- /dev/null
+++ b/patches/server/0886-Ensure-entity-passenger-world-matches-ridden-entity.patch
@@ -0,0 +1,23 @@
+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 8b57a24d4e8469dfbfb4eb2d11ca616e1db98598..26911884384d5e8afd1b43360494b793374f505f 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 {
+ }
+
+ protected boolean addPassenger(Entity entity) { // CraftBukkit
++ // Paper start
++ if (entity.level != this.level) {
++ throw new IllegalArgumentException("Entity passenger world must match");
++ }
++ // 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)");