Search in sources :

Example 26 with EntityLiving

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

the class NMSImpl method openHorseScreen.

@Override
public void openHorseScreen(Tameable horse, Player equipper) {
    EntityLiving handle = NMSImpl.getHandle((LivingEntity) horse);
    EntityLiving equipperHandle = NMSImpl.getHandle(equipper);
    if (handle == null || equipperHandle == null)
        return;
    boolean wasTamed = horse.isTamed();
    horse.setTamed(true);
    ((EntityHorseAbstract) handle).f((EntityHuman) equipperHandle);
    horse.setTamed(wasTamed);
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) EntityHorseAbstract(net.minecraft.server.v1_11_R1.EntityHorseAbstract)

Example 27 with EntityLiving

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

the class CitizensBlockBreaker method strengthMod.

private float strengthMod(IBlockData block) {
    ItemStack itemstack = getCurrentItem();
    float f = itemstack.a(block);
    if (entity instanceof EntityLiving) {
        EntityLiving handle = (EntityLiving) entity;
        if (f > 1.0F) {
            int i = EnchantmentManager.getDigSpeedEnchantmentLevel(handle);
            if (i > 0) {
                f += i * i + 1;
            }
        }
        if (handle.hasEffect(MobEffects.FASTER_DIG)) {
            f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
        }
        if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
            float f1 = 1.0F;
            switch(handle.getEffect(MobEffects.SLOWER_DIG).getAmplifier()) {
                case 0:
                    f1 = 0.3F;
                    break;
                case 1:
                    f1 = 0.09F;
                    break;
                case 2:
                    f1 = 0.0027F;
                    break;
                case 3:
                default:
                    f1 = 8.1E-4F;
            }
            f *= f1;
        }
        if ((handle.a(Material.WATER)) && (!EnchantmentManager.i(handle))) {
            f /= 5.0F;
        }
    }
    if (!entity.onGround) {
        f /= 5.0F;
    }
    return f;
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) CraftItemStack(org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_11_R1.ItemStack)

Example 28 with EntityLiving

use of net.minecraft.server.v1_9_R2.EntityLiving in project Ublisk by Derkades.

the class V1_12_R1 method setTargetToClosestPlayer.

@Override
public void setTargetToClosestPlayer(Creature creature, Player player) {
    CraftLivingEntity craftLiving = (CraftLivingEntity) player;
    EntityLiving entityLiving = craftLiving.getHandle();
    ((CraftCreature) creature).getHandle().setGoalTarget(entityLiving, TargetReason.CLOSEST_PLAYER, false);
}
Also used : EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) CraftLivingEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)

Example 29 with EntityLiving

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

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

Aggregations

EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)14 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)12 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)10 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)10 MyPet (de.Keyle.MyPet.api.entity.MyPet)9 Behavior (de.Keyle.MyPet.skill.skills.Behavior)9 Player (org.bukkit.entity.Player)9 EntityLiving (net.minecraft.server.v1_9_R1.EntityLiving)5 LivingEntity (org.bukkit.entity.LivingEntity)5 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)3 EntityHuman (net.minecraft.server.v1_12_R1.EntityHuman)3 EntityLiving (net.minecraft.server.v1_7_R4.EntityLiving)3 EntityHumanNPC (net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)2 AttributeInstance (net.minecraft.server.v1_10_R1.AttributeInstance)2 EntityArmorStand (net.minecraft.server.v1_10_R1.EntityArmorStand)2 EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)2 AttributeInstance (net.minecraft.server.v1_11_R1.AttributeInstance)2 Entity (net.minecraft.server.v1_11_R1.Entity)2 EntityArmorStand (net.minecraft.server.v1_11_R1.EntityArmorStand)2 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)2