The bug
Bee's do not use the flying speed attribute.
How to reproduce
Summon a bee with a high flying speed attribute:
/summon minecraft:bee ~ ~ ~ {Attributes:[{Name:"generic.flying_speed",Base:3.0}]}
Summon a regular bee for comparison (
/summon bee
)Observe no difference in speeds
Linked issues
Attachments
Comments 12
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.
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.
Isn't this just a duplicate of MC-180199?
EDIT: upon further looking into this, no, the attribute exists.
weird. I had the same issue