Search in sources :

Example 1 with CraftLivingEntity

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

the class RangedAttack method shouldStart.

@Override
public boolean shouldStart() {
    if (myPet.getRangedDamage() <= 0) {
        return false;
    }
    if (!entityMyPet.canMove()) {
        return false;
    }
    if (!entityMyPet.hasTarget()) {
        return false;
    }
    EntityLiving target = ((CraftLivingEntity) this.entityMyPet.getTarget()).getHandle();
    double meleeDamage = myPet.getDamage();
    if (meleeDamage > 0 && this.entityMyPet.f(target.locX, target.boundingBox.b, target.locZ) < 4) {
        if (meleeDamage > rangedSkill.getDamage()) {
            return false;
        }
    }
    this.target = target;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_7_R4.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity)

Example 2 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_14_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.f(targetEntity) >= 16) {
        return false;
    }
    this.lastTarget = targetEntity;
    return true;
}
Also used : EntityLiving(net.minecraft.server.v1_7_R4.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity)

Example 3 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_14_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_8_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity)

Example 4 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_14_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_9_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity) EntityArmorStand(net.minecraft.server.v1_9_R1.EntityArmorStand)

Example 5 with CraftLivingEntity

use of org.bukkit.craftbukkit.v1_14_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_9_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)

Aggregations

Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)35 CraftLivingEntity (org.bukkit.craftbukkit.v1_18_R1.entity.CraftLivingEntity)13 CraftLivingEntity (org.bukkit.craftbukkit.v1_17_R1.entity.CraftLivingEntity)12 Player (org.bukkit.entity.Player)12 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)11 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)8 LivingEntity (net.minecraft.world.entity.LivingEntity)8 CraftLivingEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)8 LivingEntity (org.bukkit.entity.LivingEntity)8 Ranged (de.Keyle.MyPet.api.skill.skills.Ranged)7 SprintImpl (de.Keyle.MyPet.skill.skills.SprintImpl)7 CraftLivingEntity (org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity)7 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)6 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R1.entity.CraftLivingEntity)6 Set (java.util.Set)5 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)5 EntityLiving (net.minecraft.server.v1_9_R2.EntityLiving)5 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)5 EntityLiving (net.minecraft.server.v1_16_R1.EntityLiving)4 CraftLivingEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity)4