Minecraft wiki entry for Survival_with_no_enabled_data_packs, associated text: If you must stay in a village overnight, it takes several days to prepare the village to survive your presence. Move all the beds, job sites, (and enough torches) to the largest building, to move the villagers into it. Then surround this main building with an extra layer of dirt or sand all along the outside walls and doors, since mobs can attack villagers who are standing next to walls or doors. Finally, block the doors once the villagers are all inside, so they can't get out. If they can get out, they will find a way to get killed. Create some kind of "airlock" so you can get inside the main building to trade with the villagers, without risking them escaping.