aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0210-Configurable-sprint-interruption-on-attack.patch
blob: cb50a1f5d1b09ef15c4e1f4ddd2638eff62f66d0 (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
From 0000000000000000000000000000000000000000 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 3804c7cf96087cdf94fd5fbdce4ebcdafa9e0019..873f81c74a94f6d76edd45e34ddc476dc525b47c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -351,4 +351,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 74950d74e6a11d5552369e830f9fdd63c4306221..e05e56f464c643925abfdf04bd745e3932ca001d 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1091,7 +1091,11 @@ public abstract class EntityHuman extends EntityLiving {
                             }
 
                             this.setMot(this.getMot().d(0.6D, 1.0D, 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) {