Extending entity view and aggro range

Started by Voxdox on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?

Joined Nov 2019
Points:

User statistics:

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

it is very possible, but will require some coding.

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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!

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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!

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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);

Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?

 

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

Joined Oct 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Im really really new to java…
Sat, 11/27/2021 - 10:29

Im really really new to java modding. Im months late for this but can anyone guide me how can I apply this to my mob? 1.16.5 but I do think?* that the 1.16.4 method will work but where do I find that entity class?

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind! I Finally FOUND…
Sat, 11/27/2021 - 12:01

Nevermind! I Finally FOUND IT! THANK YOU Original POSTER as well as MMG! My Shingeki no Kyojin - Titans mod is now completed!

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can someone tell me how can…
Wed, 02/02/2022 - 09:24

Can someone tell me how can I increase aggrorange of an NPC I am making a boss and i want him to attack players from a far distance if a player hit him with anything from far or in short attack him from far and the boss will go to the player and attack the player please tell me my version is 1.7.10 and i used it script in int this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(40.0D) but it showed some missing space after numeric literal 

 

Please help me