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