aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0055-Disable-explosion-knockback.patch
blob: eb665d21b149797727edb377127f271ec8a4eb0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From a2e155ea58f56fac11c16a6ea54faa60a35557c1 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:20:44 -0700
Subject: [PATCH] Disable explosion knockback


diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3c852fd..b0618e4 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -779,7 +779,10 @@ public abstract class EntityLiving extends Entity {
                     }
                 }
 
-                if (flag) {
+                // PaperSpigot start - Disable explosion knockback
+                boolean knockbackCancelled = false;
+                if (flag && !(knockbackCancelled = world.paperSpigotConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman)) {
+                // PaperSpigot end
                     this.world.broadcastEntityEffect(this, (byte) 2);
                     if (damagesource != DamageSource.DROWN) {
                         this.ac();
@@ -801,6 +804,8 @@ public abstract class EntityLiving extends Entity {
                     }
                 }
 
+                if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // PaperSpigot
+
                 String s;
 
                 if (this.getHealth() <= 0.0F) {
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index f6067ce..a60d3dd 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -141,7 +141,7 @@ public class Explosion {
                             continue;
                         }
                         // CraftBukkit end
-                        double d14 = EnchantmentProtection.a(entity, d13);
+                        double d14 = entity instanceof EntityHuman && world.paperSpigotConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a(entity, d13); // PaperSpigot
 
                         // PaperSpigot start - Fix cannons
                         /*
@@ -153,7 +153,7 @@ public class Explosion {
                         entity.g(d8 * d14, d9 * d14, d10 * d14);
                         // PaperSpigot end
 
-                        if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable) {
+                        if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable && !world.paperSpigotConfig.disableExplosionKnockback) { // PaperSpigot
                             this.k.put((EntityHuman) entity, new Vec3D(d8 * d13, d9 * d13, d10 * d13));
                         }
                     }
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 9ae1b18..b5bc358 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -360,4 +360,10 @@ public class PaperSpigotWorldConfig
         lavaFlowSpeedNormal = getInt( "lava-flow-speed.normal", 30 );
         lavaFlowSpeedNether = getInt( "lava-flow-speed.nether", 10 );
     }
+
+    public boolean disableExplosionKnockback;
+    private void disableExplosionKnockback()
+    {
+        disableExplosionKnockback = getBoolean( "disable-explosion-knockback", false );
+    }
 }
-- 
2.5.2