SPIGOT-949: Fix damage cooldown reducing explosion knockback

By: Jedediah Smith <jedediah@silencegreys.com>
This commit is contained in:
CraftBukkit/Spigot
2015-08-31 18:06:13 +10:00
parent 280ae804ee
commit fb04f93364
3 changed files with 44 additions and 38 deletions

View File

@@ -49,23 +49,24 @@
hashset.add(blockposition);
}
@@ -112,7 +125,14 @@
@@ -112,7 +125,15 @@
double d12 = (double) this.world.a(vec3d, entity.getBoundingBox());
double d13 = (1.0D - d7) * d12;
- entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));
+ // entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));+ // CraftBukkit start
+ CraftEventFactory.entityDamage = source;
+ entity.forceExplosionKnockback = false;
+ boolean wasDamaged = entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));
+ CraftEventFactory.entityDamage = null;
+ if (!wasDamaged && !(entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock)) {
+ if (!wasDamaged && !(entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) && !entity.forceExplosionKnockback) {
+ continue;
+ }
+ // CraftBukkit end
double d14 = EnchantmentProtection.a(entity, d13);
entity.motX += d8 * d14;
@@ -140,6 +160,50 @@
@@ -140,6 +161,50 @@
BlockPosition blockposition;
if (this.b) {
@@ -116,7 +117,7 @@
iterator = this.blocks.iterator();
while (iterator.hasNext()) {
@@ -170,7 +234,8 @@
@@ -170,7 +235,8 @@
if (block.getMaterial() != Material.AIR) {
if (block.a(this)) {
@@ -126,7 +127,7 @@
}
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
@@ -185,7 +250,11 @@
@@ -185,7 +251,11 @@
while (iterator.hasNext()) {
blockposition = (BlockPosition) iterator.next();
if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getType(blockposition.down()).getBlock().o() && this.c.nextInt(3) == 0) {
@@ -139,7 +140,7 @@
}
}
}
@@ -197,7 +266,9 @@
@@ -197,7 +267,9 @@
}
public EntityLiving getSource() {