LivingEntity#getEyeLocation() doesn't take gliding into account

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None

      The method in CraftBukkit:

      public Location getEyeLocation() {
              Location loc = getLocation();
              loc.setY(loc.getY() + getEyeHeight());
              return loc;
          }
      
      public double getEyeHeight() {
              return getHandle().getHeadHeight();
          }
      

      For players, getEyeHeight() returns 1.62 if you're flying and not sneaking, same as if you weren't flying. It returns 1.54 if you're flying and sneaking, same as if you weren't flying.

       

      As a sidenote, EntityHuman#getHeadHeight() looks like this:

      public float getHeadHeight() {
          float f = 1.62F;
          if (this.isSleeping()) {
              f = 0.2F;
          } else if (!this.isSneaking() && this.length != 1.65F) {
              if (this.cP() || this.length == 0.6F) {
                  f = 0.4F;
              }
          } else {
              f -= 0.08F;
          }
      
          return f;
      }
      

      And cP() is returns the same thing as LivingEntity#isGliding(). So I think that it should return the correct eye location if you're not sneaking.

            Assignee:
            Unassigned
            Reporter:
            Anrza
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: