Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-12829

Flying through climbable blocks in creative mode slows you down

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w44a
    • Minecraft 1.5.1, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.7, Minecraft 15w46a, Minecraft 1.10.2, Minecraft 16w40a, Minecraft 16w41a, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w20c, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, 1.14.4, 19w45a, 1.15 Pre-release 1, 1.15.2, 20w16a, 20w17a, 20w18a, 20w22a, 1.16 Pre-release 2, 1.16 Pre-release 5, 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16.1, 20w27a, 20w28a, 1.16.2 Pre-release 1, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 20w46a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 21w11a, 21w15a, 21w17a, 1.17, 1.17.1, 21w43a, 1.18 Pre-release 1, 1.18, 1.18.1 Pre-release 1, 1.18.1, 1.18.2, 22w12a, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 23w33a, 24w11a, 1.20.6, 1.21, 1.21.1, 24w36a, 1.21.2 Pre-Release 3
    • None
    • Confirmed
    • Creative
    • Player
    • Low
    • Platform

      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 Avoma can be found below. An additional code analysis by __null 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 {
      ...

        1. MC-12829 - Fixed Code.png
          MC-12829 - Fixed Code.png
          57 kB
        2. MC-12829 - Current Code.png
          MC-12829 - Current Code.png
          49 kB
        3. MC-12829.png
          MC-12829.png
          770 kB
        4. MC-12829.mp4
          5.04 MB

            gegy1000 [Mojang] Gegy
            Avoma [Mod] Avoma
            Votes:
            37 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: