How do I make it so every mob in an area stops attacking the player?

Started by littledude47 on Sat, 08/22/2020 - 04:23

Topic category: Help with modding (Java Edition)

Last seen on 18:17, 27. Feb 2021
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I make it so every mob in an area stops attacking the player?
Sat, 08/22/2020 - 04:23

I want to make an item that when right clicked basically stops every mob from attacking the player for about 10 seconds but I'm not sure how to do that

I don't think there is an…
Sat, 08/22/2020 - 08:26

I don't think there is an easy way to achieve this. Even with coding, it won't be trivial.

But there might a MC command that could achieve this, but I am not sure.

Last seen on 21:59, 15. Jun 2021
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
A simple (but not foolproof…
Sat, 08/22/2020 - 18:32

A simple (but not foolproof way of achieving this) would be to add invisibility to the player for 10 seconds, as well as add level 100 slowness to all mobs within a certain radius. This would freeze all hostile mobs (on ground) in place, and reduce their detection range. Although ranged attack mobs may still attack. Another way you could do this, is just make the player invincible for 10 seconds, realistically, that would achieve the same effect.

Last seen on 18:17, 27. Feb 2021
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
how would I give every mob…
Sat, 08/22/2020 - 23:31

how would I give every mob in a radius slowness? I looked everywhere but can't find anything that gives mobs in an area an effect, I know you can do it with commands but then it won't work for anyone playing survival without cheats

 

Last seen on 00:34, 27. Apr 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I'm really new and I know…
Mon, 04/19/2021 - 02:21

I'm really new and I know that this post is pretty old but I know how to answer both questions for anybody who has a similar question,

First, to give slowness to all surrounding mobs use the "for each entity as entity iterator" block, then give the entity iterator slowness. You can also change the radius in which it will activate.

Second, to make all entities not attack you, use the same entity iterator block, but this time execute 3 commands in the name of the entity iterator:

These commands edit the attributes follow range, attack damage, and attack speed of the entity iterator

Command 1: attribute @s minecraft:generic.follow_range base set 0

Command 2: attribute @s minecraft:generic.attack_damage base set 0

Command 3: attribute @s minecraft:generic.attack_speed base set 0

By doing these three commands the mob simply won't know you're there. (attack damage and attack speed aren't necessary but just to make the whole thing foolproof I put it in there)