use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.
the class BehaviorDuelTarget method shouldFinish.
@Override
public boolean shouldFinish() {
if (!petEntity.canMove()) {
return true;
} else if (!petEntity.hasTarget()) {
return true;
}
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();
Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
if (behaviorSkill.getBehavior() != BehaviorMode.Duel) {
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;
}
use of org.bukkit.craftbukkit.v1_15_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.getMyPetTarget()).getHandle();
if (target instanceof EntityArmorStand) {
return false;
}
double meleeDamage = myPet.getDamage();
if (meleeDamage > 0 && this.entityMyPet.g(target.locX(), target.getBoundingBox().minY, target.locZ()) < 4) {
Ranged rangedSkill = myPet.getSkills().get(Ranged.class);
if (meleeDamage > rangedSkill.getDamage().getValue().doubleValue()) {
return false;
}
}
de.Keyle.MyPet.api.skill.skills.Behavior behaviorSkill = myPet.getSkills().get(de.Keyle.MyPet.api.skill.skills.Behavior.class);
if (behaviorSkill != null && behaviorSkill.isActive()) {
if (behaviorSkill.getBehavior() == de.Keyle.MyPet.api.skill.skills.Behavior.BehaviorMode.Friendly) {
return false;
}
if (behaviorSkill.getBehavior() == Behavior.BehaviorMode.Raid) {
if (target instanceof EntityTameableAnimal && ((EntityTameableAnimal) target).isTamed()) {
return false;
}
if (target instanceof EntityMyPet) {
return false;
}
if (target instanceof EntityPlayer) {
return false;
}
}
}
this.target = target;
return true;
}
use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.
the class BehaviorDuelTarget method shouldFinish.
@Override
public boolean shouldFinish() {
if (!petEntity.canMove()) {
return true;
} else if (!petEntity.hasTarget()) {
return true;
}
EntityLiving target = ((CraftLivingEntity) this.petEntity.getMyPetTarget()).getHandle();
Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
if (behaviorSkill.getBehavior() != BehaviorMode.Duel) {
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;
}
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().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;
}
use of org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity in project MyPet by xXKeyleXx.
the class BehaviorAggressiveTarget method shouldFinish.
@Override
public boolean shouldFinish() {
if (!petEntity.canMove()) {
return true;
} else if (petEntity.getMyPetTarget() == null) {
return true;
}
EntityLiving target = ((CraftLivingEntity) petEntity.getMyPetTarget()).getHandle();
if (!target.isAlive()) {
return true;
}
Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
if (behaviorSkill.getBehavior() != BehaviorMode.Aggressive) {
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;
}
Aggregations