Minecraft wiki entry for Defense, associated text: Zombies are difficult creatures to face when in a claustrophobic area, such as a cave. They can only attack when they are near you which gives you an advantage and a disadvantage. The advantage is that you can take them from a distance and be safe. However, this method gives the zombified piglins an upper hand when there are multiple of either one and they surround you. This leaves you unable to escape. If building a defensive structure to prioritize against zombies, you should try and stay away from them, but in the case that you cannot make sure you have an open area both inside and outside of your defensive structure such as a courtyard, so that you have alternatives of escape. The best defense from piglins and the zombified versions of them is not to attack them. This is because unless you damage them somehow, they will not attack you.