This might not be exactly what you asked for, but it is the best I've thought of that wasn't already mentioned. You can use the invisibility effect to greatly reduce the detection radius of mobs.
effect give @a invisibility infinite
# To get rid of the effect when you are done.
effect clear @a invisibility
This gives all players currently online infinite invisibility. While this does not completely prevent mobs from attacking you, it reduces the detection radius. (You can further fine tune who this applies to using the /effect
command; read more on the wiki.
Mobs do not attack or sense the player until the player is a lot closer than normal.
- A player with no armor can be detected at 7% of the usual detection distance.
- Each piece of armor increases this by another 17.5% of the usual distance. Full armor thus results in a 70% detection range.
- After detecting the player, a mob continues to follow as if the player is visible.
The following methods of reducing mob detection can stack with Invisibility:
- Sneaking reduces the detection range to 80% of the usual.
- Wearing the corresponding mob head reduces the detection range of skeletons, zombies, creepers, and piglins to 50% of usual, although mob head does count as an armor piece. Wearing a mob head with Invisibility effect results in a larger detection range compared to having just the effect.
So for the best results, wear no armor and avoid mobs, and mobs will not notice you until you are much, much closer than usual.
For your convenience, I have placed the detection radius of a couple mobs commonly found in caves below.
Mob |
Original Detection Radius |
DR With Invisibility (ODR*.07 ) |
Spider, Skeleton, Creeper |
16 Blocks |
1.12 |
Zombie |
35 Blocks (only 16 in BE)* |
2.45 |
Cave Spider |
(Not on the wiki page, but just avoid the spawners) |
|
*The zombie's detection radius depends on the target. This value is for when chasing players.
In summary, with invisibility and while wearing no armor, just stay at least 3 blocks away from all mobs and you will not be targeted.