When mob is nerby it gives me effect [HELP WITH THAT]

Started by Dogis on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When mob is nerby it gives me effect [HELP WITH THAT]
Tue, 07/12/2022 - 19:02 (edited)
Hello,
I would like to make a mob that will give you an effect (e.g. strength or regeneration) when you are nearby (e.g. 6 blocks). I made this mob follow the player after taming, and when it follows the player, it will give him this effect. I hope I explained everything well
Edited by Dogis on Tue, 07/12/2022 - 19:02
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
To check if mob is nearby…
Wed, 07/13/2022 - 05:37

To check if mob is nearby you can use block "Get nearest entity at x y z in square cube with size _ of type". It'll give you nearest entity. 

 

And run on player tick update.

 

Eventually there should be block:

"For each entity as _ at x: y: z: in square cube with size _ 4 do _"

 

It'll loop through all entities in set range.