SPIGOT-161: Don't apply velocity changes if we didn't damage on explosion.

This commit is contained in:
md_5 2015-01-25 10:45:02 +11:00
parent 0d52f683db
commit c8f17232cf

View File

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/Explosion.java 2014-11-28 17:43:43.189707433 +0000
+++ src/main/java/net/minecraft/server/Explosion.java 2014-11-28 17:38:22.000000000 +0000
--- ../work/decompile-8eb82bde/net/minecraft/server/Explosion.java 2015-01-25 10:44:43.764182684 +1100
+++ src/main/java/net/minecraft/server/Explosion.java 2015-01-25 10:44:43.768182687 +1100
@@ -8,6 +8,12 @@
import java.util.List;
import java.util.Map;
@ -49,22 +49,26 @@
hashset.add(blockposition);
}
@@ -112,7 +125,14 @@
@@ -112,7 +125,17 @@
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.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));
+ 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) {
+ continue;
+ }
+ // CraftBukkit end
+
double d14 = EnchantmentProtection.a(entity, d13);
entity.motX += d8 * d14;
@@ -140,6 +160,35 @@
@@ -140,6 +163,35 @@
BlockPosition blockposition;
if (this.b) {
@ -100,7 +104,7 @@
iterator = this.blocks.iterator();
while (iterator.hasNext()) {
@@ -170,7 +219,8 @@
@@ -170,7 +222,8 @@
if (block.getMaterial() != Material.AIR) {
if (block.a(this)) {
@ -110,7 +114,7 @@
}
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
@@ -184,8 +234,12 @@
@@ -184,8 +237,12 @@
while (iterator.hasNext()) {
blockposition = (BlockPosition) iterator.next();