Paper/patches/server/0706-Ensure-entity-passenge...

21 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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 8e09bfb7c1b4fb34e6615b0cf774bc8e6cae29fa..3bd13975934e8f61b41c4c08b73ead6e0f45ffac 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2611,7 +2611,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean startRiding(Entity entity, boolean force) {
- if (entity == this.vehicle) {
+ if (entity == this.vehicle || entity.level != this.level) { // Paper - Ensure entity passenger world matches ridden entity (bad plugins)
return false;
} else if (!entity.couldAcceptPassenger()) {
return false;