I have a hardcore world with no structures. I built a mob farm with a mob sorter and curing chamber to bring villagers into the world. The first time I did this I discovered that villagers without a bell can despawn, even after you've traded with them. So I wrote a mod to make bells craftable. My mob farm is a village with a bell and a couple villagers that I can breed to populate more villages.
The problem I'm having is that new villagers seem to be permanently bound to the village where they were born. They will take jobs elsewhere and even run to a bed if I ring a bell, but they will not claim a bed. When night comes they try to pathfind back to the mob farm.
I confined two villagers in a breeder with a bell. Their first baby claimed a nearby bed. I broke the bell and bed and transported the baby to a new village. It grew up, took a job, and would run to a bed when I rang the bell. But when night came it tried to pathfind back to the breeder!
I built villages in a hardcore no structures world in 1.21.8 with no problem. Why are my 1.21.11 villagers bound to their birthplace even when it no longer has a bell or bed?
Villagers do not despawn in vanilla. They simply wander away if left without beds.
The baby villager might have been pathfinding back to your breeder because it was detecting one of the other beds there (and not specifically the one you removed). Try breaking and replacing those existing beds, and ensuring that the new villagers cannot reach or notice them.
Beyond that, I don't believe there is anything else that would attract villagers to a certain location at night.
I found other reports of villagers despawning after two villagers I had traded with vanished from a fully enclosed space with an iron door. I've also had villagers disappear from iron farms if they don't have a bell.
My wayward villager tries to pathfind back to the place where he was born even after I remove the bell and all the beds there. He will run to a bed in his new home when I ring a bell, but he will not claim it. He walks right past it to go out the door and head for his birthplace.
Villagers are hardcoded to not despawn, so if they are, then it is either due to bugs and/or mods. There is one existing bug I found where they can disappear, but it was last observed in 1.21.3 and has not been recorded since.
In the case of a bug, there isn't much you can do. The only other cause I can think of is if the space isn't lit up, zombies can spawn inside and kill the villager.
I cannot find any bug reports of villagers wandering back to their birthplace without any POIs (profession sites, blocks, bells, etc.) there, so mods are the only cause I can think of.
The only mods I'm running are my crafting recipe for a bell, a modified loot table for witches, and a shader loader. I'll disable the shader loader if that might somehow be involved.
Are there any blocks besides beds, bells, and profession blocks that could be POIs? The only profession blocks at the site the villager is trying to return to are claimed by the two villagers there.
I disabled the shader loader (iris-fabric-loader-0.18.4-1.21.11) and the villager who kept trying to wander off claimed and slept in a bed. The next game day I unblocked the doors and he didn't try to go back to his old village.
Incidentally, I wasn't using any kind of mod the first time my villagers disappeared. That's what prompted me to write the bell recipe.
Are there any blocks besides beds, bells, and profession blocks that could be POIs? The only profession blocks at the site the villager is trying to return to are claimed by the two villagers there.
No, those are the only POIs for villagers, according to this Wiki page.
I was about to say that the two villagers with professions might have lost connections to their respective blocks (which doesn't cause them to become unemployed if they've been traded with), and that the problematic villager is detecting one of the profession sites and trying to claim it. But since you managed to resolve the issue by turning off a mod, then the mod is the most likely culprit.
If villagers are disappearing (not wandering off) and you are not playing with mods, then it is either due to the despawning bug I linked above (unlikely, but in which case there isn't really a solution available), or they have actually died. If the latter is true, then the only cause I can think of is that your enclosed space wasn't lit up and zombies killed them. In any case, it will be useful to check their cause of death in the game logs, as mentioned above.
I have a hardcore world with no structures. I built a mob farm with a mob sorter and curing chamber to bring villagers into the world. The first time I did this I discovered that villagers without a bell can despawn, even after you've traded with them. So I wrote a mod to make bells craftable. My mob farm is a village with a bell and a couple villagers that I can breed to populate more villages.
The problem I'm having is that new villagers seem to be permanently bound to the village where they were born. They will take jobs elsewhere and even run to a bed if I ring a bell, but they will not claim a bed. When night comes they try to pathfind back to the mob farm.
I confined two villagers in a breeder with a bell. Their first baby claimed a nearby bed. I broke the bell and bed and transported the baby to a new village. It grew up, took a job, and would run to a bed when I rang the bell. But when night came it tried to pathfind back to the breeder!
I built villages in a hardcore no structures world in 1.21.8 with no problem. Why are my 1.21.11 villagers bound to their birthplace even when it no longer has a bell or bed?
Villagers do not despawn in vanilla. They simply wander away if left without beds.
The baby villager might have been pathfinding back to your breeder because it was detecting one of the other beds there (and not specifically the one you removed). Try breaking and replacing those existing beds, and ensuring that the new villagers cannot reach or notice them.
Beyond that, I don't believe there is anything else that would attract villagers to a certain location at night.
I found other reports of villagers despawning after two villagers I had traded with vanished from a fully enclosed space with an iron door. I've also had villagers disappear from iron farms if they don't have a bell.
My wayward villager tries to pathfind back to the place where he was born even after I remove the bell and all the beds there. He will run to a bed in his new home when I ring a bell, but he will not claim it. He walks right past it to go out the door and head for his birthplace.
Villagers are hardcoded to not despawn, so if they are, then it is either due to bugs and/or mods. There is one existing bug I found where they can disappear, but it was last observed in 1.21.3 and has not been recorded since.
MC-153904
Having a bell should not have an impact though.
In the case of a bug, there isn't much you can do. The only other cause I can think of is if the space isn't lit up, zombies can spawn inside and kill the villager.
I cannot find any bug reports of villagers wandering back to their birthplace without any POIs (profession sites, blocks, bells, etc.) there, so mods are the only cause I can think of.
The only mods I'm running are my crafting recipe for a bell, a modified loot table for witches, and a shader loader. I'll disable the shader loader if that might somehow be involved.
Are there any blocks besides beds, bells, and profession blocks that could be POIs? The only profession blocks at the site the villager is trying to return to are claimed by the two villagers there.
I disabled the shader loader (iris-fabric-loader-0.18.4-1.21.11) and the villager who kept trying to wander off claimed and slept in a bed. The next game day I unblocked the doors and he didn't try to go back to his old village.
Incidentally, I wasn't using any kind of mod the first time my villagers disappeared. That's what prompted me to write the bell recipe.
If villagers continue to disappear, give them names and check the game logs. This way, you will know if any of them die and why.
Sorry for my English, I use Google Translate.
No, those are the only POIs for villagers, according to this Wiki page.
I was about to say that the two villagers with professions might have lost connections to their respective blocks (which doesn't cause them to become unemployed if they've been traded with), and that the problematic villager is detecting one of the profession sites and trying to claim it. But since you managed to resolve the issue by turning off a mod, then the mod is the most likely culprit.
If villagers are disappearing (not wandering off) and you are not playing with mods, then it is either due to the despawning bug I linked above (unlikely, but in which case there isn't really a solution available), or they have actually died. If the latter is true, then the only cause I can think of is that your enclosed space wasn't lit up and zombies killed them. In any case, it will be useful to check their cause of death in the game logs, as mentioned above.