mojira.dev
MC-172801

Bee's do not use the flying speed attribute

The bug

Bee's do not use the flying speed attribute.

How to reproduce

  1. Summon a bee with a high flying speed attribute:

    /summon minecraft:bee ~ ~ ~ {Attributes:[{Name:"generic.flying_speed",Base:3.0}]}
  2. Summon a regular bee for comparison (/summon bee)

  3. Observe no difference in speeds

Linked issues

Attachments

Comments 12

weird. I had the same issue

BillyGalbreath

Might be related:

[09:09:45] [Render thread/FATAL]: Error executing task on Client
java.lang.IllegalArgumentException: Default value cannot be lower than minimum value!
at alx.<init>(SourceFile:21) ~[1.15.2.jar:?]
at dnp.a(SourceFile:2167) ~[1.15.2.jar:?]
at pf.a(SourceFile:70) ~[1.15.2.jar:?]
at pf.a(SourceFile:15) ~[1.15.2.jar:?]
at lv.a(SourceFile:21) ~[1.15.2.jar:?]
at lv$$Lambda$2356/71536207.run(Unknown Source) ~[?:?]
at ais.c(SourceFile:144) [1.15.2.jar:?]
at aiw.c(SourceFile:23) [1.15.2.jar:?]
at ais.w(SourceFile:118) [1.15.2.jar:?]
at ais.bk(SourceFile:103) [1.15.2.jar:?]
at dbn.d(SourceFile:956) [1.15.2.jar:?]
at dbn.d(SourceFile:619) [1.15.2.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:204) [1.15.2.jar:?]

This throws in the client when an entity with a custom flyspeed attribute is set.

I traced it down to a floating point precision error

0.0 < Double.MIN_NORMAL

This is always true, so it always throws when the update attribute packet is sent to the client.

From the client packet handler class:

alr = dh.b(new alx(null, a2.a(), 0.0, Double.MIN_NORMAL, Double.MAX_VALUE));

The constructor of the attribute:

public alx(alq a, String s, double d0, double d1, double d2) {
super(a, b, d0);
this.a = d1;
this.maximum = d2;
if (d1 > d2) {
throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!");
} else if (d0 < d1) {
throw new IllegalArgumentException("Default value cannot be lower than minimum value!");
} else if (d0 > d2) {
throw new IllegalArgumentException("Default value cannot be bigger than maximum value!");
}
}

d0 < d1

Is always true, so always throws.

Can confirm in 20w48a.

Can confirm in 20w51a.

Can confirm in 21w03a.

2 more comments

Can confirm in 1.17.1.

Analysis provided by @unknown in MC-208844, which I took the liberty to copy to this comment:

Analysis by Lynzel

The attribute FLYING_SPEED seems to only be used in the method tick() of the class FlyingMoveControl if the entity is not onGround, which seems OK.

tick() sets the field speed of the LivingEntity according to it via setMoveSpeed().

But later, in the method getFrictionInfluencedSpeed() of LivingEntity, if the entity is not onGround, it uses this time the field flyingSpeed.

flyingSpeed seems to never change and be constant to the instanciation value of 0.02F.

Maybe the method tick() should set the field flyingSpeed instead of speed if the entity is not onGround because if I'm not mistaken, it seems that the FLYING_SPEED is actually never used.

The problem is in a check of the speed against friction:

private float getFrictionInfluencedSpeed(float ) {
 if (this.onGround) {
 return getSpeed() * 0.21600002F /  *  * ;
 }
 return this.flyingSpeed;
}

If the entity is not onGround, almost always for bees, it doesn't check the entity speed against friction, it simply return the constant value that flyingSpeed is.

This also seems to affect blazes and vexes.

Can confirm in 21w40a.

Isn't this just a duplicate of MC-180199?

EDIT: upon further looking into this, no, the attribute exists.

BillyGalbreath

(Unassigned)

Confirmed

Commands

1.15.2, 20w08a, 1.16.1, 1.16.4, 20w48a, ..., 21w40a, 1.19.4, 1.20 Pre-release 1, 1.21.1, 24w38a

Retrieved