2022-03-31 15:04:23 +02:00
|
|
|
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
|
2022-12-07 22:35:34 +01:00
|
|
|
index 9c9251f9f8ac83dddef87561af1d3ea2ab37009c..4728b08a363dfc9e33f6858a88faba404d79af6f 100644
|
2022-03-31 15:04:23 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2022-12-07 22:35:34 +01:00
|
|
|
@@ -2703,6 +2703,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
2022-03-31 15:04:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean addPassenger(Entity entity) { // CraftBukkit
|
|
|
|
+ // Paper start
|
|
|
|
+ if (entity.level != this.level) {
|
2022-05-07 17:48:29 +02:00
|
|
|
+ LOGGER.error("Entity passenger world must match, cannot add " + entity + " as passenger to " + this, new Throwable());
|
|
|
|
+ return false;
|
2022-03-31 15:04:23 +02:00
|
|
|
+ }
|
|
|
|
+ // 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)");
|