The bug
Villagers are not breeding in test where houses are at same level as villagers. Created 20 houses around two villagers, made them willing by trading and stacks of bread, but they do not breed any villagers after a long test period. Villagers do not seem to be recognizing houses in generated villages at night as well. They do trade food. Observed a villager running away from a village with doors at night being chased by two zombies.
Workaround
For the time being, a possible (but probably annoying) work-around would be to ensure the villagers are 4 blocks below and 16 blocks in the negative X and Z directions from a door in order to create a village at the proper location.
Code analysis
By @unknown
Villages are created successfully, but are immediately destroyed because the center of the village is much further than the valid door. Using MCP 1.12 for names, and having modded a decompiled 18w05a to ensure it works, this appears to be a one line fix.
In 1.12.2, net.minecraft.village.VillageCollection.addDoorsAround(BlockPos central)
creates immutable BlockPos
objects for the positions around the villager's location where it should search for doors.
Now in 1.13, it uses net.minecraft.util.math.BlockPos.getAllInBoxMutable(int, int, int, int, int, int)
, which for all intents and purposes does the same thing except that it uses a single mutable BlockPos
whose coordinates are changed when the next item is requested from the iterator. The loop finds the door correctly, but stores the mutable position in a list of doors to be added later to the village (call to VillageCollection.addToNewDoorsList(BlockPos)
). Instead an immutable copy of the position should be passed to addToNewDoorsList
since otherwise the found door positions change once the next positions are requested from the iterator resulting in all doors "found" at the last search position and therefore being removed from the village since there is (most of the times) no door.
Mappings
MCP name | 18w06a name | 18w06a MCP equivalent name |
---|---|---|
|
| see MCP name |
|
|
|
Linked issues
is duplicated by 27
relates to 2
Attachments
Comments 35
I can confirm. Tried same artificial village in 1.12.2 and in snapshot 17w50a. Villagers breed in 1.12.2 but not 17w50a. Also, in another test villagers eventually drift southeast in the snapshot rather than northwest like in the release.
Also confirmed, 17w50a. Tried several methods, no number of doors or trading seems to make villagers want to breed.
Confirmed 18w01a, villagers still won't breed. Tried a villager breeder that worked in 1.12.2, it didn't work in neither 17w50a nor 18w01a. Also tried an abandoned village and added some more buildings and two villagers, couldn't get them to breed.
Did the update and now none of my farms are breeding, picking up food or farming. I even created 2 new breeding farms and still no luck.
As I said above, if you're still encountering this (or a similar) issue, please create a new ticket, if we don't have one already. Also note that every comment edit sends a new email to every single person who watches this ticket.
Just to clarify, if I create a village and add villagers, they should conglomerate around the center of the village. This appears to be offset, however even if the villagers are at the offset location, they still are not breeding.