get the direction of the player relative to a block

Started by Purple19842 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
get the direction of the player relative to a block

I am making a block that needs to launch particles in a specific direction.
i need to get the angle of the player, relative to the block. so I can make it shoot in the correct direction.
If I just use the direction parameter, it gets the direction of the side of the block hit, so it would only give me around 6 directions along the grid, and I need something more exact.

Something like this:
https://imgur.com/6kJ1eAv