Entity pathfinding towards blocks

Started by gracekaras on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity pathfinding towards blocks

I cannot for the life of me find out how to make entities head towards specific kinds of blocks, like if I wanted something to move towards coal ore or something :( Does anyone have any advice?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Something like this for the…
Fri, 09/05/2025 - 07:25

Something like this for the entity's tick trigger,

you can probably use the 6x6x6 template, 

but if you want to do it with one block I made a plugin for the block you see in the first picture, (there might be other plugins which also add this, I haven't looked)

https://files.catbox.moe/lhmfvf.zip

 

and finally I don't know how performant this will be but it looks fine with a couple of entities..

Joined May 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wow this is amazing thanks…
Fri, 09/05/2025 - 21:34

Wow this is amazing thanks so much! I'm really excited to use this. Can I ask what the first if statement is for? I'm curious if I should be using that.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You might not need it, I…
Fri, 09/05/2025 - 21:38

You might not need it, I just added it because none of the code is really necessary to have running on the client. So really just to cut down on potential bugs.

 

My plugin adds the "return;" block but you can also just use the custom code snippet with return; in it.

Joined May 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yay, thank you for your help…
Fri, 09/05/2025 - 21:45

Yay, thank you for your help :3 Ill try and keep that in mind!