mojira.dev
MC-12829

Flying through climbable blocks in creative mode slows you down

The Bug:

Flying through climbable blocks in creative mode slows you down.

Steps to Reproduce:

  1. 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
  2. Switch into creative mode if not already and begin flying.

  3. Fly through the scaffolding and as you do this, pay close attention to the speed at which you travel through them.

  4. 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 {
...

Related issues

Attachments

Comments

migrated
[media][media][media][media]
Chris Dusto

I have a feeling that this might be related to how one can climb vines.

Are these jungle vines or swamp vines?

Anon Ymus

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.

Dlawso the Really Lucky Rabbit

I'm not sure why this was reopened. This is clearly the same issue as MC-5410.

Anon Ymus

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.

Swekob

Confirmed for 15w46a

FaRo1

Duplicate of MC-5410.

Anon Ymus

No, it's not. See the comments above.

FaRo1

Ah, it's up. Sorry. Didn't ever see this, will test in a few minutes.

Kraif

Confirmed for 1.13.1.

muzikbike

Affects 19w14b

Swekob

Affects 19w45a

Swekob

Relates to MC-90212

FaRo1

I wouldn't say so. Those two behaviours are pretty much opposites. This one makes you do laddery stuff where you would not expect it and the other one makes you ignore the ladder where you would expect to be able to use it.

Swekob

Okay, depends on how you look at it. Both of these bugs relates to unexpected behavior regarding flying of some sort and ladders/vines. My idea is just so Mojang easier can find somewhat similar bugs to fix.

Swekob

Affects 1.15-pre1 and 1.14.4

CalXee

Confirmed for 20w22b. Twisting vines slow you down in creative mode.

Conem

Confirmed in 1.16 Pre-release 2.

Conem

Confirmed in 1.16-pre4.

Conem

Confirmed in 1.16-pre5.

Conem

Confirmed in 1.16-pre6. I'd like to request ownership - I'll keep this ticket updated.

[Mod]Les3awe

Completed.

anthony cicinelli

Affects 20w27a

Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 21w07a. Video attached.

Avoma

Can confirm in 1.16.5 and 21w08b.

SauceMan8

Can confirm in 21w11a. Includes glow berry vines

bugsbugsbugs

Not just flying through them slows you down. Climable blocks slow you down in general when moving, not just when flying, which is annoying.

Avoma

Can confirm in 21w15a.

Avoma

Can confirm in 21w17a.

Avoma

Can confirm in 1.17.

Avoma

Can confirm in 1.17.1.

SoloAlguien

Can confirm in 21w43a.

SoloAlguien

Can confirm in 1.18 Pre-release 1.

SoloAlguien

Can confirm in 1.18 and 1.18.1 Pre-release 1.

SoloAlguien

Can confirm in 1.18.1.

Avoma

I can also confirm this behavior in 1.18.1. Here's a code analysis of this issue along with a fix.

Code Analysis:

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 {
...
SoloAlguien

Can confirm in 1.18.2.

null

Code analysis based on 1.18.2 with yarn mappings.

The easiest way to fix this would be to make net.minecraft.entity.LivingEntity#isClimbing() (or this.onClimbable() in @unknown's analysis) return false if the player is flying. In fact, this method already checks if the entity is in spectator mode. We just need to add a check if the entity is a player and they are flying.

To do this, override that method in net.minecraft.entity.player.PlayerEntity as follows:

@Override
public boolean isClimbing() {
    if (this.abilities.flying) {
        return false;
    }
    return super.isClimbing();
}
Avoma

Can confirm in 1.19.

Avoma

Can confirm in 1.19.2.

Avoma

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]
Avoma

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)?

Gullyman4

This is not fixed in 24w44a. Please reopen. I still able to reproduce this.

Avoma

In my testing, the issue appears to be fixed correctly. Could you please clarify exactly what is not fixed?

Gullyman4

The issue be not fixed. Scaffolding slows me down for no reason. Actually is slow down any #climbable. Ladder, vine, scaffolding. Even air if I datapack add air climbing.

Alexander Spielvogel

Avoma

gegy

Confirmed

Platform

Low

Player

Minecraft 1.5.1, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.7, Minecraft 15w46a, ..., 1.20.6, 1.21, 1.21.1, 24w36a, 1.21.2 Pre-Release 3

24w44a

Retrieved