use of net.minecraft.server.v1_12_R1.DamageSource in project Village_Defense by Plajer.
the class GolemBuster method damageEntity.
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
if (damagesource != null && damagesource.getEntity() != null && damagesource.getEntity().getBukkitEntity().getType() == EntityType.IRON_GOLEM) {
this.die();
this.die();
org.bukkit.inventory.ItemStack[] itemStack = new org.bukkit.inventory.ItemStack[] { new org.bukkit.inventory.ItemStack(org.bukkit.Material.ROTTEN_FLESH) };
Bukkit.getServer().getPluginManager().callEvent(new EntityDeathEvent((LivingEntity) this.getBukkitEntity(), Arrays.asList(itemStack), expToDrop));
IronGolem golem = (IronGolem) damagesource.getEntity().getBukkitEntity();
// golem.getWorld().createExplosion(golem.getLocation(), 4);
org.bukkit.entity.Entity primed = golem.getWorld().spawnEntity(golem.getLocation(), EntityType.PRIMED_TNT);
return true;
} else {
super.damageEntity(damagesource, f);
return false;
}
}
use of net.minecraft.server.v1_12_R1.DamageSource in project Village_Defense by Plajer.
the class PlayerBuster method damageEntity.
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
if (damagesource != null && damagesource.getEntity() != null && damagesource.getEntity().getBukkitEntity().getType() == EntityType.PLAYER) {
ItemStack[] itemStack = new ItemStack[] { new ItemStack(Material.ROTTEN_FLESH) };
Bukkit.getServer().getPluginManager().callEvent(new EntityDeathEvent((LivingEntity) this.getBukkitEntity(), Arrays.asList(itemStack), expToDrop));
Player player = (Player) damagesource.getEntity().getBukkitEntity();
getBukkitEntity().getWorld().spawnEntity(getBukkitEntity().getLocation(), EntityType.PRIMED_TNT);
this.die();
return true;
} else {
super.damageEntity(damagesource, f);
return false;
}
}
use of net.minecraft.server.v1_12_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);
}
use of net.minecraft.server.v1_12_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);
}
use of net.minecraft.server.v1_12_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);
}
Aggregations