Minecraft wiki entry for Combat, associated text: When attacking with multiple hits at once, keep in mind that your opponent is invulnerable 0.5 seconds after they take damage, as indicated by their avatar turning red while they cannot be hit. Try to keep the crosshair on the opponent while in melee range to ensure the attacks won't miss, wait until the instant they are not red anymore, then hit them again with the sword.