Solved Detecting when a player looks at block

Discussion in 'Spigot Plugin Development' started by torpkev, Sep 18, 2019.

  1. Is there a way to detect when a player looks at a particular block?

    In case it helps to understand why.. Overall aim of this is to display a hologram only when the player is looking at the location.

    I could do it on a timed basis, but it seems pretty inefficient as I'd need to check if the players are within x radius of the block etc.

    I'd appreciate any help
     
    • Informative Informative x 1
  2. Thanks - I was hoping there'd be something more concrete so I wouldn't need to loop through all the online players every time they move/timed event and do the work, but seems like it is what it is.
     
  3. Highly doubt there's any other alternative. You could also, in case there are A LOT of players online, split the work between ticks and handle a batch of certain amount of players every other tick.
    Though I doubt this will be that intensive, the only way of finding out honestly is through testing, obviously.
     
    • Agree Agree x 1