Search in sources :

Example 1 with DamageSource

use of net.minecraft.server.v1_14_R1.DamageSource in project MechanicsMain by WeaponMechanics.

the class v1_9_R2 method logDamage.

@Override
public void logDamage(LivingEntity victim, LivingEntity source, double health, double damage, boolean isMelee) {
    DamageSource damageSource;
    if (isMelee) {
        if (source instanceof Player) {
            damageSource = DamageSource.playerAttack(((org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) source).getHandle());
        } else {
            damageSource = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
        }
    } else {
        damageSource = DamageSource.projectile(null, ((CraftLivingEntity) source).getHandle());
    }
    EntityLiving nms = ((CraftLivingEntity) victim).getHandle();
    nms.combatTracker.trackDamage(damageSource, (float) damage, (float) health);
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) DamageSource(net.minecraft.server.v1_9_R2.DamageSource) EntityLiving(net.minecraft.server.v1_9_R2.EntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftLivingEntity)

Example 2 with DamageSource

use of net.minecraft.server.v1_14_R1.DamageSource in project MechanicsMain by WeaponMechanics.

the class v1_11_R1 method logDamage.

@Override
public void logDamage(LivingEntity victim, LivingEntity source, double health, double damage, boolean isMelee) {
    DamageSource damageSource;
    if (isMelee) {
        if (source instanceof Player) {
            damageSource = DamageSource.playerAttack(((org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) source).getHandle());
        } else {
            damageSource = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
        }
    } else {
        damageSource = DamageSource.projectile(null, ((CraftLivingEntity) source).getHandle());
    }
    EntityLiving nms = ((CraftLivingEntity) victim).getHandle();
    nms.combatTracker.trackDamage(damageSource, (float) damage, (float) health);
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) DamageSource(net.minecraft.server.v1_11_R1.DamageSource) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftLivingEntity)

Example 3 with DamageSource

use of net.minecraft.server.v1_14_R1.DamageSource in project MechanicsMain by WeaponMechanics.

the class v1_12_R1 method logDamage.

@Override
public void logDamage(LivingEntity victim, LivingEntity source, double health, double damage, boolean isMelee) {
    DamageSource damageSource;
    if (isMelee) {
        if (source instanceof Player) {
            damageSource = DamageSource.playerAttack(((org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) source).getHandle());
        } else {
            damageSource = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
        }
    } else {
        damageSource = DamageSource.projectile(null, ((CraftLivingEntity) source).getHandle());
    }
    EntityLiving nms = ((CraftLivingEntity) victim).getHandle();
    nms.combatTracker.trackDamage(damageSource, (float) damage, (float) health);
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) DamageSource(net.minecraft.server.v1_12_R1.DamageSource) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)

Example 4 with DamageSource

use of net.minecraft.server.v1_14_R1.DamageSource in project MechanicsMain by WeaponMechanics.

the class v1_13_R2 method logDamage.

@Override
public void logDamage(LivingEntity victim, LivingEntity source, double health, double damage, boolean isMelee) {
    DamageSource damageSource;
    if (isMelee) {
        if (source instanceof Player) {
            damageSource = DamageSource.playerAttack(((org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) source).getHandle());
        } else {
            damageSource = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
        }
    } else {
        damageSource = DamageSource.projectile(null, ((CraftLivingEntity) source).getHandle());
    }
    EntityLiving nms = ((CraftLivingEntity) victim).getHandle();
    nms.combatTracker.trackDamage(damageSource, (float) damage, (float) health);
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) Player(org.bukkit.entity.Player) DamageSource(net.minecraft.server.v1_13_R2.DamageSource) EntityLiving(net.minecraft.server.v1_13_R2.EntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_13_R2.entity.CraftLivingEntity)

Example 5 with DamageSource

use of net.minecraft.server.v1_14_R1.DamageSource in project MechanicsMain by WeaponMechanics.

the class v1_14_R1 method logDamage.

@Override
public void logDamage(LivingEntity victim, LivingEntity source, double health, double damage, boolean isMelee) {
    DamageSource damageSource;
    if (isMelee) {
        if (source instanceof Player) {
            damageSource = DamageSource.playerAttack(((org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) source).getHandle());
        } else {
            damageSource = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
        }
    } else {
        damageSource = DamageSource.projectile(null, ((CraftLivingEntity) source).getHandle());
    }
    EntityLiving nms = ((CraftLivingEntity) victim).getHandle();
    nms.combatTracker.trackDamage(damageSource, (float) damage, (float) health);
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) DamageSource(net.minecraft.server.v1_14_R1.DamageSource) EntityLiving(net.minecraft.server.v1_14_R1.EntityLiving) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) CraftLivingEntity(org.bukkit.craftbukkit.v1_14_R1.entity.CraftLivingEntity)

Aggregations

Player (org.bukkit.entity.Player)9 DamageSource (net.minecraft.server.v1_12_R1.DamageSource)2 DamageSource (net.minecraft.server.v1_15_R1.DamageSource)2 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)2 CraftLivingEntity (org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity)2 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)2 DamageSource (net.minecraft.server.v1_10_R1.DamageSource)1 EntityLiving (net.minecraft.server.v1_10_R1.EntityLiving)1 DamageSource (net.minecraft.server.v1_11_R1.DamageSource)1 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)1 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)1 DamageSource (net.minecraft.server.v1_13_R2.DamageSource)1 EntityLiving (net.minecraft.server.v1_13_R2.EntityLiving)1 DamageSource (net.minecraft.server.v1_14_R1.DamageSource)1 EntityLiving (net.minecraft.server.v1_14_R1.EntityLiving)1 EntityPlayer (net.minecraft.server.v1_15_R1.EntityPlayer)1 PacketPlayOutAnimation (net.minecraft.server.v1_15_R1.PacketPlayOutAnimation)1 DamageSource (net.minecraft.server.v1_16_R3.DamageSource)1 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)1 DamageSource (net.minecraft.server.v1_9_R2.DamageSource)1