Steps to reproduce: (from this comment)
Set bed and spawn a villager in the center of simulation distance. Wait until you see green sparkles before place other bed next to the master bed
Travel beyond the original simulation distance border so that the village is now unloaded.
Spawn a villager.
Observed result:
Villager shows green sparkles, running side to side in a holding room, looking at the bed directly as if it was set down next to master bed.
Expected result:
It shouldn't be able to claim bed in an unloaded area or 64 plus away. There is no POI in between.
Original description
Sister Ticket: MC-148733
Villagers claim POIs (Position of Interest) that are unreasonable. i.e. Too far away or unreachable. (Notes: My villagers keep wandering back and forth and won't sleep or find a station.) They end up getting stuck in an unemployed state.
To reproduce:
Cure a villager from a zombie villager and keep them in a room.
Make sure there is a bed and a workstation.
Most likely the villager will end up hooking to one of your barrels or a blast furnace you have that's like 50 blocks away for some strange reason..
===
Possible solution is too minimize the range. 8 blocks or less or just have more weight to the closest block with no chance of claiming a block passed, say, 16 blocks. If the distance is equal, then it will be a random chance. (At least, they should be able to access it to qualify as being a POI.) An untraded villager should still have a chance to change their profession until they are traded with. Villagers should keep their POIs no matter how far in this case. (Or set a timeout of not being able to return to the original POI.) And if it is destroyed you will be able to reassign a different POI. This goes for beds too, except instead of 'work time' it would be 'bed time'. Improved AI would benefit as well to be safe.
===
I want to add something I noticed. Every time I close and then reopen my world, they all reclaim a bed and it is never one right next to them. The POIs are always like 10s blocks away from them. They won't breed unless I reopen my world as well. It's like something resets each time and needs a refresh every time.
Linked issues
is duplicated by 15
relates to 4
Comments 18
Happened to me yesterday in snapshot 20w14a. One of my new villagers claimed a blast furnace at the bottom of my cliff base which I did not want claimed. I guess it was just barely within range of the village (some 30 to 35 blocks by my count) and I had left a path open via a spiral staircase.
So I blocked off the path with dirt blocks and waited, but the villager still remained armorer (I had not traded with him yet either). The only other blast furnace in existence anywhere was way further down, about halfway toward my first mineshaft, some 50+ blocks vertically below the village. Only once I removed that blast furnace did the villager revert back to unemployed.
The whole time that villager was wandering around in the village, and not anywhere near that final blast furnace.
@Hawk J this is a Bedrock Edition big report. Snapshots are Java Edition. You should follow up MC-148733.
@Wolff and Eyeth: it’s important that we keep several issues distinct.
Villagers not necessarily linking to the nearest workstation is intended behavior according to MCPE-45270.
Villagers detecting workstations that they cannot pathfind to is tracked at MCPE-50441.
Villagers changing their linkages when you relog is tracked at MCPE-46157.
The thing that gets reset when you relog, allowing villagers to claim POI and breed, is the queue of POI queries. The issue of that getting jammed is tracked at MCPE-49580.
Setting those issues aside, the main issue in this report is that villagers link to POI at unreasonable distances. I think that should be considered as a distinct bug because of the problems it can create. These include:
Excessive village expansion (MCPE-46581)
Villagers with beds and workstations that are too far apart from each other, which complicates pathfinding and their ability to restock trades.
Villagers going outside of simulation distance to try to get to POI, which can lead to overpopulation and workstation stealing and swapping (MCPE-47212, MCPE-43071, MCPE-46157).
Confirmed using the steps provided by Eyeth. It seems that villagers will claim beds outside of simulation distance, but will only claim workstations within simulation distance. Note, however, that for workstations it is the player's simulation distance that matters, not the distance from villager to POI. That means that in some situations villagers will claim workstations much farther than 64 blocks away. With simulation distance of 8, I was able to get a villager to claim a workstation up to 110 blocks away.
Additional note: while testing this bug I happened upon what may be a necessary first step for triggering MCPE-62080. In 2 cases of villagers claiming workstations far away, they did not change profession. In that state they can be traded with, but will not work/restock trades. If you then break the workstation and place a new one of the same type, they change to that profession, keeping the experience and levels they had already gained.
Would love it if villagers couldn't claim beds/workstations they actually can't reach. Trying to make a villager trading hall and they keep claiming beds and workstations that aren't in their cubby, so they can never restock their trades.
This bug needs investigation. I have a zombie spawner within a deep dark / abandoned mineshaft that is Y -30. It should be virtually impossible for any cured villager to detect any profession block that is not the one I place beside the curing area. However, every villager that I cure is a different profession than the block placed. If a matching block to that profession is placed, the cured villager does not link to it / lose profession when the block is broken.
This is so far away from the only village that it is on a completely different 3/4 zoomed map. I wish there were more debugging information available to players / realm owners to confirm exactly where it thinks it is linking to for a workstation block.
This is a single player world that I run on a 2 person realm for convenience of backups. So I know nobody has other villagers anywhere nearby.
I would like to add as Bedrock 1.20.60 I got this bug.
I wanted to transfer my iron farm to another location about 55-60 blocks away and 12 blocks higher, when I freed the villagers from they current job stations (fletchers), they picked up immediately the job stations (barrels) in the new iron farm.
This issue is still present in 1.21.1 and it is making it very hard to trade with villagers. When can we expect this bug to be fixed so parity with Java edition can be achieved?
One possible solution that I have not seen mentioned below is to possibly make villagers “look for” a workstation with-in the default radius, but only link to that station when the are in an even smaller radius (lets say five blocks). I believe this is how the mechanic works in Java edition. The villager appears to walk close to the work station first, before trying to link to it. While on Bedrock edition, the villager links to the workstation, before checking whether or not they can actually reach it.
It is broken. Villager was able to claim bed outside simulation distance or more than 64 blocks (tested on 4 chunk in creative and survival).
Steps to reproduce:
Set bed and spawn a villager in the center of simulation distance. Wait until you see green sparkles before place other bed next to the master bed
Get behind simulation distance outside the border so that the village is now unloaded.
Spawn a villager
Observe result:
Villager showing green sparkles, running side to side in a holding room, looking at the bed directly it was set down next to master bed
Expected result:
It shouldn't be able to claim bed in an unloaded area or 64 plus away. There is no POI in between.