Ensure entity passenger world matches ridden entity

Bad plugins doing this would cause some obvious problems...
This commit is contained in:
Spottedleaf
2022-03-31 05:11:37 -07:00
parent 7b3898ad66
commit 636e993d37

View File

@@ -650,7 +650,7 @@
this.hasImpulse = true; this.hasImpulse = true;
} }
@@ -1858,9 +2223,21 @@ @@ -1858,8 +2223,20 @@
} }
public boolean isPushable() { public boolean isPushable() {
@@ -661,17 +661,16 @@
+ public boolean isCollidable(boolean ignoreClimbing) { + public boolean isCollidable(boolean ignoreClimbing) {
+ // Paper end - Climbing should not bypass cramming gamerule + // Paper end - Climbing should not bypass cramming gamerule
return false; return false;
} + }
+
+ // CraftBukkit start - collidable API + // CraftBukkit start - collidable API
+ public boolean canCollideWithBukkit(Entity entity) { + public boolean canCollideWithBukkit(Entity entity) {
+ return this.isPushable(); + return this.isPushable();
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
public void awardKillScore(Entity entityKilled, DamageSource damageSource) { public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
if (entityKilled instanceof ServerPlayer) { if (entityKilled instanceof ServerPlayer) {
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
@@ -1889,74 +2266,133 @@ @@ -1889,74 +2266,133 @@
} }
@@ -1032,7 +1031,7 @@
leashable.setLeashedTo(player, true); leashable.setLeashedTo(player, true);
} }
@@ -2265,7 +2829,7 @@ @@ -2265,15 +2829,15 @@
} }
public boolean showVehicleHealth() { public boolean showVehicleHealth() {
@@ -1041,7 +1040,8 @@
} }
public boolean startRiding(Entity entity, boolean force) { 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; return false;
} else if (!entity.couldAcceptPassenger()) { } else if (!entity.couldAcceptPassenger()) {
return false; return false;