Make mob move towards certain block?

Started by Aksumite on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make mob move towards certain block?

I am making an ant hill, and want the ants to move towards a nearby ant hill block (the rest is already figured out)

Also, can you make mobs move towards vanilla blocks?

Thanks :D

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you know how to code,…
Wed, 06/17/2020 - 01:12

If you know how to code, this should help. Otherwise, I am not sure, but don't think it is possible in MCreator;

 

am making an ant hill, and want the ants to move towards a nearby ant hill block

There are two stages to this. However, they can all be consolidated to one EntityAI class.

 

First, we have to find the block, we can do so using;

BlockPos::getAllInBoxMutable

Iterate through the results and if one matches your block (or vanilla block as you stated) do;

PathNavigator::tryMoveToXYZ

 

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks that is very helpful!
Wed, 06/17/2020 - 02:54

Thanks that is very helpful!