Need help - How to get entity the player is looking at

Started by Always on

Topic category: Help with modding (Java Edition)

Last seen on 00:47, 19. Feb 2023
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need help - How to get entity the player is looking at

Ok, so I'm working on a mod and I don't rly know how to do this. I am making a food that swaps your position with the entity you are looking at when you eat it.

 

I was searching for forum posts and found this one:

https://mcreator.net/forum/61787/detect-entity-player-looking

 

It looked like its not possible with procedures to do this so I tried importing the code from the post. It did not work at all (cause im js noob)

If someone can walk me through on a way to make this work then that would be amazing because I am so lost right now. The version is 1.17