Search in sources :

Example 61 with EntityLiving

use of net.minecraft.server.v1_16_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.be = (float) d;
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving)

Example 62 with EntityLiving

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

the class NMSImpl method setKnockbackResistance.

@Override
public void setKnockbackResistance(LivingEntity entity, double d) {
    EntityLiving handle = NMSImpl.getHandle(entity);
    handle.getAttributeInstance(GenericAttributes.c).setValue(d);
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving)

Example 63 with EntityLiving

use of net.minecraft.server.v1_16_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 (getHandle() instanceof EntityLiving) {
        EntityLiving handle = (EntityLiving) getHandle();
        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 (!getHandle().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 64 with EntityLiving

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

the class NMSImpl method setKnockbackResistance.

@Override
public void setKnockbackResistance(LivingEntity entity, double d) {
    EntityLiving handle = NMSImpl.getHandle(entity);
    handle.getAttributeInstance(GenericAttributes.KNOCKBACK_RESISTANCE).setValue(d);
}
Also used : EntityLiving(net.minecraft.server.v1_15_R1.EntityLiving)

Example 65 with EntityLiving

use of net.minecraft.server.v1_16_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 (getHandle() instanceof EntityLiving) {
        EntityLiving handle = (EntityLiving) getHandle();
        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(TagsFluid.WATER) && !EnchantmentManager.h(handle)) {
            f /= 5.0F;
        }
    }
    if (!getHandle().onGround) {
        f /= 5.0F;
    }
    return f;
}
Also used : EntityLiving(net.minecraft.server.v1_15_R1.EntityLiving) ItemStack(net.minecraft.server.v1_15_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack)

Aggregations

Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)42 Player (org.bukkit.entity.Player)28 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)25 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)23 EntityLiving (net.minecraft.server.v1_8_R3.EntityLiving)23 MyPet (de.Keyle.MyPet.api.entity.MyPet)16 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)14 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)13 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)12 EntityLiving (net.minecraft.server.v1_9_R2.EntityLiving)12 LivingEntity (org.bukkit.entity.LivingEntity)12 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)11 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)11 SprintImpl (de.Keyle.MyPet.skill.skills.SprintImpl)10 EntityLiving (net.minecraft.server.v1_13_R2.EntityLiving)10 EntityLiving (net.minecraft.server.v1_14_R1.EntityLiving)10 CraftLivingEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)10 CraftLivingEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity)10 FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)9 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)9