How to remove mob AI during a period of time?

Started by TDO on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to remove mob AI during a period of time?

I'm creating a mod that adds lots of weapons with custom abilities. One of them is the time bender, wich allows to "stop time"  I made a procedure that prevents the entities in range from moving during this effect, but i'm not fully satisfied with it. Ranged entities can still attack, creepers can still explode if you get near them, endermen can teleport and any entity can still look at you.

So i wanted your help to create a procedure to make mobs have no AI for a period of time, then being normal again.

(and also to prevent players to use ranged weapons or enderpearls)

Thanks guys!

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so, for the melee entities,…
Thu, 11/09/2023 - 23:05

so, for the melee entities, you can maybe try to add them slowness and extreme weakness, you can maybe try using the "attempt to stop naviguation" block and use the "set attack target of entity to" themselves or something, i don't really know 

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is a way, but it's…
Fri, 11/10/2023 - 02:47

There is a way, but it's rather complicated.
First, you need an effect, then if the entity has that effect, disable AI.
Then you'll need to enable the AI whenever the effect wears off.
If you want it to do it with players, Make sure do it with a motion vector of 0 on all axis.
Entities Can only be done with commands, if you tried to do it by custom NBTs, It will go to the forge NBT Data.

Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@1865_the_minecrafter but…
Fri, 11/10/2023 - 18:15

@1865_the_minecrafter but what is the procedure block to disable AI? Is it "attempt to stop navigation of [Entity]? or is it Attempt to override motion vector of [Entity]?

Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Leptitchoup i already did…
Fri, 11/10/2023 - 18:28

Leptitchoup i already did that, but i don't know how to do for creepers.

Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's actualy very simple…
Tue, 08/13/2024 - 01:11

It's actualy very simple just use execute command in the name of entity block and paste this command /data merge entity @s {NoAI:1b}. If you want to enable AI of the entity paste this /data merge entity @s {NoAI:0b}
Sory for late response but i just came across your comment.