Paper/Spigot-Server-Patches/0256-Configurable-sprint-interruption-on-attack.patch
Aikar 4f7a858bd6
Merge pull request #1248
c2d29a73 PlayerElytraBoostEvent (BillyGalbreath)

* pull/1248/head:
  PlayerElytraBoostEvent

Also merged paper config into parent
2018-07-23 20:29:55 -04:00

42 lines
1.9 KiB
Diff

From 2d83beeb89c8ab579c3069503d3a404cd87058c9 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 2ce60eb05..9daa8f66a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -398,4 +398,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 5015bd071..738ac8570 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1073,7 +1073,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.18.0