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

PlayerInteractEvent raycast does not account for new Minecraft reach attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 4195-Spigot-fcd94e2-f057cf4 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
    • Yes

      Raycasts for PlayerInteractEvent in PlayerConnection.java should account for new Minecraft reach attributes, both entity and block.
      I'm running into the issue that PlayerInteractEvent fires after EntityDamageByEntityEvent whenever I give an item an interact reach modifier. If you attack an entity OUTSIDE of the vanilla reach range, PlayerInteractEvent will still fire.

      https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/nms-patches/net/minecraft/server/network/PlayerConnection.patch#722
      https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/nms-patches/net/minecraft/server/network/PlayerConnection.patch#1126

      I don't think this is as simple as changing the ternary to {{this.player.blockInteractionRange()
      }}
      For example, a players block interaction range can still be shorter than the players attack interaction range. The raycast needs to account for the longer attribute when checking the logic, but still get the block from the players blockInteractionRange.

            Unassigned Unassigned
            tlm920 Timo McGrath
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: