The Bug:
Sprinting isn't canceled upon receiving the blindness effect.
The player cannot begin sprinting while having the blindness effect, but their sprinting state isn't canceled when initially receiving the blindess effect.
Steps to Reproduce:
Summon a command block that will give you the blindness effect along with a pressure plate to activate it by using the commands provided below.
/setblock ~2 ~-1 ~ minecraft:command_block{Command:"effect give @p minecraft:blindness"}
/setblock ~2 ~ ~ minecraft:oak_pressure_plate
Begin sprinting and activate the command block by running on top of the pressure plate.
Observe the speed at which you are moving once you are given the blindness effect.
Observed Behavior:
Sprinting isn't canceled.
Expected Behavior:
Sprinting would be canceled.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 16
Can confirm in 20w48a. To reproduce, I used this simple setup. The command inside of the command block is:
/effect give @p minecraft:blindness
[media]Relates to MC-152728
Confirmed for 1.13.1, please link this comment in the description
The reason for this happening is because it does not set the players sprinting to false when receiving blindness / there are no checks for it.
This could be easily fixed by adding a check in method onLivingUpdate. so if blindness is active and the player is sprinting it would set sprinting to false.
[media]