When player's generic.step_height is greater than or equal to ((Collidable block's hitbox total height under the player)+1.5) blocks, they can't move while sneaking.
Steps to reproduce:
1.Create a normal superflat world (4 blocks thick) and run the command /attribute @s minecraft:generic.step_height base set 5.5
(5.5 can be replaced by a larger number)
2.Press shift and W(Sneak button and move forward button).
Observed results:
You can't move forward when you are sneaking.
Expected results:
You can move forward when you are sneaking.
Code Analysis is in the comments.
Linked issues
duplicates 1
relates to 1
Attachments
Comments 3
This is because player avoids to fall from block edge, but the checking method is wrong.
@Override
protected Vec3 maybeBackOffFromEdge(Vec3 var0, MoverType var1) {
if (!this.abilities.flying && var0.y <= 0.0 && (var1 == MoverType.SELF || var1 == MoverType.PLAYER) && this.isStayingOnGroundSurface() && this.isAboveGround()) {
double var2 = var0.x;
double var3 = var0.z;
double var4 = 0.05;
while (var2 != 0.0 && this.level().noCollision(this, this.getBoundingBox().move(var2, -this.maxUpStep(), 0.0))) {
if (var2 < 0.05 && var2 >= -0.05) {
var2 = 0.0;
continue;
}
if (var2 > 0.0) {
var2 -= 0.05;
continue;
}
var2 += 0.05;
}
while (var3 != 0.0 && this.level().noCollision(this, this.getBoundingBox().move(0.0, -this.maxUpStep(), var3))) {
if (var3 < 0.05 && var3 >= -0.05) {
var3 = 0.0;
continue;
}
if (var3 > 0.0) {
var3 -= 0.05;
continue;
}
var3 += 0.05;
}
while (var2 != 0.0 && var3 != 0.0 && this.level().noCollision(this, this.getBoundingBox().move(var2, -this.maxUpStep(), var3))) {
var2 = var2 < 0.05 && var2 >= -0.05 ? 0.0 : (var2 > 0.0 ? (var2 -= 0.05) : (var2 += 0.05));
if (var3 < 0.05 && var3 >= -0.05) {
var3 = 0.0;
continue;
}
if (var3 > 0.0) {
var3 -= 0.05;
continue;
}
var3 += 0.05;
}
var0 = new Vec3(var2, var0.y, var3);
}
return var0;
}
It should search the collision from player's feet to its max step height, not just move the collision box to the max step height and check whether it collides.
Please provide your findings on MC-267381 instead of here.
Thank you for your report!
We're actually already tracking this issue in MC-267381, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote or any additional information to the main ticket it would be appreciated.
Please be sure to use the search feature before creating a ticket to see if the issue has already been reported.
Quick Links:
📗 Tracker Guidelines – 🛠 Community Support – 📧 Mojang Support – 🔑 Account Support – ✍️ Feedback Discord – 💬 Mojira Discord