public void apply(LivingEntity target) { Player owner = myPet.getOwner().getPlayer(); isStriking = true; Location loc = target.getLocation(); MyPetApi.getPlatformHelper().strikeLightning(loc, 32); for (Entity entity : myPet.getEntity().get().getNearbyEntities(1.5, 1.5, 1.5)) { if (entity instanceof LivingEntity && entity != owner) { ((LivingEntity) entity).damage(damage.getValue().doubleValue(), myPet.getEntity().get()); } } isStriking = false; }
public void schedule() { if (selectedBehavior == Aggressive && random.nextBoolean() && myPet.getStatus() == MyPet.PetState.Here) { MyPetApi.getPlatformHelper().playParticleEffect(myPet.getLocation().get().add(0, myPet.getEntity().get().getEyeHeight(), 0), ParticleCompat.VILLAGER_ANGRY.get(), 0.2F, 0.2F, 0.2F, 0.5F, 1, 20); } }
public void schedule() { if (myPet.getStatus() == PetState.Here) { if (heal.getValue().doubleValue() > 0) { if (timeCounter-- <= 0) { if (myPet.getHealth() < myPet.getMaxHealth()) { if (!particles) { particles = true; myPet.getEntity().get().getHandle().showPotionParticles(Color.LIME); } myPet.getEntity().get().setHealth(myPet.getHealth() + heal.getValue().doubleValue()); } timeCounter = timer.getValue(); } else { particles = false; } } if (particles) { particles = false; myPet.getEntity().get().getHandle().hidePotionParticles(); } } else if (particles) { particles = false; } }
@Override public boolean shouldStart() { if (!this.myPet.getEntity().get().canMove()) { return false; } ControlImpl controlSkill = myPet.getSkills().get(ControlImpl.class); if (controlSkill == null || !controlSkill.getActive().getValue()) { return false; } return controlSkill.getLocation(false) != null; }
@Override public void apply(LivingEntity damager, EntityDamageByEntityEvent event) { if (damager instanceof Creeper) { return; } if (myPet.getEntity().isPresent()) { MyPetBukkitEntity entity = myPet.getEntity().get(); damager.damage(calculateReflectedDamage(event.getDamage()), entity); entity.getHandle().makeSound(SoundCompat.THORNS_HIT.get(), 0.2F, 1.0F); MyPetApi.getPlatformHelper().playParticleEffect(entity.getLocation().add(0, 1, 0), ParticleCompat.CRIT_MAGIC.get(), 0.5F, 0.5F, 0.5F, 0.1F, 20, 20); MyPetApi.getPlatformHelper().playParticleEffect(entity.getLocation().add(0, 1, 0), ParticleCompat.CRIT.get(), 0.5F, 0.5F, 0.5F, 0.1F, 10, 20); } }
public void apply(EntityDamageEvent event) { double redirectedDamage = calculateRedirectedDamage(event.getFinalDamage()); if (myPet.getStatus() == PetState.Here && myPet.getHealth() - redirectedDamage > 0) { myPet.getEntity().get().damage(redirectedDamage); event.setDamage(event.getDamage() - redirectedDamage); myPet.getEntity().get().getHandle().makeSound(SoundCompat.ENDERMAN_TELEPORT.get(), 0.2F, 1.0F); MyPetApi.getPlatformHelper().playParticleEffect(myPet.getOwner().getPlayer().getLocation().add(0, 1, 0), ParticleCompat.CRIT_MAGIC.get(), 0.5F, 0.5F, 0.5F, 0.1F, 20, 20); MyPetApi.getPlatformHelper().playParticleEffect(myPet.getLocation().get().add(0, 1, 0), ParticleCompat.CRIT.get(), 0.5F, 0.5F, 0.5F, 0.1F, 10, 20); } }
@Override public boolean shouldFinish() { if (!this.myPet.getEntity().get().canMove()) { return true; } ControlImpl controlSkill = myPet.getSkills().get(ControlImpl.class); if (!controlSkill.getActive().getValue()) { return true; } if (moveTo == null) { return true; } if (MyPetApi.getPlatformHelper().distance(myPet.getLocation().get(), moveTo) < 1) { return true; } if (timeToMove <= 0) { return true; } if (this.stopControl) { return true; } return false; }
for (Entity entity : myPet.getEntity().get().getNearbyEntities(range, range, range)) { if (!entity.isDead()) { if (entity instanceof Item) { int itemAmount = inv.addItem(itemStack); if (itemAmount == 0) { MyPetApi.getPlatformHelper().doPickupAnimation(myPet.getEntity().get(), itemEntity); myPet.getEntity().get().getHandle().makeSound(SoundCompat.ITEM_PICKUP.get(), 0.2F, 1.0F); itemStack.setAmount(0); itemEntity.remove(); ExperienceOrb expEntity = (ExperienceOrb) entity; myPet.getOwner().getPlayer().giveExp(expEntity.getExperience()); MyPetApi.getPlatformHelper().doPickupAnimation(myPet.getEntity().get(), expEntity); expEntity.setExperience(0); expEntity.remove();
if (!targetMyPet.getSkills().isActive(BehaviorImpl.class) || !targetMyPet.getEntity().get().canMove()) { continue;