aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0249-Configurable-sprint-interruption-on-attack.patch
blob: 5d541c0c0bc1ac30ef20ef7c677f5fd30897f8f9 (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
From 5d95bb06af5610d1e5d9c5bc549e8b928af7fcfa Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sat, 14 Apr 2018 20:20:46 +0200
Subject: [PATCH] Configurable sprint interruption on attack

If the sprint interruption is disabled players continue sprinting when they attack entities.

diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index f68b8a4b0..6fb76388e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -423,4 +423,9 @@ public class PaperWorldConfig {
     private void squidMaxSpawnHeight() {
         squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
     }
+
+    public boolean disableSprintInterruptionOnAttack;
+    private void disableSprintInterruptionOnAttack() {
+        disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 7f29d1277..d4618d644 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1081,7 +1081,11 @@ public abstract class EntityHuman extends EntityLiving {
 
                             this.motX *= 0.6D;
                             this.motZ *= 0.6D;
-                            this.setSprinting(false);
+                            // Paper start - Configuration option to disable automatic sprint interruption
+                            if (!world.paperConfig.disableSprintInterruptionOnAttack) {
+                                this.setSprinting(false);
+                            }
+                            // Paper end
                         }
 
                         if (flag3) {
-- 
2.21.0