For the first time ever a zombie villager approached the fence around my base (1.13.2 vanilla MC) and I decided to try to capture it in case I ever have the means to cure it. So without thinking I leapt over the fence. I was totally inexperienced and unprepared and tried stupidly and clumsily to enclose it with a wall of dirt as it was chasing me but it was too fast and then it started to burn because the sun was rising and then my phone started to ring, distracting me even further. The end result was that the zombie villager killed me and when I returned it was gone. In retrospect I realize that I employed the worst possible tactic. Maybe I could have have kept the fence between us, climbed up on a block and walled it in from a safe vantage point. Or maybe I could have quickly dug a ditch for it to fall in as it was chasing me. I plan to practice on normal zombies so I am prepared if the opportunity ever presents itself again.
I wonder if anyone has any tips on how to capture a mob on the spur of the moment (not a fixed trap that is permanently set).
On the complete spur of the moment the only thing I can think of would be trying to lure it into a 2 block deep hole.
I'm not sure how easy that is, you might have to lure it between you and the hole and push it.
But you're better off with a little planning.
Unless this happens pretty close to your base you can't run off to get a potion and golden apple without risking having the zombie despawn anyways, unless you are at least carrying a renamed nametag to name it.
And villagers are a pain to move if you cure them far from where you want them.
So carry or stop to craft a few trapdoors and put open trapdoors on the edge of the hole so the zombie will walk in instead of trying to go around.
Then you can just place a few blocks over the top to protect the zombie from sunlight and stop other zombies from falling in.
Yeah, I usually use the two block deep trap, but as i usually carry ladders as standard, i just place a ladder and climb out, then cover the mob. Because of despawning you should try and lure it closer to where you hang out. When it comes to Zombnie Villagers for curing you should really make a dedicated trap.
I was in the same situation, noticing zombie villagers occasionally appearing outside of my fences. What I did was dig a pit 2x3 pit, 2 block deep, with the 2 block side along my fence. I then put in 6 trap doors, leaving them open, so the mob will walk in. You stand on your side of the fence and lure them in. The trapdoors can be closed so they don't burn up.
On my side of the fence, I dug a tunnel down with ladders and to the pit for me to be able to either kill whatever fell in, or administer the cure fo zombie villagers. I am separated from them by a a one block hole. I can then open the hole wider and let out a cured villager and out into my base.