Make mob move towards certain block?

Started by Aksumite on

Topic category: Help with Minecraft modding (Java Edition)

Active 4 years ago
Joined May 2020
Points:
756

User statistics:

  • Modifications: 0
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 42
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

Active 4 years ago
Joined Sep 2019
Points:
985

User statistics:

  • Modifications: 1
  • Forum topics: 14
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 507
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

 

Active 4 years ago
Joined May 2020
Points:
756

User statistics:

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

Thanks that is very helpful!