mojira.dev
MC-150296

Villagers in igloo basements can lose their profession

Can't trade with villagers in a igloo

What I expected to happen was...:
The village should be able to be traded with

What actually happened was...:
i couldn't trade with the villager

Steps to Reproduce:
1. locate a igloo via /locate igloo
2. go to the igloo with a basement 
3. click on villager

4. get the potions and the apple and try to cure it

5. it will shiver infinity until you add a work place

 

I know how to fix the bug though. All the developers have to do is have the igloos' with basements generate with a workplace and a bed in the basement.

Linked issues

Attachments

Comments 6

Please do not mark unreleased versions as affected.
You don't have access to them yet.

Cannot reproduce not being able to cure the zombie villager. However the villager seems to indeed lose its job, even though there's a brewing stand nearby.

Is the bed in the upper part of the igloo to far for the villager to detect so the game isn’t able to make that a village and give the villager a role?

Can confirm in 1.17.1.

1.18 pre-release 5 as unreleased

No.

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

WeathermanJack

(Unassigned)

Confirmed

Mob behaviour, Village system

igloo

Minecraft 1.14, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, 1.16.3, 1.17.1, 1.18 Pre-release 5

Retrieved