3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent

Dieser Commit ist enthalten in:
md_5 2018-12-27 12:19:45 +11:00
Ursprung b54b9409e0
Commit a408f3751e

Datei anzeigen

@ -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;
}