use of com.skelril.skree.service.internal.projectilewatcher.shooter.ShootingItemData in project Skree by Skelril.
the class ProjectileWatcherServiceImpl method onProjectileLaunch.
@Listener
public void onProjectileLaunch(SpawnEntityEvent event) {
for (Entity entity : event.getEntities()) {
if (!(entity instanceof Projectile)) {
continue;
}
ProjectileSource shooter = ((Projectile) entity).getShooter();
if (shooter instanceof ArmorEquipable) {
entity.offer(new ShootingItemData((((ArmorEquipable) shooter).getItemInHand(HandTypes.MAIN_HAND).map(ItemStack::createSnapshot).orElse(null))));
}
track((Projectile) entity, event.getCause());
}
}
Aggregations