mojira.dev

_vertig0275

Assigned

No issues.

Reported

No issues.

Comments

For clarification, the real reason is that the AssignProfessionWhenSpawned NBT flag is broken, the boolean assignProfessionWhenSpawned is set to true inside the Villager class when the Villager spawns as part of a structure (Irrespective of whether the structure is an Igloo or a regular Village, making this tag even more broken!). Said Villager class immediately sets this boolean to false on the very next tick, before the relevant Behaviour Controller class even has time to process this flag, leading to the Villager simply just spawning without a profession anyway. On top of that, the flag does not even do what its name suggests that it does, because all it's used for is to bypass the range check of how far the job site block can be before the Villager can claim it, nothing else (For any Mojang developers looking at this bug, the relevant logic is inside the AssignProfessionFromJobSite behaviour class), while the name would suggest that it means the Villager already has a profession the moment it was spawned. I suggest Mojang completely rework the code around this flag entirely: Use it to permanently mark a Villager that has indeed been given a profession the moment it spawns, remove the hacky range check bypass altogether, and remove the code that immediately nukes the flag on the very next tick. Instead this flag should be read inside the ResetProfession behaviour class so that Villagers meant to have a profession from spawn will keep their profession no matter what, as follows:

Original (current) code:

if (villagerdata.getProfession() != VillagerProfession.NONE && villagerdata.getProfession() != VillagerProfession.NITWIT && entityvillager.getExperience() == 0 && villagerdata.getLevel() <= 1) {

    // Villager loses profession here

}

 

Fixed code:

if (!entityvillager.assignProfessionWhenSpawned() && villagerdata.getProfession() != VillagerProfession.NONE && villagerdata.getProfession() != VillagerProfession.NITWIT && entityvillager.getExperience() == 0 && villagerdata.getLevel() <= 1) {

    // Villager loses profession here

}

And yes, the Villager inside the Igloo is indeed supposed to be a Cleric: Villager – Minecraft Wiki (fandom.com)

If anyone could tag a developer here, it would be much appreciated