Search in sources :

Example 76 with EntityLiving

use of net.minecraft.server.v1_16_R2.EntityLiving in project MyPet by xXKeyleXx.

the class BehaviorFarmTarget method shouldFinish.

@Override
public boolean shouldFinish() {
    if (!petEntity.canMove()) {
        return true;
    }
    if (!this.petEntity.hasTarget()) {
        return true;
    }
    EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();
    if (!target.isAlive()) {
        return true;
    }
    Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
    if (behaviorSkill.getBehavior() != BehaviorMode.Farm) {
        return true;
    } else if (myPet.getDamage() <= 0 && myPet.getRangedDamage() <= 0) {
        return true;
    } else if (target.world != petEntity.world) {
        return true;
    } else if (petEntity.h(target) > 400) {
        return true;
    } else
        return petEntity.h(((CraftPlayer) petEntity.getOwner().getPlayer()).getHandle()) > 600;
}
Also used : EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 77 with EntityLiving

use of net.minecraft.server.v1_16_R2.EntityLiving in project MyPet by xXKeyleXx.

the class Sprint method shouldStart.

@Override
public boolean shouldStart() {
    if (!myPet.getSkills().isActive(SprintImpl.class)) {
        return false;
    }
    if (petEntity.getMyPet().getDamage() <= 0) {
        return false;
    }
    if (!this.petEntity.hasTarget()) {
        return false;
    }
    EntityLiving targetEntity = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).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_R2.EntityLiving) SprintImpl(de.Keyle.MyPet.skill.skills.SprintImpl) CraftLivingEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity)

Example 78 with EntityLiving

use of net.minecraft.server.v1_16_R2.EntityLiving in project MyPet by xXKeyleXx.

the class BehaviorFarmTarget method shouldFinish.

@Override
public boolean shouldFinish() {
    if (!petEntity.canMove()) {
        return true;
    }
    if (!this.petEntity.hasTarget()) {
        return true;
    }
    EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();
    if (!target.isAlive()) {
        return true;
    }
    Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
    if (behaviorSkill.getBehavior() != BehaviorMode.Farm) {
        return true;
    } else if (myPet.getDamage() <= 0 && myPet.getRangedDamage() <= 0) {
        return true;
    } else if (target.world != petEntity.world) {
        return true;
    } else if (petEntity.h(target) > 400) {
        return true;
    } else if (petEntity.h(((CraftPlayer) petEntity.getOwner().getPlayer()).getHandle()) > 600) {
        return true;
    }
    return false;
}
Also used : EntityLiving(net.minecraft.server.v1_9_R2.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 79 with EntityLiving

use of net.minecraft.server.v1_16_R2.EntityLiving 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 80 with EntityLiving

use of net.minecraft.server.v1_16_R2.EntityLiving 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)

Aggregations

Player (org.bukkit.entity.Player)23 Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)21 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)18 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)18 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)17 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)14 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)12 LivingEntity (org.bukkit.entity.LivingEntity)12 MyPet (de.Keyle.MyPet.api.entity.MyPet)11 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)11 EntityLiving (net.minecraft.server.v1_13_R2.EntityLiving)10 EntityLiving (net.minecraft.server.v1_14_R1.EntityLiving)10 FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)9 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)8 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)7 Behavior (de.Keyle.MyPet.skill.skills.Behavior)6 SprintImpl (de.Keyle.MyPet.skill.skills.SprintImpl)5 EntityLiving (net.minecraft.server.v1_16_R1.EntityLiving)5 EntityLiving (net.minecraft.server.v1_9_R1.EntityLiving)5 EntityLiving (net.minecraft.server.v1_9_R2.EntityLiving)5