-
Bug
-
Resolution: Unresolved
-
None
-
1.17, 1.17.1 Release Candidate 2, 1.17.1, 1.18.1, 1.19.1, 1.19.2, 1.20, 1.20.2, 1.20.3 Release Candidate 1, 1.20.4, 1.21.1
-
Windows 10, Java 16
-
Community Consensus
-
(Unassigned)
Summary:
The 'minecraft.custom:minecraft.sneak_time' scoreboard objective is triggered when crouching while flying in creative. Additionally, the scoreboard objective is NOT triggered when a player stands under a slab, unless they are holding the designated sneak key.
On the other hand, the 'is_sneaking' flag for predicates is unable to detect crouching during creative flight, but does detect a player standing in a 1.5 block space without holding the sneak key. This behaviour is inconsistent.
Steps to Reproduce:
1. Enter creative mode.
2. Create a new scoreboard objective using this command:
scoreboard objectives add sneakTest minecraft.custom:minecraft.sneak_time
3. Place a repeating, always active command block and type the following command into it:
execute if score @p sneakTest matches 1.. run say SNEAKING
4. Attach a chain, always active command block to the repeating command block, and enter this command into it:
scoreboard players reset @a sneakTest
5. Finally, fly up and then press your designated crouching key in order to fly down again. The repeating command block will be triggered by this, and the word 'SNEAKING' will appear in the chat. This shows that the sneak_time scoreboard detects sneaking during creative flight.
6. A predicate can now be created and placed into a datapack to verify that they do not detect sneaking during creative flight:
{ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "flags": { "is_sneaking": true } } }
A function or command block would then need to test for the predicate and run a command when triggered. If done correctly, the predicate will detect crouching on the ground, but will not detect crouching during creative flight.
Similar steps can be taken to verify scoreboard and predicate crouch-detection behaviour when standing in a 1.5 block space (under a slab).
The expected behaviour here would be for scoreboards and predicates to be consistent in their detection of crouching. They should either both detect sneaking based on key-press (current scoreboard behaviour), or both detect sneaking based on the player hitbox (current predicate behaviour).
However, a nicer fix would be to rename 'minecraft.custom:minecraft.sneak_time' to more accurately portray its real behaviour (for instance 'minecraft.custom:minecraft.sneak_attempt_time'). This would allow both behaviours to be leveraged by datapack makers.