Search in sources :

Example 6 with MyPetBukkitEntity

use of de.Keyle.MyPet.api.entity.MyPetBukkitEntity in project MyPet by xXKeyleXx.

the class Thorns method reflectDamage.

public void reflectDamage(LivingEntity damager, double damage) {
    if (myPet.getEntity().isPresent()) {
        MyPetBukkitEntity entity = myPet.getEntity().get();
        damager.damage(getReflectedDamage(damage), entity);
        if (MyPetApi.getCompatUtil().compareWithMinecraftVersion("1.9") >= 0) {
            entity.getHandle().makeSound("enchant.thorns.hit", 0.2F, 1.0F);
        } else {
            entity.getHandle().makeSound("damage.thorns", 0.5F, 1.0F);
        }
        MyPetApi.getPlatformHelper().playParticleEffect(entity.getLocation().add(0, 1, 0), "CRIT_MAGIC", 0.5F, 0.5F, 0.5F, 0.1F, 20, 20);
        MyPetApi.getPlatformHelper().playParticleEffect(entity.getLocation().add(0, 1, 0), "CRIT", 0.5F, 0.5F, 0.5F, 0.1F, 10, 20);
    }
}
Also used : MyPetBukkitEntity(de.Keyle.MyPet.api.entity.MyPetBukkitEntity)

Aggregations

MyPetBukkitEntity (de.Keyle.MyPet.api.entity.MyPetBukkitEntity)6 PacketAdapter (com.comphenix.protocol.events.PacketAdapter)3 PacketContainer (com.comphenix.protocol.events.PacketContainer)3 PacketEvent (com.comphenix.protocol.events.PacketEvent)3 Entity (org.bukkit.entity.Entity)3 MyPet (de.Keyle.MyPet.api.entity.MyPet)2 WrappedDataWatcher (com.comphenix.protocol.wrappers.WrappedDataWatcher)1 WrappedWatchableObject (com.comphenix.protocol.wrappers.WrappedWatchableObject)1 MyPetBaby (de.Keyle.MyPet.api.entity.MyPetBaby)1 SkillInfo (de.Keyle.MyPet.api.skill.SkillInfo)1 SkillTree (de.Keyle.MyPet.api.skill.skilltree.SkillTree)1 SkillTreeLevel (de.Keyle.MyPet.api.skill.skilltree.SkillTreeLevel)1 SpiralAnimation (de.Keyle.MyPet.api.util.animation.particle.SpiralAnimation)1 EntityLocationHolder (de.Keyle.MyPet.api.util.location.EntityLocationHolder)1 Method (java.lang.reflect.Method)1 EnumMap (java.util.EnumMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 DyeColor (org.bukkit.DyeColor)1 Location (org.bukkit.Location)1