From 5a528af05e0a629d52732cdb41c372a81c0320c2 Mon Sep 17 00:00:00 2001 From: Brokkonaut 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. --- .../world/entity/player/Player.java.patch | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch index 3e7a7ee249..e4d2287ab8 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -278,7 +278,19 @@ if (flag2) { f *= 1.5F; } -@@ -1223,8 +1295,13 @@ +@@ -1208,7 +1280,11 @@ + } + + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); ++ // Paper start - Configurable sprint interruption on attack ++ if (!this.level().paperConfig().misc.disableSprintInterruptionOnAttack) { + this.setSprinting(false); ++ } ++ // Paper end - Configurable sprint interruption on attack + } + + LivingEntity entityliving2; +@@ -1223,8 +1299,13 @@ if (entityliving2 != this && entityliving2 != target && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof ArmorStand) || !((ArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) { float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2; @@ -293,7 +305,7 @@ Level world = this.level(); if (world instanceof ServerLevel) { -@@ -1235,26 +1312,43 @@ +@@ -1235,26 +1316,43 @@ } } @@ -341,7 +353,7 @@ } } -@@ -1308,9 +1402,14 @@ +@@ -1308,9 +1406,14 @@ } } @@ -358,7 +370,7 @@ } } -@@ -1351,7 +1450,14 @@ +@@ -1351,7 +1454,14 @@ @Override public void remove(Entity.RemovalReason reason) { @@ -374,7 +386,7 @@ this.inventoryMenu.removed(this); if (this.containerMenu != null && this.hasContainerOpen()) { this.doCloseContainer(); -@@ -1391,7 +1497,13 @@ +@@ -1391,7 +1501,13 @@ } public Either startSleepInBed(BlockPos pos) { @@ -389,7 +401,7 @@ this.sleepCounter = 0; return Either.right(Unit.INSTANCE); } -@@ -1545,12 +1657,24 @@ +@@ -1545,12 +1661,24 @@ } public void startFallFlying() { @@ -415,7 +427,7 @@ } @Override -@@ -1664,11 +1788,30 @@ +@@ -1664,11 +1792,30 @@ public int getXpNeededForNextLevel() { return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); } @@ -447,7 +459,7 @@ } } -@@ -1748,13 +1891,20 @@ +@@ -1748,13 +1895,20 @@ @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { @@ -475,7 +487,7 @@ } } -@@ -1798,26 +1948,55 @@ +@@ -1798,26 +1952,55 @@ public void removeEntitiesOnShoulder() { if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {