How to Escape a 1x2 Hole with Villager?
There are a few ways out if you just happen to have the right items still left in your pared-down inventory:
A sand or gravel block: You can jump up and place blocks around and above the hole so that one of these blocks falls through you into the bottom of the hole. You can then jump up onto it to get out. Be sure to only drop one block for you and your villager to jump up on since two will suffocate you.
A water source block (i.e. water bucket): You can place this outside the hole so that it flows into the hole, then swim up the waterfall. Be sure to pick the source up quickly after you swim out so your villager doesn't risk drowning.
A boat, minecart, or bed: You can jump and place these outside the hole, then jump again to right-click on them, which will place you inside/on them and safely out of the hole. If you don't have any of these, but you do have the materials to craft them (along with a crafting table), then you can jump up to place a crafting table outside, jump up to right-click on it, and then make what you need.
An Ender Pearl: Jumping up and throwing it will teleport you out of the hole. If you're patient you could even wait until night to lure a passing Enderman over and kill it for one.
Saddled pig rescue: If there's a saddled pig nearby, or a nearby pig you could saddle, then jumping up and right-clicking on it will also get you out.
If you don't happen to have any of these items, I think your only hope is to position yourself just right so you can dig away at a wall block without hitting the villager's hitbox. Of course, you could also wait until you get killed by mobs or starve to death, then just respawn and return to free your villager.
You can also open your world to LAN and join from another Minecraft copy and literally help yourself out.
I know the user in question has since been freed, but there's an excellent and guaranteed solution in case this ever happens in the future. It does not require any inventory items whatsoever.
If you're in the middle of mining a block, coming in contact with an entity (such as a villager or cow) will stop the mining but not attack the entity. This makes it so if you're mining you don't accidentally attack anything you don't want to.
To get out of the hole:
- Jump and hold left click while aiming at a grass block. When you land, you'll most likely stop mining since you're inside the villager's hitbox.
- Move around while holding the left click button until you find a spot where you can mine a dirt block long enough to pick it up and escape.