Last active
November 2, 2025 19:27
-
-
Save lowercasebtw/664cadad36aa62abfb5282dfc3f3c10e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private boolean shouldRestoreSprint = false; | |
| // In LocalPlayer#tick, injected after ``super.tick`` | |
| private void fixMC152728() { | |
| if (shouldRestoreSprint && !this.canResumeSprinting()) { | |
| shouldRestoreSprint = false; | |
| } | |
| if (this.isSprinting() && this.isUsingItem()) { | |
| ItemStack stack = this.getUseItem(); | |
| if (!stack.isEmpty() && !stack.getOrDefault(DataComponents.USE_EFFECTS, UseEffects.DEFAULT).canSprint()) { | |
| this.setSprinting(false); | |
| shouldRestoreSprint = true; | |
| } | |
| } else if (shouldRestoreSprint && !this.isUsingItem()) { | |
| this.setSprinting(true); | |
| shouldRestoreSprint = false; | |
| } | |
| } | |
| private boolean canResumeSprinting() { | |
| return this.input.hasForwardImpulse() && | |
| this.isSprintingPossible(this.getAbilities().flying) && | |
| (!this.isFallFlying() || this.isUnderWater()) && | |
| (!this.isMovingSlowly() || this.isUnderWater()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment