Search in sources :

Example 71 with EntityLiving

use of net.minecraft.server.v1_13_R2.EntityLiving in project Citizens2 by CitizensDev.

the class NMSImpl method setVerticalMovement.

@Override
public void setVerticalMovement(org.bukkit.entity.Entity bukkitEntity, double d) {
    if (!bukkitEntity.getType().isAlive())
        return;
    EntityLiving handle = NMSImpl.getHandle((LivingEntity) bukkitEntity);
    handle.aZ = (float) d;
}
Also used : EntityLiving(net.minecraft.server.v1_8_R3.EntityLiving)

Example 72 with EntityLiving

use of net.minecraft.server.v1_13_R2.EntityLiving in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method getEntityAsNBT.

@Override
public StackedEntityDataEntry<?> getEntityAsNBT(LivingEntity livingEntity) {
    NBTTagCompound nbt = new NBTTagCompound();
    EntityLiving nmsEntity = ((CraftLivingEntity) livingEntity).getHandle();
    nmsEntity.save(nbt);
    return new NBTStackedEntityDataEntry(nbt);
}
Also used : EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) NBTStackedEntityDataEntry(dev.rosewood.rosestacker.nms.v1_16_R3.storage.NBTStackedEntityDataEntry) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)

Example 73 with EntityLiving

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

the class ControlTarget method shouldStart.

@Override
public boolean shouldStart() {
    if (controlPathfinderGoal == null) {
        if (petEntity.getPathfinder().hasGoal("Control")) {
            controlPathfinderGoal = (Control) petEntity.getPathfinder().getGoal("Control");
        }
    }
    if (controlPathfinderGoal == null) {
        return false;
    }
    if (myPet.getDamage() <= 0 && myPet.getRangedDamage() <= 0) {
        return false;
    }
    if (controlPathfinderGoal.moveTo != null && petEntity.canMove()) {
        Behavior behaviorSkill = myPet.getSkills().get(Behavior.class);
        if (behaviorSkill.isActive()) {
            if (behaviorSkill.getBehavior() == BehaviorMode.Friendly) {
                return false;
            }
        }
        for (EntityLiving entityLiving : this.petEntity.world.a(EntityLiving.class, this.petEntity.getBoundingBox().grow((double) this.range, 4.0D, (double) this.range))) {
            if (entityLiving != petEntity && !(entityLiving instanceof EntityArmorStand)) {
                if (entityLiving instanceof EntityPlayer) {
                    Player targetPlayer = (Player) entityLiving.getBukkitEntity();
                    if (myPet.getOwner().equals(targetPlayer)) {
                        continue;
                    } else if (!MyPetApi.getHookHelper().canHurt(myPet.getOwner().getPlayer(), targetPlayer, true)) {
                        continue;
                    }
                } else if (entityLiving instanceof EntityTameableAnimal) {
                    EntityTameableAnimal tameable = (EntityTameableAnimal) entityLiving;
                    if (tameable.isTamed() && tameable.getOwner() != null) {
                        Player tameableOwner = (Player) tameable.getOwner().getBukkitEntity();
                        if (myPet.getOwner().equals(tameableOwner)) {
                            continue;
                        } else if (!MyPetApi.getHookHelper().canHurt(myPet.getOwner().getPlayer(), tameableOwner, true)) {
                            continue;
                        }
                    }
                } else if (entityLiving instanceof EntityMyPet) {
                    MyPet targetMyPet = ((EntityMyPet) entityLiving).getMyPet();
                    if (!MyPetApi.getHookHelper().canHurt(myPet.getOwner().getPlayer(), targetMyPet.getOwner().getPlayer(), true)) {
                        continue;
                    }
                }
                if (!MyPetApi.getHookHelper().canHurt(myPet.getOwner().getPlayer(), entityLiving.getBukkitEntity())) {
                    continue;
                }
                if (behaviorSkill != null) {
                    if (behaviorSkill.getBehavior() == BehaviorMode.Raid) {
                        if (entityLiving instanceof EntityTameableAnimal) {
                            continue;
                        } else if (entityLiving instanceof EntityMyPet) {
                            continue;
                        } else if (entityLiving instanceof EntityPlayer) {
                            continue;
                        }
                    }
                }
                controlPathfinderGoal.stopControl();
                this.target = entityLiving;
                return true;
            }
        }
    }
    return false;
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) EntityMyPet(de.Keyle.MyPet.compat.v1_8_R3.entity.EntityMyPet) EntityLiving(net.minecraft.server.v1_8_R3.EntityLiving) MyPet(de.Keyle.MyPet.api.entity.MyPet) EntityMyPet(de.Keyle.MyPet.compat.v1_8_R3.entity.EntityMyPet) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) EntityTameableAnimal(net.minecraft.server.v1_8_R3.EntityTameableAnimal) EntityArmorStand(net.minecraft.server.v1_8_R3.EntityArmorStand) Behavior(de.Keyle.MyPet.api.skill.skills.Behavior)

Example 74 with EntityLiving

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

Example 75 with EntityLiving

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

Aggregations

Player (org.bukkit.entity.Player)24 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 LivingEntity (org.bukkit.entity.LivingEntity)13 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)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