-
Bug
-
Resolution: Unresolved
-
None
-
1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 21w05a, 21w05b, 21w06a, 21w07a, 21w08a, 21w08b, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 1.17, 1.17.1, 1.18, 1.18.1, 1.18.2, 1.19 Pre-release 3, 1.19 Pre-release 4, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.21, 1.21.3
-
Community Consensus
-
Player
The Bug:
Players that are forced to sneak in small areas receive damage when stepping on magma blocks.
Steps to Reproduce:
- Build the setup as shown in the attachment below. setup.png
- While sneaking and holding the sneak key, stand on top of the magma block.
- Stop holding the sneak key.
- Take note as to whether or not players that are forced to sneak in small areas receive damage when stepping on magma blocks.
Observed Behavior:
Players that are forced to sneak in small areas receive damage when stepping on magma blocks.
Expected Behavior:
Players that are forced to sneak in small areas would not receive damage when stepping on magma blocks.
Code Analysis:
Code analysis by Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
public class MagmaBlock extends Block { ... public void stepOn(Level level, BlockPos blockPos, BlockState blockState, Entity entity) { if (!entity.isSteppingCarefully() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity)) { entity.hurt(DamageSource.HOT_FLOOR, 1.0F); } super.stepOn(level, blockPos, blockState, entity); } ...
If we look at the above class, we can see that in order for the player to receive damage from stepping on magma blocks, the isSteppingCarefully() boolean must return false. This boolean returns true if the shift key is held down or is toggled and returns false if the shift key isn't held down or isn't toggled. The game doesn't check if the player is being forced to sneak in small areas before allowing them to receive damage from stepping on magma blocks, therefore resulting in this problem occurring.
Fix:
Simply altering the existing "if" statement within this piece of code to check if the player is being forced to sneak in small areas before allowing them to receive damage from stepping on magma blocks will resolve this problem. We can achieve this through the use of the isCrouching() boolean.
if (!entity.isSteppingCarefully() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity))
if (!entity.isCrouching() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity))
- relates to
-
MC-151547 Being forced to sneak in a 1.5 blocks high space doesn't prevent you from falling down
- Resolved
-
MC-182043 Foxes, ocelots and stray cats still run away from players who are sneaking while underneath a slab
- Resolved
-
MC-195636 minecraft.custom:sneak_time does not work when being force-crouched in a 1.5 block tall area
- Resolved
-
MC-214502 Big Dripleaf ignores sneaking when forced to sneak by standing in a 1.5 blocks high space
- Resolved
-
MC-211243 Sculk sensors are activated based on whether you are holding the sneak key or not
- Resolved