Give a mob an effect when you look at it.

Started by Visbessie die coder on

Topic category: Help with modding (Java Edition)

Last seen on 10:29, 24. Sep 2023
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Give a mob an effect when you look at it.
Fri, 08/11/2023 - 07:05 (edited)

I want to make an armor set that gives the wearer the following ability: when I look at a mob while I am wearing the full set of armor and press a keybing the mob should get a specific potion effect or be set on fire. Will someone please send me a tutorial with pictures of the code block setup on how to do this. I think I will have to use raytrace blocks, but I don't know how. Sorry for posting this multiple times, was a mistake, I was tring to correct a spelling error.

Edited by Visbessie die coder on Fri, 08/11/2023 - 07:05
Last seen on 18:38, 29. Nov 2023
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It'll be tricky, as theā€¦
Fri, 09/22/2023 - 03:40

It'll be tricky, as the built in look-angle-vector functions give the position of the block the player is looking at, not entities. However, I imagine you would be able to make a procedure that gets the look angle vectors of the player, and then checks if there's an entity along that line- I've seen other mods do it, so it's definitely possible. But will probably require a fair bit of unpleasant math. If you're willing to just have it activate at a block position the player's looking at instead of a specific entity though, that's much easier- just use the 'look angle vector' procedure blocks to get the block the player's looking at, and then run an entity iterator to target all the entities in a desired radius.