Search in sources :

Example 31 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.

the class MeleeAttack method shouldStart.

@Override
public boolean shouldStart() {
    if (myPet.getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();
    if (targetEntity instanceof EntityArmorStand) {
        return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ) >= 20) {
        return false;
    }
    Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
    if (behaviorSkill != null && behaviorSkill.isActive()) {
        if (behaviorSkill.getBehavior() == Behavior.BehaviorMode.Friendly) {
            return false;
        }
        if (behaviorSkill.getBehavior() == Behavior.BehaviorMode.Raid) {
            if (targetEntity instanceof EntityTameableAnimal && ((EntityTameableAnimal) targetEntity).isTamed()) {
                return false;
            }
            if (targetEntity instanceof EntityMyPet) {
                return false;
            }
            if (targetEntity instanceof EntityPlayer) {
                return false;
            }
        }
    }
    this.targetEntity = targetEntity;
    return true;
}
Also used : EntityMyPet(de.Keyle.MyPet.compat.v1_8_R3.entity.EntityMyPet) EntityLiving(net.minecraft.server.v1_8_R3.EntityLiving) EntityTameableAnimal(net.minecraft.server.v1_8_R3.EntityTameableAnimal) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity) EntityArmorStand(net.minecraft.server.v1_8_R3.EntityArmorStand) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 32 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.

the class MeleeAttack method shouldStart.

@Override
public boolean shouldStart() {
    if (myPet.getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
    if (targetEntity instanceof EntityArmorStand) {
        return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ) >= 20) {
        return false;
    }
    this.targetEntity = targetEntity;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_10_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftLivingEntity) EntityArmorStand(net.minecraft.server.v1_10_R1.EntityArmorStand)

Example 33 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.

the class Sprint method shouldStart.

@Override
public boolean shouldStart() {
    if (!myPet.getSkills().isSkillActive(de.Keyle.MyPet.skill.skills.Sprint.class)) {
        return false;
    }
    if (petEntity.getMyPet().getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
    if (!targetEntity.isAlive()) {
        return false;
    }
    if (lastTarget == targetEntity) {
        return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.h(targetEntity) >= 16) {
        return false;
    }
    this.lastTarget = targetEntity;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_10_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftLivingEntity)

Example 34 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.

the class MeleeAttack method shouldStart.

@Override
public boolean shouldStart() {
    if (myPet.getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
    if (targetEntity instanceof EntityArmorStand) {
        return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ) >= 20) {
        return false;
    }
    this.targetEntity = targetEntity;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_8_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity) EntityArmorStand(net.minecraft.server.v1_8_R1.EntityArmorStand)

Example 35 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.

the class MeleeAttack method shouldStart.

@Override
public boolean shouldStart() {
    if (myPet.getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getTarget()).getHandle();
    if (targetEntity instanceof EntityArmorStand) {
        return false;
    }
    if (petEntity.getMyPet().getRangedDamage() > 0 && this.petEntity.f(targetEntity.locX, targetEntity.getBoundingBox().b, targetEntity.locZ) >= 20) {
        return false;
    }
    this.targetEntity = targetEntity;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_8_R2.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_8_R2.entity.CraftLivingEntity) EntityArmorStand(net.minecraft.server.v1_8_R2.EntityArmorStand)

Aggregations

Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)35 Ranged (de.Keyle.MyPet.api.skill.skills.Ranged)7 SprintImpl (de.Keyle.MyPet.skill.skills.SprintImpl)7 CraftLivingEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)7 LivingEntity (net.minecraft.world.entity.LivingEntity)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R1.entity.CraftLivingEntity)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_17_R1.entity.CraftLivingEntity)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity)6 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)5 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)5 CraftLivingEntity (org.bukkit.craftbukkit.v1_18_R1.entity.CraftLivingEntity)5 ServerPlayer (net.minecraft.server.level.ServerPlayer)4 EntityLiving (net.minecraft.server.v1_16_R1.EntityLiving)4 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)4 EntityLiving (net.minecraft.server.v1_9_R2.EntityLiving)4 TamableAnimal (net.minecraft.world.entity.TamableAnimal)4 ArmorStand (net.minecraft.world.entity.decoration.ArmorStand)4 EntityLiving (net.minecraft.server.v1_7_R4.EntityLiving)3