Paper/patches/server/0788-Ensure-entity-passenger-world-matches-ridden-entity.patch
2023-09-22 15:33:14 -07:00

21 lines
1.0 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 7c3c4b3e553b31000c3e90bc03f32730f1769c8b..ca4547bc2d767a32d1fd22be858faf5e61cde9d0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2761,7 +2761,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean startRiding(Entity entity, boolean force) {
- if (entity == this.vehicle) {
+ if (entity == this.vehicle || entity.level != this.level) { // Paper - check level
return false;
} else if (!entity.couldAcceptPassenger()) {
return false;