From 636e993d37b6e61a114c7480b25aaaf9f0cad2c7 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...
---
 .../net/minecraft/world/entity/Entity.java.patch | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
index 3fbeb4edaf..cb5a91d416 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch
@@ -650,7 +650,7 @@
          this.hasImpulse = true;
      }
  
-@@ -1858,9 +2223,21 @@
+@@ -1858,8 +2223,20 @@
      }
  
      public boolean isPushable() {
@@ -661,17 +661,16 @@
 +    public boolean isCollidable(boolean ignoreClimbing) {
 +        // Paper end - Climbing should not bypass cramming gamerule
          return false;
-     }
- 
++    }
++
 +    // CraftBukkit start - collidable API
 +    public boolean canCollideWithBukkit(Entity entity) {
 +        return this.isPushable();
-+    }
+     }
 +    // CraftBukkit end
-+
+ 
      public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
          if (entityKilled instanceof ServerPlayer) {
-             CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
 @@ -1889,74 +2266,133 @@
      }
  
@@ -1032,7 +1031,7 @@
                      leashable.setLeashedTo(player, true);
                  }
  
-@@ -2265,7 +2829,7 @@
+@@ -2265,15 +2829,15 @@
      }
  
      public boolean showVehicleHealth() {
@@ -1041,7 +1040,8 @@
      }
  
      public boolean startRiding(Entity entity, boolean force) {
-@@ -2273,7 +2837,7 @@
+-        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;