Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-278042

Wrong gravity calculation in ThrownEntity

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.3
    • None
    • Plausible
    • Entities
    • Normal
    • Platform

      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);
          }
      
      } 

       

       

            Unassigned Unassigned
            royanAB royanAB
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: