velocity.setZ(velocity.getZ() + dz); boostedEntity.setVelocity(velocity); this.setVelocity(velocity);
@Override public void run() { livingEntity.setVelocity(velocity); } }.runTaskLater(MyPetApi.getPlugin(), 0);
public void apply(LivingEntity target) { target.setVelocity(new Vector( -Math.sin(myPet.getLocation().get().getYaw() * 3.141593F / 180.0F) * 2 * 0.5F, 0.1D, Math.cos(myPet.getLocation().get().getYaw() * 3.141593F / 180.0F) * 2 * 0.5F )); }
@Override public void progress() { final List<RaiseEarth> removal = new ArrayList<>(); for (final RaiseEarth abil : this.entities.keySet()) { if (abil.isRemoved() && abil.isStarted()) { final LivingEntity lent = this.entities.get(abil); if (!lent.isDead()) { if (lent instanceof Player && !((Player) lent).isOnline()) { continue; } lent.setVelocity(new Vector(0, this.power, 0)); } if (this.damaging) { DamageHandler.damageEntity(lent, this.damage, this); } removal.add(abil); } } for (final RaiseEarth remove : removal) { this.entities.remove(remove); } if (this.entities.isEmpty()) { this.bPlayer.addCooldown(this); this.remove(); return; } }
@Override public PowerResult<Double> hit(Player player, ItemStack stack, LivingEntity entity, double damage, EntityDamageByEntityEvent event) { if (!getItem().consumeDurability(stack, cost)) return PowerResult.cost(); if (rand.nextInt(chance) == 0) { Bukkit.getScheduler().runTask(RPGItems.plugin, () -> entity.setVelocity(player.getLocation().getDirection().setY(power))); } return PowerResult.ok(damage); }
private void affect(final LivingEntity entity) { entity.setVelocity(this.thrownForce); DamageHandler.damageEntity(entity, this.damage, this); this.damaged.add(entity); if (entity instanceof Player) { if (this.bPlayer.canBeSlowed()) { final PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, this.slowDuration, this.slowPower); new TempPotionEffect(entity, effect); this.bPlayer.slow(this.slowCooldown); } } else { final PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, this.slowDuration, this.slowPower); new TempPotionEffect(entity, effect); } AirAbility.breakBreathbendingHold(entity); }
/** * Fires a pearl from the NPC at a target. */ public void firePearl(LivingEntity target) { sentinel.swingWeapon(); sentinel.faceLocation(target.getEyeLocation()); // TODO: Maybe require entity is-on-ground? sentinel.stats_pearlsUsed++; target.setVelocity(target.getVelocity().add(new Vector(0, sentinel.getDamage(), 0))); }
@Override public boolean onHit(EntityDamageByEntityEvent e, LivingEntity n) { if (SlimefunManager.isItemSimiliar(Variables.arrows.get(e.getDamager().getUniqueId()), SlimefunItems.EXPLOSIVE_BOW, true)) { Vector vector = n.getVelocity(); vector.setY(0.6); n.setVelocity(vector); n.getWorld().createExplosion(n.getLocation(), 0F); n.getWorld().playSound(n.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); return true; } else return false; } });
@Override public void execute(Arena arena, MABoss boss) { LivingEntity target = AbilityUtils.getTarget(arena, boss.getEntity(), RANDOM); if (target == null) return; Location loc = target.getLocation(); Location bLoc = boss.getEntity().getLocation(); Vector v = new Vector(bLoc.getX() - loc.getX(), 0, bLoc.getZ() - loc.getZ()); double a = Math.abs(bLoc.getX() - loc.getX()); double b = Math.abs(bLoc.getZ() - loc.getZ()); double c = Math.sqrt((a*a + b*b)); target.setVelocity(v.normalize().multiply(c*0.3).setY(0.8)); } }
final double newKnockback = this.bPlayer.isAvatarState() ? this.knockback + 0.5 : this.knockback; DamageHandler.damageEntity(entity, this.damage, coreAbility); entity.setVelocity(direction.normalize().multiply(newKnockback));
this.grabbedEntity.setVelocity(vector.normalize().multiply(.65)); } else { this.grabbedEntity.setVelocity(new Vector(0, 0, 0));
/** * Knocks a target back from damage received (for hacked-in damage applications when required by config). */ public void knockback(LivingEntity entity) { Vector relative = entity.getLocation().toVector().subtract(getLivingEntity().getLocation().toVector()); relative = relative.normalize(); relative.setY(0.75); relative.multiply(0.5 / Math.max(1.0, entity.getVelocity().length())); entity.setVelocity(entity.getVelocity().multiply(0.25).add(relative)); if (SentinelPlugin.debugMe) { debug("applied knockback velocity adder of " + relative); } } }
@Override public void execute(Arena arena, MABoss boss) { LivingEntity target = AbilityUtils.getTarget(arena, boss.getEntity(), RANDOM); if (target == null) return; Location bLoc = boss.getEntity().getLocation(); Location loc = target.getLocation(); Vector v = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ()); target.setVelocity(v.normalize().setY(0.8)); } }
e.setVelocity(e.getVelocity().setY(0.5));
public void pummel(LivingEntity target, Wolf wolf) { if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL)) return; if(!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(AdvancedConfig.getInstance().getPummelChance(), getPlayer(), SubSkillType.TAMING_PUMMEL))) return; ParticleEffectUtils.playGreaterImpactEffect(target); target.setVelocity(wolf.getLocation().getDirection().normalize().multiply(1.5D)); if (target instanceof Player) { Player defender = (Player) target; if (UserManager.getPlayer(defender).useChatNotifications()) { NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage"); } } }
creature.setVelocity(new Vector(0, 2, 0));
/** * Handle the effects of the Greater Impact ability * * @param target The {@link LivingEntity} being affected by the ability */ public double greaterImpact(LivingEntity target) { //static chance (3rd param) if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) { return 0; } Player player = getPlayer(); ParticleEffectUtils.playGreaterImpactEffect(target); target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier)); if (mcMMOPlayer.useChatNotifications()) { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Proc"); } if (target instanceof Player) { Player defender = (Player) target; if (UserManager.getPlayer(defender).useChatNotifications()) { NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck"); } } return Axes.greaterImpactBonusDamage; }
public void launch() { if (!this.canThrow) { return; } if (this.targetEntity == null) { return; } final Location location = this.player.getLocation(); double dx, dy, dz; final Location target = this.targetEntity.getLocation().clone(); dx = target.getX() - location.getX(); dy = target.getY() - location.getY(); dz = target.getZ() - location.getZ(); final Vector vector = new Vector(dx, dy, dz); vector.normalize(); this.targetEntity.setVelocity(vector.multiply(this.metalClipsCount / 2).normalize()); this.remove(); }
final LivingEntity le = (LivingEntity) e; DamageHandler.damageEntity(le, this.speed / 2, this); le.setVelocity(this.player.getVelocity().clone().multiply(2 / 3));
if (waw.grabbedEntity != null) { GRABBED_ENTITIES.remove(waw.grabbedEntity); waw.grabbedEntity.setVelocity(waw.grabbedEntity.getVelocity().multiply(2.5));