Extending entity view and aggro range

Started by Voxdox on Sat, 07/11/2020 - 22:13

Topic category: Help with modding (Java Edition)

Last seen on 17:41, 21. Oct 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Extending entity view and aggro range
Sat, 07/11/2020 - 22:19 (edited)

Hello there. In my mod, MineHanced 1.15.2, I am trying to add an entity, called the Sand Stormer, that spawns in groups of 1 - 4 very far away from the player, and walks toward them slowly. I have attempted to implement the "walking to you from a far distance away" feature and it seems that they only look at the player, not approach them. They only aggro onto me once I approach them. Is there something i'm missing? Workspace and screenshot of procedure are both included. Thank you for the assistance.

Edit: For what ever reason it seems I am not able to add screenshot of procedure and workspace.

Edited by Voxdox on Sat, 07/11/2020 - 22:19
Last seen on 15:12, 24. Apr 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
entities usually have a 16…
Sun, 07/12/2020 - 07:19

entities usually have a 16 block follow range, so if you're outside that range, the pathfinding and targeting AI won't track you.

Last seen on 17:41, 21. Oct 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you for replying, I…
Mon, 07/13/2020 - 12:05

Thank you for replying, I appreciate the clarification. By chance would you know how to increase the range above 16 blocks, or is that impossible to do?

Last seen on 15:12, 24. Apr 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
it is very possible, but…
Mon, 07/13/2020 - 17:37

it is very possible, but will require some coding.

Last seen on 15:12, 24. Apr 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
if your comfy with coding,…
Mon, 07/13/2020 - 17:51

if your comfy with coding, then in your entity class, find the method registerAttributes(). add a line:

this.getAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(40.0D);

where 40.0D is the distance in blocks you would like your entity to track.

Last seen on 17:41, 21. Oct 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Of course! I didn't even…
Mon, 07/13/2020 - 19:28

Of course! I didn't even think about that. Thanks a ton!

Last seen on 17:41, 21. Oct 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hey hey we looking good!…
Mon, 07/13/2020 - 19:35

Hey hey we looking good! Everything is functioning perfectly. Thanks again!

Last seen on 02:22, 10. Jan 2021
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hey, I am using MCreator…
Sun, 12/13/2020 - 00:47

Hey, I am using MCreator 2020.5 with the 1.12.2 addon. I was wondering why the build fails when I do this? Also, why does "follow distance" not do anything?

Last seen on 15:12, 24. Apr 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
for 1.12.2 its: this…
Sun, 12/13/2020 - 09:31

for 1.12.2 its:

this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(40.0D);

Last seen on 06:24, 12. May 2021
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Where can I find…
Tue, 04/13/2021 - 15:59

Where can I find registerAttributes()? my entity doesnt have that method for some reason (1.16.4). Where should I insert it and how it should look?

 

Last seen on 15:12, 24. Apr 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i'm not familiar with 1.16.4…
Tue, 04/13/2021 - 16:52

i'm not familiar with 1.16.4. sorry

Last seen on 06:24, 12. May 2021
Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I found it, if anyone is…
Wed, 04/14/2021 - 16:39

I found it, if anyone is interested you have to do this

1. find method private void setupAttributes()

2. into the method paste this next to the similar lines: ammma = ammma.createMutableAttribute(Attributes.FOLLOW_RANGE, 90.0D);

3. change 90,0D to range you like

4. you are done