Make mob move towards certain block?

Started by Aksumite on

Topic category: Help with modding (Java Edition)

Last seen on 01:21, 23. Aug 2020
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

Last seen on 04:35, 17. Jan 2021
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

 

Last seen on 01:21, 23. Aug 2020
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!