How make mob rage about mining block aroun him?

Started by _Dark_Xaver_ on

Topic category: Help with modding (Java Edition)

Last seen on 17:11, 27. Dec 2020
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How make mob rage about mining block aroun him?

I add Ents in my mod but I want make them rage when player cut tree around them like Piglins and mining gold.

Did I need use custom coding to make this?

Last seen on 14:43, 2. Aug 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On block broken check for…
Sun, 12/27/2020 - 18:15

On block broken check for the entity in a radius.

Add a nbt logic data to the entity in a radius.

 

Then on the entity tick update if the entity has the nbt to be true

add custom code snippet: entity.setAggroed(true);

else

add custom code snippet: entity.setAggroed(false);

 

On entity spawn add custom code snippet: entity.setAggroed(false);