PaperMC/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch
2021-09-03 19:57:21 +02:00

18 lines
1,019 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Sun, 8 Jan 2017 04:31:36 +0000
Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8473dcb54b26ea6b264125423fc2d52b87176b83..6211a425e81f9ba9718af6c30e534d35b10bad02 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2250,6 +2250,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
protected boolean addPassenger(Entity entity) { // CraftBukkit
+ 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)");
} else {