SPIGOT-636: Decouple EntityCombustByEntity from damageEntity

This commit is contained in:
md_5 2016-05-28 22:10:59 +10:00
parent 106ced01e0
commit 71e5248c8b

View File

@ -30,28 +30,22 @@
if (entity != null) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int i = MathHelper.f((double) f * this.damage);
@@ -246,11 +253,18 @@
damagesource = DamageSource.arrow(this, this.shooter);
@@ -247,7 +254,13 @@
}
+ // CraftBukkit start - Moved damage call
+ if (movingobjectposition.entity.damageEntity(damagesource, (float) i)) {
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
- entity.setOnFire(5);
+ // CraftBukkit start
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+ if (!combustEvent.isCancelled()) {
+ entity.setOnFire(combustEvent.getDuration());
+ }
+ // CraftBukkit end
+ // CraftBukkit end
}
- if (entity.damageEntity(damagesource, (float) i)) {
+ // if (entity.damageEntity(damagesource, (float) i)) { // CraftBukkit - moved up
if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
@@ -397,6 +411,20 @@
if (entity.damageEntity(damagesource, (float) i)) {
@@ -397,6 +410,20 @@
public void d(EntityHuman entityhuman) {
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
@ -72,7 +66,7 @@
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
@@ -455,6 +483,12 @@
@@ -455,6 +482,12 @@
return (b0 & 1) != 0;
}