Paper/Spigot-API-Patches/0119-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch
Aikar 5b6dfb3463
NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team
can work on this update.

Do not try to use this branch. You will fail.
2018-07-16 00:13:29 -04:00

58 Zeilen
2.0 KiB
Diff

From 24a9e71e950ac0ff3a753f35aed71fa638f71290 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sat, 30 Jun 2018 05:45:04 +0200
Subject: [PATCH] Improve ProjectileHitEvent to include the BlockFace where the
projectile has hit
diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
index 35f4148b..db105e76 100644
--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
@@ -12,6 +12,7 @@ public class ProjectileHitEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private final Entity hitEntity;
private final Block hitBlock;
+ private final org.bukkit.block.BlockFace hitBlockFace; // Paper
public ProjectileHitEvent(final Projectile projectile) {
this(projectile, null, null);
@@ -26,9 +27,16 @@ public class ProjectileHitEvent extends EntityEvent {
}
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock) {
+ // Paper Start - Add a constructor that includes a BlockFace parameter
+ this(projectile, hitEntity, hitBlock, null);
+ }
+
+ public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock, org.bukkit.block.BlockFace hitBlockFace) {
+ // Paper End
super(projectile);
this.hitEntity = hitEntity;
this.hitBlock = hitBlock;
+ this.hitBlockFace = hitBlockFace; // Paper
}
@Override
@@ -45,6 +53,17 @@ public class ProjectileHitEvent extends EntityEvent {
return hitBlock;
}
+ // Paper Start
+ /**
+ * Gets the face of the block that the projectile has hit.
+ *
+ * @return hit block face or else null
+ */
+ public org.bukkit.block.BlockFace getHitBlockFace() {
+ return hitBlockFace;
+ }
+ // Paper End
+
/**
* Gets the entity that was hit, if it was an entity that was hit.
*
--
2.18.0