The Bug:
Flying through climbable blocks in creative mode slows you down.
Steps to Reproduce:
Summon a wall of climbable blocks, for example, a wall of scaffolding by using the command provided below.
/fill ~2 ~ ~1 ~2 ~6 ~15 minecraft:scaffolding
Switch into creative mode if not already and begin flying.
Fly through the scaffolding and as you do this, pay close attention to the speed at which you travel through them.
Take note as to whether or not flying through climbable blocks in creative mode slows you down.
Observed Behavior:
Flying through climbable blocks in creative mode slows you down.
Expected Behavior:
Flying through climbable blocks in creative mode would not slow you down.
Code Analysis:
Code analysis by @unknown can be found below. An additional code analysis by @unknown can be found in this comment.
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.entity.LivingEntity.java
public abstract class LivingEntity extends Entity {
...
public boolean onClimbable() {
if (this.isSpectator()) {
return false;
} else {
BlockPos blockpos = this.blockPosition();
BlockState blockstate = this.getFeetBlockState();
if (blockstate.is(BlockTags.CLIMBABLE)) {
this.lastClimbablePos = Optional.of(blockpos);
return true;
} else if (blockstate.getBlock() instanceof TrapDoorBlock && this.trapdoorUsableAsLadder(blockpos, blockstate)) {
this.lastClimbablePos = Optional.of(blockpos);
return true;
} else {
return false;
}
}
}
...
If we look at the above class, we can see that there is only one check that is carried out before allowing a living entity to climb a climbable block. This check is to see if the living entity is in spectator mode, and if they are, they won't be able to climb climbable blocks, and if they're not, they will be able to climb climbable blocks. The game doesn't check if the living entity is currently flying before allowing them to climb climbable blocks, therefore resulting in this problem occurring.
Fix:
Simply adding an "if else" statement to the "if" statement to check if the living entity is a player and if they're flying before allowing them to climb climbable blocks will resolve this problem.
Current "if" statement:
if (this.isSpectator()) {
return false;
} else {
...
Fixed "if" statement:
if (this.isSpectator()) {
return false;
} else if (this instanceof Player player && player.getAbilities().flying) {
return false;
} else {
...
Linked issues
is duplicated by 5
relates to 3
Attachments
Comments 48
Duplicate of MC-5410, please use the search function to see if your bug has already been submitted. Currently over 55% of tickets are being closed as duplicate.
I'm not sure why this was reopened. This is clearly the same issue as MC-5410.
MC-5410 is about flying down on a ladder, which stops you. This issue is about flying up or sideways, which simply makes you go slower.
Following on from mine and @unknown's code analyses, I've double-checked our proposed fix and I can confidently confirm that it's fully functioning and works as expected, so I've attached two screenshots to this report, one of which shows the current code and the other that shows the fixed code. I feel this information may be quite insightful hence my reasoning for providing it. 🙂
[media][media]Also, if it isn't too much to ask, would it be okay if I could take ownership of this ticket since the current reporter has been inactive since June 2020 (over 2 years)?
In my testing, the issue appears to be fixed correctly. Could you please clarify exactly what is not fixed?
I have a feeling that this might be related to how one can climb vines.
Are these jungle vines or swamp vines?