Search in sources :

Example 26 with EntityLiving

use of net.minecraft.server.v1_8_R3.EntityLiving in project Village_Defense by Plajer.

the class RidableIronGolem method g.

@Override
public void g(float f, float f1) {
    EntityLiving entityliving = (EntityLiving) bw();
    if (entityliving == null) {
        // search first human passenger
        for (final Entity e : passengers) {
            if (e instanceof EntityHuman) {
                entityliving = (EntityLiving) e;
                break;
            }
        }
        if (entityliving == null) {
            this.l((float) 0.12);
            super.g(f, f1);
            return;
        }
    }
    this.lastYaw = this.yaw = entityliving.yaw;
    this.pitch = entityliving.pitch * 0.5F;
    this.setYawPitch(this.yaw, this.pitch);
    this.aQ = this.aO = this.yaw;
    f = entityliving.be * 0.75F;
    f1 = entityliving.bf;
    if (f1 <= 0.0f) {
        f1 *= 0.25F;
    }
    this.l((float) 0.12);
    super.g(f, f1);
    P = (float) 1.0;
}
Also used : Entity(net.minecraft.server.v1_11_R1.Entity) EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving)

Example 27 with EntityLiving

use of net.minecraft.server.v1_8_R3.EntityLiving in project Village_Defense by Plajer.

the class RidableIronGolem method a.

public void a(float f, float f1, float f2) {
    EntityLiving entityliving = null;
    for (final Entity e : passengers) {
        if (e instanceof EntityHuman) {
            entityliving = (EntityLiving) e;
            break;
        }
    }
    if (entityliving == null) {
        this.P = 0.5F;
        this.aR = 0.02F;
        this.k((float) 0.12);
        super.a(f, f1, f2);
        return;
    }
    this.lastYaw = this.yaw = entityliving.yaw;
    this.pitch = entityliving.pitch * 0.5F;
    this.setYawPitch(this.yaw, this.pitch);
    this.aO = this.aM = this.yaw;
    f = entityliving.be * 0.5F * 0.75F;
    f2 = entityliving.bg;
    if (f2 <= 0.0f) {
        f2 *= 0.25F;
    }
    k(0.12f);
    super.a(f, f1, f2);
    P = (float) 1.0;
}
Also used : Entity(net.minecraft.server.v1_12_R1.Entity) EntityHuman(net.minecraft.server.v1_12_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving)

Example 28 with EntityLiving

use of net.minecraft.server.v1_8_R3.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_12_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 29 with EntityLiving

use of net.minecraft.server.v1_8_R3.EntityLiving 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;
}
Also used : EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 30 with EntityLiving

use of net.minecraft.server.v1_8_R3.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_16_R1.EntityLiving) SprintImpl(de.Keyle.MyPet.skill.skills.SprintImpl) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R1.entity.CraftLivingEntity)

Aggregations

Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)21 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)16 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)13 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)12 MyPet (de.Keyle.MyPet.api.entity.MyPet)11 Player (org.bukkit.entity.Player)11 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)10 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 CraftLivingEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)5 CraftLivingEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity)5 LivingEntity (org.bukkit.entity.LivingEntity)5 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)4 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)4 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R1.entity.CraftLivingEntity)4 CraftPlayer (org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer)4 CraftLivingEntity (org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity)4