mojira.dev
MCPE-54183

Villager leader/center changes every time you log in and out

I was Making a iron farm and i needed To find the villager leader so the iiron golems would spawn on the platform but every time i log Out and log back in the leader changes. Thank You

Linked issues

Attachments

Comments 19

Happens both on realms and local games

It also happens very frequently when you breed new villagers, and sometimes when you place profession blocks. Sometimes I have even ended up with three leaders (they get green sparkles when I place a bell).

Game version 1.14 on a Realm.

Andrew Riley Buhrow

I tested this on local games and on realms and have been able to reliably reproduce this issue on realms only.

[Mojang] Mega_Spud (Jay)

Would it be possible to get repro steps and/or a test world where this issue is happening?

jeffrobintolentino

can confirm on 1.16.0.55

 

9 more comments

in 1.20.51 the hierarchy (heirs to the leader and the leader) switches to the new villagers when more villagers are added to the village via breeding. Will do more testing soon.

Edit.
even if the leader can sleep in its bed, the leader position can be assigned to newly created villages breading or spawning.

Have a free roam village with vanilla buildings intact, save for some terraforming for easier pathfinding.

Whenever the Villagers have a town meeting, storm cloud particles are emitted constantly around the bell hanging beneath the well roof. The Villager(s) in question doesn't matter because it shifts every time.

I did some testing on this and here are some takeaways. 

1. When new villagers are added to the village, they may be placed in any random location in the hierarchy order. They could become the new leader, the tail, or somewhere in-between. This confirms @unknown's findings. Although @unknown stated that the entire order is scrambled, more specifically the new villager can be inserted at the beginning, end, or somewhere in the middle of the order. But the previous order remains intact excepting the new insertion.

2. When every bed in the village breaks, the order completely scrambles. This kind of makes sense given that a village is only formed with the first bed.

3. As of 1.20.72, on Nintendo Switch, every time the user logs in and out, the villager hierarchy order reverses. If the villagers were initially in the order 1, 2, 3, 4, upon logging out and back in the order will be 4, 3, 2, 1. However, if you login and out and then in and out again the order is back to it's original. This appears to confirm @unknown's code observation that "On Android, the implementation of std::unordered_map tends to reverse the order of villagers between saving and loading data to NBT." This reversal problem does not exist on the Windows PC Bedrock version as of 1.20.72.

4. The villager hierarchy theory appears to be true as of 1.20.72 on Nintendo Switch and Windows PC. You can tell the hierarchy order by breaking all the workstations, and placing them down again. The order in which the villagers claim them is the order of their hierarchy. I used Universal Minecraft Tool to verify that the village origin/center point follows the villager hierarchy order and their POI.

The take away problem is that the village origin is unpredictable due to the hierarchy order changing too easily. The solution should include a somewhat easy or at least consistent way to determine the village center so Iron Farms can work reliably. Added villagers should come at the end of the hierarchy order, not somewhere in the middle or beginning.

Workaround:
One potential work around is to expand the village by placing 4 workstations on the outskirts. That is, keep the beds inside the village boundaries and add workstations in the expansion range of the village. Since beds are prioritized as origin points and workstations can expand the village boundaries but won't act as an origin point if there are beds for every villager you can expand the village so the center becomes the geometric center of the village boundaries, allowing you to control where iron golems spawn. This can be done in any natural village meeting the requirements for iron golem spawning. 

Steps to Reproduce:
Using Nintendo Switch Bedrock Edition 1.20.72:

1. Create 4 side-by-side fenced areas large enough to fit a bed, workstation and villager.

2. In the first fenced area, place a villager and then a bed. After he links to the bed, repeat the process for the next fenced area until all 4 fenced areas are accounted for.

3. Place down a workstation (can be the same type or different) in each fenced area, waiting for each to be claimed at a time, and take note of the order in which villagers claim them. 

4. Break all the workstations and repeat step 3, one more time, noting that the order the stations are claimed in is consistent with the previous time.

5. Break all the workstations, beds, and kill all the villagers.

6. Repeat steps 2-5 a few times until you notice the order does not match the spawn order or claiming beds order.

7. Log out and then back in, delete all the workstations and place them down again one at a time after each villager links, note the order they are claimed in.

8. Repeat step 7.

Observed Results:

1. The villagers may not claim the workstations in the order the villagers were spawned in or each claimed beds in but in each cycle of steps 2-5 you'll notice the order changes. However, if you erase the workstations only and place them down again, the villagers maintain that order.

2. Upon the 7th and 8th steps, the order that villagers claim workstations is reversed both times.

Expected Results:

1. The first villager that claimed a bed should be the first villager to claim a workstation. The second villager that claimed a bed should be the second villager to claim a workstation and so on.

2. Logging in and out should not reverse the order that villagers claim workstations.

Can confirm as of 1.21.90, that this is still an issue. Whenever a new villager joins the village, it takes full priority of the leader of the village until killed. This makes it near impossible to build a stacked iron farm.

Zachary

(Unassigned)

369846

Community Consensus

Multiple

1.16.0.58 Beta, 1.12.1, 1.14.30 Hotfix, 1.16.50 Hotfix (iOS), 1.16.201 Hotfix, 1.16.221 Hotfix

Retrieved