Is there a way to get a mob/entity to walk to another mob/entity/block when an event is triggered?

Started by Minecraft_guy881 on

Topic category: Help with modding (Java Edition)

Last seen on 22:01, 5. Jun 2024
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to get a mob/entity to walk to another mob/entity/block when an event is triggered?

I need help by making a mob/entity go walk to another mob/entity/block when a player walks or collides on it

I have ZERO coding experience so that won't be any help

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's a new 'Attempt to…
Sun, 10/01/2023 - 14:25

There's a new 'Attempt to make entity pathfind to x/y/z' function that should work just fine for this, if you replace x/y/z with the positions of the target entity. However, (speaking from personal experience and several days of messing around with this), the pathfinding isn't always the greatest, and isn't precise down to the block. However, for most purposes, should work fine, it's in the 'entity management' tab at the bottom.

Last seen on 22:01, 5. Jun 2024
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I found the part, but I'm…
Sun, 10/01/2023 - 16:31

I found the part, but I'm not sure how to set it up, could you send a screenshot of how you did it?

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's really pretty…
Sun, 10/01/2023 - 16:38

It's really pretty straightforward: you tell the entity the coordinates to go to, and it attempts to go there. In this case, you would set the coordinates to the position of the entity you want it to go to. (You can find 'entity position' in the entity data tab.) It could look something like this:

You'll need to be running this constantly though, (on entity tick), since the target entity will likely be moving.