Mojira Archive
MC-278042

Wrong gravity calculation in ThrownEntity

My analysis:

I found a change in the projectile height calculation, and I think this was a mistake.

According to the code, now it's gravity first, then applydray which is

(my - 0.03 d) * 0.99F

It's the wrong order,it doesn't make sense before it was

my*0.99F-0.03d

Hoping to fix 

Code:

With Fabric Yarn 1.20.3

//ThrownEntity.class
public void tick() {
    this.tickInitialBubbleColumnCollision();
    this.applyGravity();
    this.applyDrag();
    HitResult hitResult = ProjectileUtil.getCollision(this, this::canHit);
    Vec3d vec3d;
    if (hitResult.getType() != Type.MISS) {
        vec3d = hitResult.getPos();
    } else {
        vec3d = this.getPos().add(this.getVelocity());
    }

    this.setPosition(vec3d);
    this.updateRotation();
    this.tickBlockCollision();
    super.tick();
    if (hitResult.getType() != Type.MISS && this.isAlive()) {
        this.hitOrDeflect(hitResult);
    }

} 

 

 

Unresolved

royanAB

2024-11-02, 11:15 AM

2024-11-06, 08:31 AM

2

2

Plausible

Normal

Platform

Entities

1.21.3

-