Paper/patches/server/0748-fix-entity-vehicle-collision-event-not-called.patch
2024-10-27 18:39:30 +01:00

28 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lukas81298 <lukas81298@gmail.com>
Date: Tue, 12 Jan 2021 14:41:38 +0100
Subject: [PATCH] fix entity vehicle collision event not called
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index ee7350e19a86ffa115e4bce6b186a2422951e89b..d8fcd6d1edec1f31a861fab4b86cbeb15ddc799d 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -157,7 +157,15 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override
public boolean canCollideWith(Entity other) {
- return AbstractBoat.canVehicleCollide(this, other);
+ // Paper start - fix VehicleEntityCollisionEvent not called when colliding with player
+ boolean collides = AbstractBoat.canVehicleCollide(this, other);
+ if (!collides) {
+ return false;
+ }
+ org.bukkit.event.vehicle.VehicleEntityCollisionEvent collisionEvent = new org.bukkit.event.vehicle.VehicleEntityCollisionEvent((org.bukkit.entity.Vehicle) getBukkitEntity(), other.getBukkitEntity());
+
+ return collisionEvent.callEvent();
+ // Paper end - fix VehicleEntityCollisionEvent not called when colliding with player
}
@Override