Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7230

PlayerInteractEvent does not fire when you left click in survival and there is an entity between 3 and 4.5 blocks away

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • None
    • 3635-Spigot-d90018e-941d7e9 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
    • Yes

      To start, Minecraft has two different reaches when you are in survival mode: an attack reach (3 blocks) and a building reach (4.5 blocks). You can see this here https://minecraft.fandom.com/wiki/Player#Reach. However, the code in PlayerConnection.patch (near line 1164) for detecting a PlayerInteractEvent with Action.LEFT_CLICK_AIR checks to see if either an entity or a block is within 4.5 blocks. This means that if a Survival player left clicks at an entity who is outside of its attack reach but still within 4.5 blocks, neither a PlayerInteractEvent nor a EntityDamageByEntityEvent will be called. This seems like unintended behavior because the player actually is left clicking the air.

       

      I've also included a plugin that messages the player when the PlayerInteractEvent is triggered and when the EntityDamageByEntityEvent is triggered (by the player). To recreate this issue:

      1. load the provided plugin
      2. set your gamemode to survival
      3. find an entity
      4. left click at the entity while you are further than 3 blocks away from it, but closer than 4.5 blocks from it

      You will see that the entity is not damaged and that the interact event is not called.

            Unassigned Unassigned
            Lux Gareth Fultz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: