mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 11:58:06 +01:00
SPIGOT-911: Add hitBlock to PorjectileHitEvent
This commit is contained in:
parent
b6ad714e85
commit
1d54397474
@ -779,7 +779,13 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
|
||||
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity());
|
||||
Block hitBlock = null;
|
||||
if (position.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
BlockPosition blockposition = position.a();
|
||||
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);
|
||||
entity.world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user