Villagers with XP in a profession do not get prioritized when a new workstation of their craft is placed
Observed Behaviour:
Villagers with XP in a profession (no longer able to change profession) do not get prioritized when a new workstation of their craft is placed.
What should have happened:
Villagers with highest XP in profession should be assigned first to a workstation to prevent cycling through jobless villagers if they are present
Possible fix:
maybe fix with one worker pool per profession per village, assign villager without workplace and highest XP in profession first (possible concurrency problem with multiple villagers assigning them to same workstation fix, see MC-150806)
e.g.: 3 fishers, one with 100XP, the others with 50, 5 jobless
- Workplace of the fisher with 100XP gets destroyed, add him to the village "fisher job" worker queque.
- Workplace of the fisher with 50 XP gets destroyed, add him to the village "fisher job" worker queque below the 100XP fisher.
- New barrel gets placed, get and remove head element of the "fisher job" queque and assign him to the workplace
- if "fisher job" queque is empty, default to "jobless" queque, if that fails aswell, leave jobsite vacant
Environment
Windows 10 Java 8.221
Linked Issues
Created Issue:
Villagers with XP in a profession do not get prioritized when a new workstation of their craft is placed
Observed Behaviour:
Villagers with XP in a profession (no longer able to change profession) do not get prioritized when a new workstation of their craft is placed.
What should have happened:
Villagers with highest XP in profession should be assigned first to a workstation to prevent cycling through jobless villagers if they are present
Possible fix:
maybe fix with one worker pool per profession per village, assign villager without workplace and highest XP in profession first (possible concurrency problem with multiple villagers assigning them to same workstation fix, see
MC-150806)e.g.: 3 fishers, one with 100XP, the others with 50, 5 jobless
- Workplace of the fisher with 100XP gets destroyed, add him to the village "fisher job" worker queque.
- Workplace of the fisher with 50 XP gets destroyed, add him to the village "fisher job" worker queque below the 100XP fisher.
- New barrel gets placed, get and remove head element of the "fisher job" queque and assign him to the workplace
- if "fisher job" queque is empty, default to "jobless" queque, if that fails aswell, leave jobsite vacant
Environment
Windows 10 Java 8.221
duplicates
A possible fix could be, that each block that is workable by a villager has a "claimed" attribute, perhaps linking to the villager UUID or a boolean. If the block is claimed, no other villager seeking for a job is assigned. The claimed attribute is removed if the assigned villager (coordinates of workplace are also saved in a tag) is killed (remove tag from workplace coordinates block) or the pathfinding fails. For possible concurrency problems a semaphor might be used instead.
Furthermore, this could also be enhanced by the system I proposed in MC-159675, but this might cause concurrency problems aswell.
Duplicate of
MC-150806How is this a duplicate? At most it is related to but it is certainly not a duplicate of
MC-150806