From 92e8783d1ee2ecc00f816885264dc2494033f549 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 27 Dec 2018 12:19:45 +1100 Subject: [PATCH] SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent By: md_5 --- .../org/bukkit/craftbukkit/event/CraftEventFactory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 24e9314e0d..508a39f5ee 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -940,12 +940,13 @@ public class CraftEventFactory { public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) { Block hitBlock = null; + BlockFace hitFace = null; if (position.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) { - BlockPosition blockposition = position.getBlockPosition(); - hitBlock = entity.getBukkitEntity().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + hitBlock = CraftBlock.at(entity.world, position.getBlockPosition()); + hitFace = CraftBlock.notchToBlockFace(position.direction); } - 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, hitFace); entity.world.getServer().getPluginManager().callEvent(event); return event; }