diff --git a/Spigot-API-Patches/0121-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch b/Spigot-API-Patches/0121-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch new file mode 100644 index 0000000000..f0ad8f81f8 --- /dev/null +++ b/Spigot-API-Patches/0121-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch @@ -0,0 +1,57 @@ +From 664f399ae92f6c74e4dd132d24c7abe3181c9fc6 Mon Sep 17 00:00:00 2001 +From: Brokkonaut +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.16.1.windows.1 + diff --git a/Spigot-Server-Patches/0319-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch b/Spigot-Server-Patches/0319-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch new file mode 100644 index 0000000000..9dfebb70c2 --- /dev/null +++ b/Spigot-Server-Patches/0319-Improve-ProjectileHitEvent-to-include-the-BlockFace-.patch @@ -0,0 +1,23 @@ +From 88ea90f3fcea86a0d4c1e6ff7b82549943b5f9fb Mon Sep 17 00:00:00 2001 +From: Brokkonaut +Date: Sat, 30 Jun 2018 05:45:39 +0200 +Subject: [PATCH] Improve ProjectileHitEvent to include the BlockFace where the + projectile has hit + + +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 9b19c055d..248873fb4 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -836,7 +836,7 @@ public class CraftEventFactory { + hitBlock = entity.getBukkitEntity().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } + +- ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity(), hitBlock); ++ ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity(), hitBlock, position.direction == null ? null : CraftBlock.notchToBlockFace(position.direction)); // Paper - add BlockFace parameter + entity.world.getServer().getPluginManager().callEvent(event); + return event; + } +-- +2.17.1 +