Started by
littledude47
on
Topic category: Help with Minecraft modding (Java Edition)
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 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.
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.
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
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)
Mr. Mint, do u know a way to reset the attributes to normal?
Mr. Mint, do u know a way to reset the attributes to normal?
Mr. Mint, do u know a way to reset the attributes to normal?