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
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?)
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).
Works as intended. Check the bug fixes or changes for 20w19a.