PaperMC/patches/api/0402-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch
Jake Potrebic 2f92d4e00e
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
2023-12-08 11:00:39 -08:00

49 lines
2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SoSeDiK <mrsosedik@gmail.com>
Date: Tue, 11 Oct 2022 23:30:32 +0300
Subject: [PATCH] Expose pre-collision moving velocity to
VehicleBlockCollisionEvent
diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java
index 7ff9aec7ed341c01feddb8d71170b177e1fde47b..d2b33f4105ae32a884e714a8936e3d91e23a00a0 100644
--- a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java
+++ b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java
@@ -11,11 +11,20 @@ import org.jetbrains.annotations.NotNull;
public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
// private static final HandlerList handlers = new HandlerList(); // Paper - move HandlerList to VehicleCollisionEvent
private final Block block;
+ private final org.bukkit.util.Vector velocity; // Paper
+ // Paper start - Add pre-collision velocity
+ @Deprecated
public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block) {
+ this(vehicle, block, vehicle.getVelocity());
+ }
+
+ public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block, @NotNull final org.bukkit.util.Vector velocity) { // Paper - Added velocity
super(vehicle);
this.block = block;
+ this.velocity = velocity;
}
+ // Paper end
/**
* Gets the block the vehicle collided with
@@ -26,4 +35,16 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
public Block getBlock() {
return block;
}
+
+ // Paper start
+ /**
+ * Gets velocity at which the vehicle collided with the block
+ *
+ * @return pre-collision moving velocity
+ */
+ @NotNull
+ public org.bukkit.util.Vector getVelocity() {
+ return velocity;
+ }
+ // Paper end
}