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

Started by Always on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 years ago
Joined Jan 2022
Points:
490

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
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