本文整理了Java中org.bukkit.entity.Projectile.isValid()
方法的一些代码示例,展示了Projectile.isValid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Projectile.isValid()
方法的具体详情如下:
包路径:org.bukkit.entity.Projectile
类名称:Projectile
方法名:isValid
暂无
代码示例来源:origin: TheBusyBiscuit/Slimefun4
@EventHandler
public void onArrowHit(final ProjectileHitEvent e) {
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
if (!e.getEntity().isValid()) return;
if (Variables.arrows.containsKey(e.getEntity().getUniqueId())) Variables.arrows.remove(e.getEntity().getUniqueId());
if (e.getEntity() instanceof Arrow) handleGrapplingHook((Arrow) e.getEntity());
}, 4L);
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@Override
public void run() {
if (!target.isValid() || projectile.isDead() || !projectile.isValid() || ticks-- <= 0) {
cancel();
return;
}
Vector origVel = projectile.getVelocity();
double v = origVel.length();
Vector rel = target.getEyeLocation().toVector().subtract(projectile.getLocation().toVector()).normalize().multiply(v);
rel.multiply(velFactor).add(origVel.multiply(1 - velFactor));
projectile.setVelocity(rel);
if (projectile instanceof Fireball) {
((Fireball) projectile).setDirection(rel.normalize());
}
}
}.runTaskTimer(RPGItems.plugin, 1, 0);
内容来源于网络,如有侵权,请联系作者删除!