mojira.dev
MC-182741

You are unable to use Elytra when having the Levitation effect

The Bug:

You cannot fly with elytra when the levitation effect is active.

Steps to Reproduce:

  • Equip elytra, switch into survival mode, and give yourself the levitation effect.

/effect give @s minecraft:levitation 99 0
  • Attempt to fly with the elytra by pressing the SPACE key multiple times.

  • Take note as to whether or not you can fly with elytra when the levitation effect is active.

Observed Behavior:

You cannot fly with elytra when the levitation effect is active.

Expected Behavior:

You would be able to fly with elytra when the levitation effect is active.

Code Analysis:

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 15

Works as intended. Check the bug fixes or changes for 20w19a.

The reporter acknowledges this fix in their report, the bug is that you can't glide with levitation, so it is most likely valid.

You should still be able to activate elytras when under the levitation effect, you just open the wings and still glide. (perhaps making it so you glide upwards when opening elytras with levitation?)

I already wrote this in the description.

5 more comments

Can confirm in 1.18.1.

Here's a code analysis of this issue. The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

Code Analysis:

net.minecraft.world.entity.player.Player.java

public abstract class Player extends LivingEntity {
   ...
   public boolean tryToStartFallFlying() {
      if (!this.onGround && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(MobEffects.LEVITATION)) {
         ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
         if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack)) {
            this.startFallFlying();
            return true;
         }
      }

      return false;
   }
   ...

If we look at the above class, we can see that the code specifically checks to see whether or not the player has the levitation effect when attempting to start gliding with elytra. This is evident through the following line of code:

!this.hasEffect(MobEffects.LEVITATION)

This basically means that if the player has the levitation effect, you will not be able to start fall flying (gliding with elytra).

Confirmed in 1.18.2.

Can confirm in 1.19 and 1.19.1 Pre-release 1.

Confirmed in 1.20 pre-release 5.

bugsbugsbugs

[Mod] turbo

(Unassigned)

Confirmed

Gameplay

Low

Player

elytra, levitation, player

20w19a, 20w20a, 20w20b, 20w21a, 20w22a, ..., 24w07a, 1.20.5, 1.20.6, 1.21, 1.21.3

Retrieved