The Bug
Sculk sensor can detect "GameEvent.STEP" before "GameEvent.HIT_GROUND" causing an inconsistent redstone signal output of either 1 or 5 depending on the circumstances.
Relates to MC-247642
Steps to Reproduce
Place a sculk sensor at ground level that outputs it's signal into a command block with the command below (note: "x y z" must be set as the sculk sensor's coordinates):
tellraw @a {"nbt":"last_vibration_frequency","block":"x y z"}
Build a platform 11 (or more) blocks above the sculk sensor to avoid detection of anything other than the player falling.
Pay attention to the outputs of the sensor in the following two scenarios. Walking off of the platform while not moving in any direction until you hit the ground, and, in the second scenario, walking off the platform, and continuing to move forward until you hit the ground.
An additional command block was placed behind this one to give the player instant health after falling. This last command block is not required for the setup, but recommended for prolonged testing.
Observed Behavior
The redstone signal output of the sculk sensor will be different for the two falling circumstances.
Expected Behavior
The output would remain a consistent number (5 in this case) regardless of how the player fell.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
Attachments
Comments 4
Can confirm this behavior.
The detection of 1 redstone signal output compared to 5 seems to be much more reliable if the player immediately starts walking forward after breaking the block beneath them and continues to walk forward (will give 1) versus falling straight down (which provides 5).
The Bug:
Sculk sensor can detect "GameEvent.STEP" before "GameEvent.HIT_GROUND" causing an inconsistent redstone signal output of either 1 or 5 depending on the circumstance
Steps to Reproduce:
Place a sculk sensor at ground level that outputs it's signal into a command block with the command below (note: "x y z" must be set as the sculk sensor's coordinates):
tellraw @a {"nbt":"last_vibration_frequency","block":"x y z"}
Build a platform 11 (or more) blocks above the sculk sensor to avoid detection of anything other than the player falling
Detect the both different outputs by 1. Walking off of the platform not moving in either the 'X' or 'Z' axis until you hit the ground, and 2. Walking off the platform, and continuing to move forward until you hit ther ground.
Observed Behavior:
The redstone signal output of the sculk sensor will be different for the two falling circumstances
Expected Behavior:
The output would remain a consistent number (5 in this instance) no matter the player moving forward while falling, or falling straight down
Code analysis
Code analysis by FX - PR0CESS can be found in this comment
Dupe of MC-207393
The bug is that only for players the STEP event can happen before the hit ground event. If the STEP event happens first, then the HIT_GROUND event will be ignored.
The reason this happens is because ServerPlayerEntity overrides fall() (Where HIT_GROUND event is fired) to make it do nothing. They then have a method called handleFall() which calls the Entity.fall()
Although the cause of the bug is due to the ordering of the methods. Before Entity.move() would run fall() then move() (Where STEP event is fired). Although for the ServerPlayerEntity, that is all handled within ServerPlayNetworkHandler inside of onPlayerMove() and it calls Entity.move() first, then handleFall()
Code Analysis (Yarn Mappings 1.18.1)
Entity.java
ServerPlayerEntity.java
ServerPlayNetworkHandler.java
Working Fix