<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sun Jan 12 11:49:44 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[MC-78] Villagers crowd into a single building</title>
                <link>https://bugs.mojang.com/browse/MC-78</link>
                <project id="10400" key="MC">Minecraft: Java Edition</project>
                    <description>&lt;p&gt;Villagers are not using houses made for them. They are staing in 2 or 3 houses ( of aprx. 150)&lt;br/&gt;
You can see on a pic, how they behave&lt;/p&gt;

&lt;p&gt;What I suggest to do:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;make an array of doors in village&lt;/li&gt;
	&lt;li&gt;make an array of villagers&lt;/li&gt;
	&lt;li&gt;order every villager in villagers array to choose one door from doors array&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For example, there are 10 villagers (1,2,3 ...9, 10) and 10 doors in the village (A, B, C); &lt;br/&gt;
Then each villager have to use 1 door, for example: &lt;br/&gt;
1 villager - A door&lt;br/&gt;
2 villager - B door&lt;br/&gt;
...&lt;br/&gt;
10 villager - J door&lt;/p&gt;

&lt;p&gt;So, if the house contains 5 doors, there will be 5 villagers&lt;/p&gt;

&lt;p&gt;I think, it&apos;s realy easy to realize, and I didn&apos;t get, why you haven&apos;t made this yet.&lt;/p&gt;

&lt;p&gt;Thanks for attention.&lt;/p&gt;</description>
                <environment></environment>
        <key id="11322">MC-78</key>
            <summary>Villagers crowd into a single building</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="5" iconUrl="https://bugs.mojang.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="vit">Vit Musienko</reporter>
                        <labels>
                            <label>AI</label>
                            <label>door</label>
                            <label>village</label>
                            <label>villager</label>
                    </labels>
                <created>Wed, 24 Oct 2012 18:37:14 +0200</created>
                <updated>Sun, 3 May 2020 15:39:44 +0200</updated>
                            <resolved>Sun, 25 May 2014 22:41:31 +0200</resolved>
                                    <version>Minecraft 1.4.2</version>
                    <version>Minecraft 1.4.4</version>
                    <version>Minecraft 1.4.7</version>
                    <version>Snapshot 13w07a</version>
                    <version>Snapshot 13w10a</version>
                    <version>Minecraft 1.5</version>
                    <version>Snapshot 13w18c</version>
                    <version>Snapshot 13w21b</version>
                    <version>Minecraft 1.6.1</version>
                    <version>Minecraft 1.6.2</version>
                    <version>Minecraft 1.6.4</version>
                    <version>Minecraft 13w39b</version>
                    <version>Minecraft 13w41a</version>
                    <version>Minecraft 13w41b</version>
                    <version>Minecraft 13w42a</version>
                    <version>Minecraft 13w42b</version>
                    <version>Minecraft 1.7.2</version>
                    <version>Minecraft 1.7.4</version>
                    <version>Minecraft 1.7.5</version>
                                    <fixVersion>Minecraft 14w21b</fixVersion>
                                                        <votes>333</votes>
                                    <watches>43</watches>
                                                                            <comments>
                            <comment id="550684" author="bugi74" created="Sat, 25 May 2019 14:40:00 +0200"  >&lt;p&gt;If they crowd to one specific corner of the village i.e. always on an edge of the village, even worse if it is the same edge and the same edge in every village, then it is another bug, not this one (e.g. &lt;a href=&quot;https://bugs.mojang.com/browse/MC-89509&quot; title=&quot;As of 15w39c, villagers are once more North-West obsessed.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-89509&quot;&gt;&lt;del&gt;MC-89509&lt;/del&gt;&lt;/a&gt; or &lt;a href=&quot;https://bugs.mojang.com/browse/MC-3944&quot; title=&quot;Villagers in Minecraft, when given a roughly 5x5-10x10 area, will arbitrarily pack up in the north-west corner&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-3944&quot;&gt;&lt;del&gt;MC-3944&lt;/del&gt;&lt;/a&gt;, both of which were of the north-west tendency -kind).&lt;/p&gt;

&lt;p&gt;If they tend to crowd in to one or few random houses (in larger village), possibly different houses each night, then it could be this bug (with possibly different root cause but the same symptoms, but this technical detail doesn&apos;t matter to us players).&lt;/p&gt;</comment>
                            <comment id="550683" author="acemccrank" created="Sat, 25 May 2019 14:32:23 +0200"  >&lt;p&gt;This bug actually returned during 1.9. the math behind Villager AI would have them all eventually all go to one corner of the village after several hours. I think it had something to do with how floating points work or something. Either way, it should still be fixed again.&lt;/p&gt;</comment>
                            <comment id="550649" author="farogaming" created="Sat, 25 May 2019 12:32:08 +0200"  >&lt;p&gt;No, this bug is even confirmed for that exact version and many after it. And 1.4.2 was not villager themed, Are you sure you&apos;re really talking about MCJava?&lt;/p&gt;</comment>
                            <comment id="550611" author="vit" created="Sat, 25 May 2019 06:21:13 +0200"  >&lt;ul&gt;
	&lt;li&gt;&lt;p&gt;&lt;b&gt;Fix Version/s:&lt;/b&gt;&lt;a href=&quot;https://bugs.mojang.com/issues/?jql=project+%3D+MC+AND+fixVersion+%3D+%22Minecraft+14w21b%22&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Minecraft 14w21b&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;this is incorrect, this bug is supposed to be fixed with 1.4.2 villager update, please confirm&lt;/p&gt;</comment>
                            <comment id="298539" author="redstonehelper" created="Mon, 4 Apr 2016 19:51:38 +0200"  >&lt;p&gt;See &lt;a href=&quot;https://bugs.mojang.com/browse/MC-89509&quot; title=&quot;As of 15w39c, villagers are once more North-West obsessed.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-89509&quot;&gt;&lt;del&gt;MC-89509&lt;/del&gt;&lt;/a&gt; for the current iteration of this bug.&lt;/p&gt;</comment>
                            <comment id="298049" author="acemccrank" created="Sat, 2 Apr 2016 02:45:06 +0200"  >&lt;p&gt;I can confirm this is an ongoing problem through 1.9, and was present for me in 1.8.x&lt;br/&gt;
I&apos;ve been villager breeding, and keep my house on the edge of the village (Still part of the village).&lt;br/&gt;
The villagers for the most part - approximately 5 will go to one building, the rest will go to another.&lt;br/&gt;
There are approximately 20 houses, most of the walls are knocked out with lines of doors on all of them.&lt;/p&gt;

&lt;p&gt;Worth noting:&lt;br/&gt;
All but 2 of my villagers died at one point, but I managed to keep them safe to breed back to capacity.&lt;br/&gt;
There are enough villagers now to spawn 3 golems.&lt;br/&gt;
I am playing on a Mac, on Realms, 3.06 Ghz Dual-Core Pentium Core 2 Duo, 16 GB RAM.&lt;br/&gt;
Java is up to date.&lt;/p&gt;</comment>
                            <comment id="208147" author="marcono1234" created="Fri, 7 Nov 2014 19:40:19 +0100"  >&lt;p&gt;Oh sorry, didn&apos;t know that &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;br/&gt;
Well you are right, sorry ;(&lt;/p&gt;</comment>
                            <comment id="207215" author="psusi" created="Fri, 31 Oct 2014 19:10:05 +0100"  >&lt;p&gt;No Marcono, that&apos;s not right.  From your screen shot it appears that you spawned like 1000 villagers in creative mode with only 2-3 houses and so they just have nowhere to go.  The number of villagers should only be about half the number of doors.  In other words, if you have 10 houses with 2 doors each, spawn 10, maybe 12 villagers, and see if 5 or 6 of them crowd into a single house with several of them being left empty.&lt;/p&gt;</comment>
                            <comment id="207210" author="marcono1234" created="Fri, 31 Oct 2014 18:44:16 +0100"  >&lt;p&gt;&lt;del&gt;Bug confirmed partwise for&lt;/del&gt;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;del&gt;&lt;b&gt;1.8.1-pre3&lt;/b&gt; &lt;em&gt;it seems like villager don&apos;t recognize how much place is in a house, in the&lt;/del&gt; &lt;del&gt;attached screenshot (&quot;Villager house (1.8.1-pre3)&quot;) you see that most of the villagers wont to&lt;/del&gt; &lt;del&gt;get in the one house which is obviously full, even the house in front has still space inside&lt;/del&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="189594" author="alexnoob" created="Sat, 16 Aug 2014 22:52:49 +0200"  >&lt;p&gt;fixed in 1.8, also i confirm.&lt;/p&gt;</comment>
                            <comment id="179834" author="sithobrine" created="Fri, 25 Jul 2014 16:45:43 +0200"  >&lt;p&gt;I think it may be Villager AI. If not then there is definatly a problem. Or mabey a zombie is trying to get at them.&lt;/p&gt;</comment>
                            <comment id="179831" author="wpalmer" created="Fri, 25 Jul 2014 16:41:19 +0200"  >&lt;p&gt;I believe I am still experiencing this issue in 14w30c&lt;/p&gt;</comment>
                            <comment id="160191" author="vit" created="Sun, 25 May 2014 23:23:52 +0200"  >&lt;p&gt;Excuse me for that stupid screenshot. I tested for about half an hour watching a naturally generated village, turning night on and off, rain+thunder on and off, and almost all the houses were occupied by one or more villagers. finally, subj looks like resolved now. &lt;/p&gt;</comment>
                            <comment id="160188" author="vit" created="Sun, 25 May 2014 23:02:38 +0200"  >&lt;p&gt;okay, maybe you&apos;re right, that was wrong experiment&lt;br/&gt;
need to test more&lt;/p&gt;


&lt;p&gt;btw, I edited post only 1 time, don&apos;t know whats wrong&lt;/p&gt;</comment>
                            <comment id="160185" author="kumasasa" created="Sun, 25 May 2014 22:43:40 +0200"  >&lt;p&gt;&lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=Vit&quot; class=&quot;user-hover&quot; rel=&quot;vit&quot;&gt;Vit&lt;/a&gt;, what you&apos;re seeing is &lt;a href=&quot;https://bugs.mojang.com/browse/MC-10046&quot; title=&quot;Random destination routine has a small statistical tendency to move more north west (fix included)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-10046&quot;&gt;&lt;del&gt;MC-10046&lt;/del&gt;&lt;/a&gt;, maybe that&apos;s still not properly fixed.&lt;/p&gt;</comment>
                            <comment id="160184" author="ileon" created="Sun, 25 May 2014 22:26:46 +0200"  >&lt;p&gt;Vit stop editing you post 1000 times.&lt;/p&gt;</comment>
                            <comment id="160177" author="psusi" created="Sun, 25 May 2014 21:37:51 +0200"  >&lt;p&gt;That isn&apos;t valid villager housing Vit... you just have a bunch of villagers contained in a wall, with some random doors outside.&lt;/p&gt;</comment>
                            <comment id="160169" author="vit" created="Sun, 25 May 2014 21:11:20 +0200"  >&lt;p&gt;sup guys&lt;br/&gt;
tested it on 14w21b, and the bug is still present&lt;br/&gt;
added screenshot as a proof&lt;/p&gt;</comment>
                            <comment id="160158" author="brickman350" created="Sun, 25 May 2014 20:01:32 +0200"  >&lt;p&gt;Yes, everyone test this in snapshot 14w21b, it is finally fixed.&lt;/p&gt;</comment>
                            <comment id="160143" author="psusi" created="Sun, 25 May 2014 18:19:55 +0200"  >&lt;p&gt;This bug has been fixed.  A mod should update the status.&lt;/p&gt;</comment>
                            <comment id="159818" author="fatputtycat" created="Sat, 24 May 2014 19:10:42 +0200"  >&lt;p&gt;So I created a world a while back, and I encountered a village with this bug (which ALL villages might have) and I thought that I could fix it, since I was in creative mode I just made a bunch of Iron Golems. For about 2 minutes the villager&apos;s went on with there usual routine. Until suddenly they just ran back into there houses, it was day, there were no hostile mobs about, the only mobs in the city were the villagers and the Iron Golems. Have I possibly ran into something that could maybe, just maybe fix the bug? Or do we have to wait until somebody at Mojang cares enough to have this fixed so once again the villages can be another pretty atribute to this pretty and scary game?&lt;/p&gt;</comment>
                            <comment id="154054" author="brickman350" created="Wed, 30 Apr 2014 21:10:02 +0200"  >&lt;p&gt;It&apos;s been fixed in 1.8, I&apos;ve seen many naturally generated villages in 1.8 and the only bug I see is an inbalance in villager professions. No AI issues like this, like in 1.7, it&apos;s finally fixed.&lt;/p&gt;</comment>
                            <comment id="149759" author="bugi74" created="Thu, 3 Apr 2014 11:05:20 +0200"  >&lt;p&gt;I&apos;m not sure if that linked explanation is actually correct; I did similar (and even wider) code digging couple months before that (see earlier comment of mine dated 07/Feb/13), and while the village size/location algorithm is indeed, shall we say, weird, there are reasons for some its behaviour, and it does work, at least to some extent. (I did observe its behaviour for quite a bit, as part of trying to debug/fix another bug/problem related to village size, and it does some really &quot;wtf&quot; stuff at times, but it did provide a usable village about all the time.)&lt;/p&gt;

&lt;p&gt;Village size/position algorithm does play a little bit in the overall mess causing this issue, but it is not the biggest reason. Or at least wasn&apos;t back then. (I haven&apos;t looked at the code since, things may have changed, though considering Mojang&apos;s bugfixing history so far, quite likely the code leading to this issue is still about the same.)&lt;/p&gt;

&lt;p&gt;EDIT: after reading rest of that linked forge thread; that earlier comment of mine provides some proposed code changes that I tested to reduce the villager crowding to manageable level. Not full fixes, though, as they would have required far too big code changes to be categorized as fixes and/or shown in a comment and/or too large a wasted effort.&lt;/p&gt;</comment>
                            <comment id="149743" author="kiel814" created="Thu, 3 Apr 2014 04:46:26 +0200"  >&lt;p&gt;Someone seems to have found the issue. Apparently the algorithm for expanding the villages is not very effective and is causing villages to shrink instead of expand.&lt;br/&gt;
The analisys of the code seems very thorough, I will not copy it here because it is too long, but you can find it here:&lt;br/&gt;
&lt;a href=&quot;http://www.minecraftforge.net/forum/index.php/topic,7351.0.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.minecraftforge.net/forum/index.php/topic,7351.0.html&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="147848" author="vit" created="Mon, 17 Mar 2014 17:18:27 +0100"  >&lt;p&gt;actualy, they are..&lt;/p&gt;</comment>
                            <comment id="147821" author="jamalcolmson" created="Mon, 17 Mar 2014 16:13:38 +0100"  >&lt;p&gt;Breaking down the door of the building they are all crowding into causes them all to immediately target a different building, but they all target it together, almost like all the villagers are just one mind.&lt;/p&gt;</comment>
                            <comment id="142294" author="vit" created="Fri, 21 Feb 2014 19:33:13 +0100"  >&lt;p&gt;I agree to Thomas, let the moderators decide&lt;/p&gt;</comment>
                            <comment id="142286" author="clockspiral" created="Fri, 21 Feb 2014 19:11:09 +0100"  >&lt;p&gt;Let&apos;s not jump ta conclusions until we get an official word in on the bug status first....&lt;br/&gt;
Don&apos;t wanna jinx it now....&lt;/p&gt;</comment>
                            <comment id="142273" author="psusi" created="Fri, 21 Feb 2014 17:49:33 +0100"  >&lt;p&gt;From what I can see, I&apos;d say this is finally fixed!&lt;/p&gt;

&lt;p&gt;Over the last day or two I have taken a natural village and built up two apartment buildings with 6 doors on each side and two stories high and bred the population up above the 2 iron golem threshold, and they appear to be spreading nicely.  There are often a number of people in the apartment buildings, but I would expect this given that they have so many doors.  Before if they did decide to occupy such a building ( and generally they wouldn&apos;t since they all picked one building to crowd into ), they generally would all gravitate to a single door,  but now they appear to spread around the building nicely, and there are still generally 1-2 villagers spread around in most of the other buildings as well.  Almost more importantly, they no longer constantly slam the door open and closed!&lt;/p&gt;
</comment>
                            <comment id="140987" author="antofthy" created="Mon, 17 Feb 2014 02:02:16 +0100"  >&lt;p&gt;From tests seen on the forum so of the new &apos;spread&apos; may be caused by farmers now migrating toward farms.&lt;/p&gt;

&lt;p&gt;It is hard to say if it is fixed or not, except maybe in a village that has no farmers.&lt;/p&gt;

&lt;p&gt;The general migration toward North-West is an issue with all mobs (and there should be a separate bug report about that).  If villager AI is fixed this general migration should not be a problem with villagers.&lt;/p&gt;</comment>
                            <comment id="140637" author="brickman350" created="Sat, 15 Feb 2014 21:35:24 +0100"  >&lt;p&gt;Yeah, I&apos;ve also noticed the AI changes have changed the way vilagers view village boundaries. In the snapshots, villagers seem to wander far more outward of a village then before, but there are boundaries farther out they will not cross, suggesting that village boundaries have been increased.&lt;/p&gt;</comment>
                            <comment id="140497" author="taiwroal" created="Sat, 15 Feb 2014 16:07:11 +0100"  >&lt;p&gt;I agree that this effect was likely the interaction of multiple rules in the Villager AI, and also that the behavior is much improved in the latest snapshot.  &lt;/p&gt;

&lt;p&gt;I have a pre-existing artificial village where I&apos;ve evaluated this.  It is a very large village, built under a 101 meter diameter glass dome to protect from mobs.  Inside the dome are two concentric 5-story rings of apartments.  Total is approximately 700 doors.  (I can&apos;t begin to count the villagers, or even the iron golems with them moving in and out among the structures.)&lt;/p&gt;

&lt;p&gt;With 1.7.4 the vast majority of villagers conglomerated, day or night, on the first floor on the northwest edge of the outer ring.  With 14w07a they definitely spread out a lot more, some even venturing outside the dome.  Large crowds will gather in the central park/forest, and others will gather at the north end of the dome where a natural river passes inside the dome.  Some of these villagers will play in the water.  (All we need now is a rubber duck.  Where did I leave that chicken??  &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;  They &lt;em&gt;do&lt;/em&gt; still seem to be biased to the northwest (even after many day/night cycles in 14w07a), but not nearly so strongly as before.&lt;/p&gt;

&lt;p&gt;Part of me would like to see this AI taken a step farther where villagers would socialize during the day but would tend to associate themselves with particular doors (apartments) at night, generally trying to return to the same door (making it easier at night to find a particular villager offering a particular trade), and trying harder to spread themselves uniformly among doors within the community at night.  Children at night would tend to go home with their parents.  But, what I see in 14w07a is a huge improvement in the AI, and makes creating large villages more interesting than they were with the old AI.&lt;/p&gt;</comment>
                            <comment id="140495" author="vit" created="Sat, 15 Feb 2014 16:01:23 +0100"  >&lt;p&gt;i thought these bugs are pretty much related each other.. ok, need to see the code or do a lot of experiments ingame&lt;/p&gt;</comment>
                            <comment id="140490" author="bugi74" created="Sat, 15 Feb 2014 14:20:00 +0100"  >&lt;p&gt;@Vit Musienko: That scheme would test another bug (the movement tendency to north-west). Also, single building (well, a &quot;valid door&quot;) is not enough to test all the bugs in this issue, unless they are distant enough. The requirements for testing is large enough area for villagers to move around during day (large enough to get past certain distances in their AI code), and enough buildings spread over large enough area to chose the place to stay the nights. And also no other things messing up the test, like zombies.&lt;/p&gt;

&lt;p&gt;Note that villagers do have (or at least had) a specific AI goal to gather a bit into groups (close some other villager), but they also have/had the ability to go away, too. It is the interplay of multiple mechanism, some badly implemented or bugged, that makes up the whole issue. My earlier comment should have some of the details...&lt;/p&gt;</comment>
                            <comment id="140487" author="vit" created="Sat, 15 Feb 2014 14:06:24 +0100"  >&lt;p&gt;A lot easier way is to make a walled square in flatland world on peacefull diff. and surround it with a bunch of doors (like as a simple villager&apos;s breeding farm), then put some villagers inside and see where they like to hang most of time. With topic&apos;s bug, they would like to be in north-west corner, I guess, not sure, and without they have to spread all around, the density should be normal in this whole square area. It would be great, if someone tests it with the latest snapshot and makes some screenshots during the process, so the community will be able to make a conclusion&lt;/p&gt;</comment>
                            <comment id="140451" author="bugi74" created="Sat, 15 Feb 2014 10:10:09 +0100"  >&lt;p&gt;@Paul Smith, the test you described is not quite a valid test for this issue.&lt;/p&gt;

&lt;p&gt;The issue may have been fixed, but a better test would be simply to find a large naturally generated village (or create one, the more villagers the better), no zombies to spread them around (the villagers should spread all by themselves), and wait for at least one full day or preferable more than a day (can use peaceful to avoid night time troubles with zombies). There are two mechanisms that group the villagers, the other being the start of night, so rolling through multiple nights should amplify that to be easier to detect its effect.&lt;/p&gt;

&lt;p&gt;Then check the results.&lt;/p&gt;</comment>
                            <comment id="140413" author="brickman350" created="Sat, 15 Feb 2014 06:15:43 +0100"  >&lt;p&gt;Well, I set up 5 houses, each with double doors. 3 on one side, 2 on the other, small huts, equal size. I spawned about 20 villagers or so, and put a zombie in the middle to spread them all out. I waited a few minutes, turned the time to night, and all the houses had about an equal number of villagers. So basically what this means is that WE&apos;RE SAVED!&lt;/p&gt;</comment>
                            <comment id="140295" author="vit" created="Fri, 14 Feb 2014 20:24:45 +0100"  >&lt;p&gt;So, it seems, that last snapshot&apos;s villager&apos;s ai prevents crowding in single house, am I understood it right? Can anyone prove it?&lt;/p&gt;</comment>
                            <comment id="140289" author="gomer672" created="Fri, 14 Feb 2014 20:09:23 +0100"  >&lt;p&gt;I noticed that the villagers have spread out as well in 14w06b, but in 14w07a they seem to hang out at one end of town again although in different houses. I will hang around to see if the door locator was just reset and they need to find the doors again.&lt;br/&gt;
I might create another village elsewhere to test this where closer to my current build site.&lt;br/&gt;
The new trade options seem to show up after making a trade with the old villagers. I am going to make some more homes to see what happens when they breed. &lt;/p&gt;</comment>
                            <comment id="140050" author="brickman350" created="Fri, 14 Feb 2014 08:28:26 +0100"  >&lt;p&gt;Guys I noticed this bug is be fixed in the latest 1.8 snapshots with the villager AI updates! We&apos;re saved!&lt;/p&gt;</comment>
                            <comment id="137069" author="gomer672" created="Sat, 1 Feb 2014 04:06:05 +0100"  >&lt;p&gt;I built a rail loop around my village to get villagers to the other side of the village, but they keep going back to the same building regardless of where I release them from the minecart. I even cured a zombie in one of the unused houses, and after he was cured he went to the other side to socialize with the rest. Interestingly they congregate in a house that I built, as opposed to the ones generated by the game. ver 1.7.4&lt;/p&gt;</comment>
                            <comment id="136111" author="maxcheat" created="Wed, 29 Jan 2014 16:38:34 +0100"  >&lt;p&gt;yes they run all the time during day is the same bug with &lt;a href=&quot;https://bugs.mojang.com/browse/MC-17247&quot; title=&quot;Villagers running all the time&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-17247&quot;&gt;&lt;del&gt;MC-17247&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
test it i create 3 villages one plain one desert one savana and only in plain work fine no problem&lt;br/&gt;
i have test it in SSP and on MSP same thing happen:&lt;br/&gt;
at desert and savana during day they RUN all the time in ONE bulding &lt;/p&gt;

&lt;p&gt;minecraft 1.7.4   /  minecraft server 1.7.4&lt;/p&gt;</comment>
                            <comment id="136107" author="mineplacidcat" created="Wed, 29 Jan 2014 16:11:26 +0100"  >&lt;p&gt;David - that&apos;s good to know. Are you able to (or have you already) add your observations to &lt;a href=&quot;https://bugs.mojang.com/browse/MC-17247&quot; title=&quot;Villagers running all the time&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-17247&quot;&gt;&lt;del&gt;MC-17247&lt;/del&gt;&lt;/a&gt;? Perhaps also add your seed and coordinates of village(s) that are affected?&lt;/p&gt;</comment>
                            <comment id="136106" author="fienxjox" created="Wed, 29 Jan 2014 16:02:59 +0100"  >&lt;p&gt;I have seen both the crowding and speed issues in both (naturally generated but expanded) villages I have - one in a plains biome, the other in a desert.&lt;/p&gt;</comment>
                            <comment id="136102" author="mineplacidcat" created="Wed, 29 Jan 2014 15:50:24 +0100"  >&lt;p&gt;mad max - by any chance, do you also have issues with villagers constantly running? If so, I wonder if in your case the crowding and the speed are interrelated. It has been observed that the &quot;always running&quot; issue is potentially biome-dependent.&lt;/p&gt;

&lt;p&gt;I have personally observed crowding in plains biomes as well as others.&lt;/p&gt;</comment>
                            <comment id="136096" author="psusi" created="Wed, 29 Jan 2014 14:55:16 +0100"  >&lt;p&gt;No, the biome does not matter.&lt;/p&gt;</comment>
                            <comment id="136080" author="maxcheat" created="Wed, 29 Jan 2014 13:05:25 +0100"  >&lt;p&gt;hi i make some testing about the problem and i notice that in some biomes the villages work fine &lt;br/&gt;
like plane biome&lt;/p&gt;

&lt;p&gt;the biomes that have the problem are desert and savana&lt;/p&gt;

&lt;p&gt;Minecraft 1.7.4&lt;/p&gt;</comment>
                            <comment id="133860" author="dtschaedler" created="Thu, 23 Jan 2014 14:22:53 +0100"  >&lt;p&gt;There is a slight problem with this too. The villagers are only supposed to fill about 2/3 the amount of doors i believe, so there will always be empty houses unless you destroy them.&lt;/p&gt;</comment>
                            <comment id="129744" author="bugi74" created="Thu, 9 Jan 2014 12:07:41 +0100"  >&lt;p&gt;@Anthony Thyssen:&lt;br/&gt;
&quot;But there is no code to make villagers want a bit of elbow room and spread out to prevent overcrowding.&quot;&lt;/p&gt;

&lt;p&gt;Actually, there is a bit of such code. It just doesn&apos;t really work. My earlier comment(s) elaborate on that.&lt;/p&gt;</comment>
                            <comment id="129725" author="insomniac_lemon" created="Thu, 9 Jan 2014 03:01:26 +0100"  >&lt;p&gt;Anthony, yes in fact, it&apos;s generally in human nature (or pre-conditioned into modern society) to evenly distribute among options. For instance, in a bus or waiting room, people will often choose the seat furthest away from others. For instance, someone sits in the front, someone sits in the back, someone sits in the middle.  It&apos;d be odd to sit right next to a complete stranger when there aren&apos;t any other taken seats.&lt;/p&gt;</comment>
                            <comment id="129719" author="antofthy" created="Thu, 9 Jan 2014 01:51:07 +0100"  >&lt;p&gt;agilerelic...  that is irrelevant to the discussion.  The problem is not over population, or villagers building new houses.  It is the problem that in a large village, the villagers like each other so much they all decide to live in one house, even though there are LOTS of houses in the village.&lt;/p&gt;

&lt;p&gt;The crowding also causes them to climb ladders to village roofs, or even into jungle trees, which they otherwise would not do.&lt;/p&gt;

&lt;p&gt;There is code that was added when villages were first created, to make villagers &apos;socalize&apos;. This worked fine for normal small villages. But there is no code to make villagers want a bit of elbow room and spread out to prevent overcrowding.&lt;/p&gt;

&lt;p&gt;We humans, like to socialize, but we also do not like to over crowd.  Even in a &apos;party&apos; everyone has a personal space.  Of course we learned to suspend that instinct in special situations such as for lifts, or peak hour trains and buses, but generally we try not to &apos;crowd&apos;. Especially in a home or other social situations.&lt;/p&gt;

&lt;p&gt;Villagers need something similar.&lt;/p&gt;</comment>
                            <comment id="129687" author="agilerelic" created="Thu, 9 Jan 2014 01:21:12 +0100"  >&lt;p&gt;&lt;a href=&quot;https://twitter.com/jonkagstrom/status/174393910607622144&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://twitter.com/jonkagstrom/status/174393910607622144&lt;/a&gt; &quot;Also we think it&apos;s the players task to build&quot; -Jonkagstrom&lt;/p&gt;</comment>
                            <comment id="128591" author="mistersanderson" created="Wed, 1 Jan 2014 16:06:59 +0100"  >&lt;p&gt;Still present in 1.7.4.&lt;/p&gt;</comment>
                            <comment id="128512" author="cadogan01" created="Tue, 31 Dec 2013 21:19:34 +0100"  >&lt;p&gt;OK, I have another suggestion. So each villager does NOT look at the same door, I&apos;ve added this as the first line in the method:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Collections.shuffle(&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.villageDoorInfoList);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;It randomizes the order the villagers look at the doors.&lt;/p&gt;</comment>
                            <comment id="126008" author="bugi74" created="Fri, 20 Dec 2013 21:20:57 +0100"  >&lt;p&gt;That one is basically 98% probability. Considering the context, it will randomize the timing of when they decide to get in. That should reduce the chance of everybody rushing to the same door at once, but unfortunately, the restriction timers had their effect rather dysfunctional, so...&lt;/p&gt;

&lt;p&gt;The best idea in your suggestion is the idea to calculate the villagers near the door (bypasses the currently failing counter). However, it also makes it either-or; either counter only, or distance only (for distant ones); the current math mixes both in order to do both: spreading villagers in houses &lt;em&gt;and&lt;/em&gt; keeping travel distances short, in a smooth way. There is no need to adjust that mixing behavior, as long as the distance weight and villager counting work properly. (However, as a temporary adjustment, yours is just as valid as the changes proposed by me; it does improve the situation.)&lt;/p&gt;

&lt;p&gt;Note that while your change may get better counting of villagers already inside, it does not count villagers still on the way to that door. That is one of the problems making the current algorithm near useless; villagers will go to just one to few doors, then keep fighting in front of for a while, until some time later possibly choose another one. Ideally, most of them should choose different houses before even starting to move anywhere for that night, and the few that end up choosing the same houses with another villager would consider the situation acceptable once they realize they have to share the house or to run possibly a long distance across the village; unless there is a vacant one nearby.&lt;/p&gt;

&lt;p&gt;The thing is, if you want to try to &quot;fix it good&quot;, you need to consider multiple bugs/design flaws/issues/improvements at once; while it might be possible to get a nice improvement by adjusting one part of it, the rest will come back haunting sooner or later. Hint: take a look at &lt;a href=&quot;https://bugs.mojang.com/browse/MC-10841&quot; title=&quot;Villages are persisted to NBT, yet still destroyed/recreated on chunk reload&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-10841&quot;&gt;&lt;del&gt;MC-10841&lt;/del&gt;&lt;/a&gt; and think how it affects this issue, too.&lt;/p&gt;</comment>
                            <comment id="126003" author="cadogan01" created="Fri, 20 Dec 2013 20:41:39 +0100"  >&lt;p&gt;One more thing. In &lt;tt&gt;EntityAIMoveIndoors.java&lt;/tt&gt;, in the &lt;tt&gt;shouldExecute&lt;/tt&gt; method, what is this line for?&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.entityObj.getRNG().nextInt(50) != 0)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="126001" author="cadogan01" created="Fri, 20 Dec 2013 20:35:52 +0100"  >&lt;p&gt;I only asked because I lack confidence in my own code.&lt;/p&gt;

&lt;p&gt;Here is what I have:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Village.java&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    /**
     * Find a door suitable &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; shelter. If there are more doors in a distance of 16 blocks, then the least restricted
     * one (i.e. the one protecting the lowest number of villagers) of them is chosen, &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; the nearest one regardless
     * of restriction.
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; VillageDoorInfo findNearestDoorUnrestricted(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; coordX, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; coordY, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; coordZ)
    {
        VillageDoorInfo bestDoor = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
        VillageDoorInfo bestDoorOver16 = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; sqrdDistance;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lowestOver16 = &lt;span class=&quot;code-object&quot;&gt;Integer&lt;/span&gt;.MAX_VALUE;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lowestCount = &lt;span class=&quot;code-object&quot;&gt;Integer&lt;/span&gt;.MAX_VALUE;
        Iterator var6 = &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.villageDoorInfoList.iterator();

        &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; (var6.hasNext())
        {
            VillageDoorInfo someDoor = (VillageDoorInfo)var6.next();
            sqrdDistance = someDoor.getDistanceSquared(coordX, coordY, coordZ);

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (sqrdDistance &amp;lt;= 256)
            {
            	&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; useCounter; &lt;span class=&quot;code-comment&quot;&gt;//someDoor.getDoorOpeningRestrictionCounter();
&lt;/span&gt;            	
            	&lt;span class=&quot;code-comment&quot;&gt;// Count villagers behind the door
&lt;/span&gt;            	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;(someDoor.insideDirectionX==0)
            	{
            		useCounter = &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.worldObj.getEntitiesWithinAABB(EntityVillager.class, AxisAlignedBB.getAABBPool().getAABB(someDoor.posX-6, someDoor.posY-2, someDoor.insideDirectionZ&amp;lt;0 ? someDoor.posZ-5 : someDoor.posZ, someDoor.posX+6, someDoor.posY+2, someDoor.insideDirectionZ&amp;lt;0 ? someDoor.posZ : someDoor.posZ+5)).size();
            	}
            	&lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
            	{
            		useCounter = &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.worldObj.getEntitiesWithinAABB(EntityVillager.class, AxisAlignedBB.getAABBPool().getAABB(someDoor.insideDirectionX&amp;lt;0 ? someDoor.posX-5 : someDoor.posX, someDoor.posY-2, someDoor.posZ-6, someDoor.insideDirectionX&amp;lt;0 ? someDoor.posX : someDoor.posX+5, someDoor.posY+2, someDoor.posZ+6)).size();
            	}
            	
            	&lt;span class=&quot;code-comment&quot;&gt;// Is &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; count better than previous counts
&lt;/span&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (useCounter &amp;lt; lowestCount)
                {
                    bestDoor = someDoor;
                    lowestCount = useCounter;                
                }
                
                &lt;span class=&quot;code-comment&quot;&gt;// The best door is the one not used, stop looking
&lt;/span&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (useCounter == 0)
                {
                	&lt;span class=&quot;code-keyword&quot;&gt;break&lt;/span&gt;;
                }
            }
            &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (sqrdDistance &amp;lt; lowestOver16)
            {
            	lowestOver16 = sqrdDistance;
            	bestDoorOver16 = someDoor;
            }

        }

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; bestDoor != &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ? bestDoor : bestDoorOver16;
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="125995" author="bugi74" created="Fri, 20 Dec 2013 20:14:00 +0100"  >&lt;p&gt;Indeed, if the distances were only compared against each other (that is, pick the nearest door and thats it), the squared would be perfect. (Note though, taking square root in this particular context isn&apos;t an efficiency problem, as it is not done that many times; compare to the horribly unoptimized and otherwise resource hogging path finding algorithm).&lt;/p&gt;

&lt;p&gt;However, what the code tries to achieve is something like &quot;a door that is near and/or has few or no other villagers in already&quot;. That is why it needs to give some &quot;weight&quot; for both distance and the amount of villagers already in (&quot;restriction counter&quot;). Some kind of weighting or mixing for both needs to be used, whether by math or logic; math is just typically an easy way to mix them.&lt;/p&gt;

&lt;p&gt;Not only is the restriction not working well, the timing of the stuff happens to be such that at the moment tens of villagers pick a door, none of the doors are restriced... They only start restricting once each villager gets inside.&lt;/p&gt;

&lt;p&gt;If you do have a possible solution, just tell it, no need to ask. Not that giving solutions (or even fixed source codes) affects anything in here &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/tongue.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="125991" author="cadogan01" created="Fri, 20 Dec 2013 19:48:55 +0100"  >&lt;p&gt;It was the &quot;weighted&quot; that through me off. It doesn&apos;t seem weighted to me at all. They seem to be using the square of the distance for efficiency. Rather than getting the square root of every formula and comparing it to 16; they were simply comparing it to 256 (16 squared).&lt;/p&gt;

&lt;p&gt;That doesn&apos;t seem to be a problem. However, using the same variable to compare distance and &quot;restriction counter&quot; is a problem. Using two separate variables would not only be significantly less confusing but more reliable as well.&lt;/p&gt;

&lt;p&gt;Even worse, as you say, the &quot;restriction&quot; counter fails to increment when a villager &quot;goes inside&quot;.&lt;/p&gt;

&lt;p&gt;I believe I have a solution, would you like it?&lt;/p&gt;</comment>
                            <comment id="125986" author="bugi74" created="Fri, 20 Dec 2013 18:56:25 +0100"  >&lt;p&gt;The squared distance was already calculated by the existing code, I just took square root of that. So +3 and -4 gives the classic squared value 3*3 + 4*4 = 25, and square root of that is 5 (used as the base distance after my modification). Multiplied by 4 gives 20. The big difference is the squared vs. linear growth of the resulting &quot;weight&quot;; squared value will grow very rapidly after real distance of about 5-6 blocks, making the search function very very biased to nearby doors. The multiplication factor of 4 was just something giving somewhat similar values for the nearby doors with my modified weight, in order to try and keep it working the same way with the restriction counter...&lt;/p&gt;

&lt;p&gt;... But those distances and weights are only one minor part of the problem. A large part of the algorithm is played by a some sort of &quot;restriction counter&quot; (MCP terms?), but that counter isn&apos;t working well (read, pretty much not at all).&lt;/p&gt;</comment>
                            <comment id="125964" author="cadogan01" created="Fri, 20 Dec 2013 15:31:05 +0100"  >&lt;p&gt;@Markku In your previous comment you mentioned changing the door selection from distance squared to distance linear. How did you determine distance? For instance, if a door was +3X and -4Z would the distance be 7 weighted by multiplying it  times 4?&lt;/p&gt;</comment>
                            <comment id="125907" author="fienxjox" created="Thu, 19 Dec 2013 20:59:58 +0100"  >&lt;p&gt;I have to concur with Dan&apos;s comment on this limiting trading in a serious manor.  I have had to spend time building a (albeit very simple) villager trading system away from the village to enable me to make trades.&lt;/p&gt;

&lt;p&gt;I would caution on just doing a random selection of a &quot;valid&quot; door for each villager, some doors may be valid in the village calculation but not be reachable by a villager.  One that comes to mind is those leading to a fenced off garden.  I also know people like to add second stories to buildings (or even make gigantic apartments) wherein only the lower / ground level doors are accessible.  No doubt a spreading algorithm could take this into account (hostile mob AIs already know how to detect if they can reach an area by pathing), but it would add some additional level of complexity.&lt;/p&gt;</comment>
                            <comment id="125905" author="mineplacidcat" created="Thu, 19 Dec 2013 20:41:29 +0100"  >&lt;p&gt;I will concede to the likes of Markku who has obviously had more experience testing this (I&apos;ve only encountered it in a couple of villages when playing survival). I will mention that it&apos;s my recollection that a villager in a defined village (i.e. a collection of &quot;valid doors&quot;) should be aware of the doors in the village, and not just a small portion of the village. Given that, is there any good reason why one couldn&apos;t have a villager simply choose, at random, a door to enter each night? I get the social behavior aspect of it, but it seems that could be re-balanced with a door picking algorithm so that such concentrations don&apos;t occur.&lt;/p&gt;

&lt;p&gt;There is obviously a &quot;spread&quot; algorithm for players that ops can use for server games. Something similar (a dispersion algorithm) would be handy when having villagers determine what door to go to at night. Being a programmer myself, I know that it is far easier to say what to do than to actually do it (in particular when working with an algorithm that has been part of a program for some time) but this affects so many people for so long and the interest is so high, it seems like there should be more interest on the part of developers to fix it at some point. My village is largely useless as I can&apos;t trade with the villagers due to the chaos.&lt;/p&gt;</comment>
                            <comment id="125901" author="bugi74" created="Thu, 19 Dec 2013 19:21:31 +0100"  >&lt;p&gt;In order to reproduce this, the number of doors in houses does not matter. What matters is the relative locations of &quot;valid doors&quot; in the village and also where the villagers happen to be at the time they want to rush into houses, and of course the number of villagers. Due to villagers&apos; behavior coding, they tend to be near each other and nearer to center of the village at day time, and then the algorithm to pick the door to get in at night fall has some &quot;issues&quot; that make the villagers even more concentrated.&lt;/p&gt;

&lt;p&gt;In a small village, the random distribution of villagers after the day and the small search space end up covering large part of that small village, so it may look like it almost works, at least occasionally. But in a large village, the algorithms and statistics work it out so that the symptoms are seen more easily.&lt;/p&gt;

&lt;p&gt;Without testing it myself (I did enough of that while doing and testing the code improvements listed in an earlier comment, here &lt;a href=&quot;https://mojang.atlassian.net/browse/MC-78?focusedCommentId=44199&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-44199&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mojang.atlassian.net/browse/MC-78?focusedCommentId=44199&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-44199&lt;/a&gt;), I&apos;ll throw an educated guess what might be a good test village:&lt;br/&gt;
Make all houses smallish and with a single door, spread many around the &quot;perimeter&quot; of the village, few in the medium distance from the center, and one in the center. Make the village symmetric (aboutish, for the doors; house shapes/sizes do not matter). As villagers tend to be closer to center than the perimeter during the day, they will likely end up going into one of the houses near or at the center.&lt;/p&gt;

&lt;p&gt;Getting the villagers spread so that they see all the doors/houses might be tricky, though, might need to block some of the villagers into houses at the perimeter. (Even in a normal large village, e.g. using superflat, the villagers can occasionally &quot;forget&quot; a part of their village). Or something. Can&apos;t remember well any more, 10 months past...&lt;/p&gt;

&lt;p&gt;NOTE: IIRC, there has been some changes to village code since, so some of my findings might not be valid any more.&lt;/p&gt;</comment>
                            <comment id="125886" author="mineplacidcat" created="Thu, 19 Dec 2013 17:55:07 +0100"  >&lt;p&gt;In my case, the village was naturally spawned. The structure I built was within a few meters of other naturally spawned buildings in the village - probably only 10-15 meters from the house I destroyed that was the original target of all the villagers. Any additional villagers were not &quot;spawned&quot; by me but were a result of breeding due to the additional doors. My building was most certainly considered part of the existing village due to the game&apos;s rules. When I tore down the original target home, all the villagers then swarmed to a single &quot;corner&quot; of my large cabin.&lt;/p&gt;</comment>
                            <comment id="125884" author="psusi" created="Thu, 19 Dec 2013 17:42:15 +0100"  >&lt;p&gt;It happens both with naturally spawned and player created villages, though with the bare handful of villagers that naturally spawn it isn&apos;t as easy to see the problem, but it is there if you look for it.  Each villager picks a door to be their &quot;home&quot; and tries to stand just on the inside of it at night.  A good naturally spawned village might have 10 houses with one or two doors each and 5 or 6 villagers.  If you watch them at night they always return to the same one or two houses and ignore the others.  Of course most natural villages only have two or three houses and only 3 or 4 villagers, so you won&apos;t be able to tell there.  Creating a superflat world seems to make more villages spawn, and spawn more houses.&lt;/p&gt;
</comment>
                            <comment id="125882" author="cadogan01" created="Thu, 19 Dec 2013 17:07:16 +0100"  >&lt;p&gt;OK, were the villages generated automatically and then you spawned more villagers or did you build a bunch of houses and spawn villagers in the middle of nowhere? &lt;/p&gt;</comment>
                            <comment id="125881" author="mineplacidcat" created="Thu, 19 Dec 2013 17:07:12 +0100"  >&lt;p&gt;Correct. It doesn&apos;t matter the size of the house. The doors are the key. Please educate yourself here: &lt;a href=&quot;http://minecraft.gamepedia.com/Tutorials/Village_mechanics&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://minecraft.gamepedia.com/Tutorials/Village_mechanics&lt;/a&gt; if you are unsure about how to create additional housing and why you might do it. Particularly concentrate on the &quot;Player-made Village designs&quot; section which shows how to make large cabins of the sort I&apos;m discussing. &lt;/p&gt;

&lt;p&gt;What I&apos;m doing is not the cause - the issue was there before I created my large house/cabin. I only saw the issue grow as the population grew due to the additional housing I created.&lt;/p&gt;</comment>
                            <comment id="125876" author="5thhorseman" created="Thu, 19 Dec 2013 15:05:27 +0100"  >&lt;p&gt;Trust me (or don&apos;t and try it yourself though it&apos;ll take a lot longer than the one-house-72-doors example). If you make 72 houses each with one door, they&apos;ll all crowd into 1-3 of those houses.&lt;/p&gt;</comment>
                            <comment id="125874" author="filter62" created="Thu, 19 Dec 2013 13:43:37 +0100"  >&lt;p&gt;Houses with 72-doors? What? Doesn&apos;t house usually have 1 door? I think I see your problem.&lt;/p&gt;</comment>
                            <comment id="125873" author="mineplacidcat" created="Thu, 19 Dec 2013 12:18:36 +0100"  >&lt;p&gt;I have a village in which this happened and where I had created a large house with 72 doors. All the villagers crammed into one of the small houses which became so crowded I decided to destroy it to see what would happen. They, indeed, moved on and even moved into the large, 72-door house I had made. However, they all crammed into one small corner of the house. The issue is not just that they crowd into a single building but that they seem to gravitate to a specific geographic point as well.&lt;/p&gt;

&lt;p&gt;This village in question also is affected by the issue where the villagers are constantly running and going in and out of buildings as if they are panicked. It makes for a very noisy situation when near the 72-door house.&lt;/p&gt;</comment>
                            <comment id="125841" author="psusi" created="Thu, 19 Dec 2013 04:25:42 +0100"  >&lt;p&gt;Grow your village to 20-30 villagers.  If you have only 4 houses with 4 doors each, it&apos;s a bit hard to see.  Get 10 houses with 6 doors each and you will find only most of them gather in one or two of them.  I often build a few houses with 8 doors each to enlarge a village and find that most of them huddle in one of the original homes with only a single door.  It is silly seeing a dozen people crowded into the 4 square feet in such a house.  Destroy that one small home and they move to a larger one with more doors, but they still tend to mostly gather in one home instead of spreading out.&lt;/p&gt;</comment>
                            <comment id="125836" author="cadogan01" created="Thu, 19 Dec 2013 02:57:37 +0100"  >&lt;p&gt;I&apos;m not seeing this problem. In a few of my villages I have 8 to 12 villagers. At night each there are 3 to 4 villagers in each house. What is the best way to reproduce this defect?&lt;/p&gt;</comment>
                            <comment id="125595" author="tokes" created="Tue, 17 Dec 2013 03:58:41 +0100"  >&lt;p&gt;I always assumed that they&apos;re all related in these cases (consider themselves a family unit). Note that if you destroy the door all the villagers will pick one of the other houses to all crowd in to. Killing all villagers (in creative mode so you don&apos;t get bad karma) and using spawn eggs to repopulate (putting them inside the house you want them to use) seems to work, although they often will pick a different house than the one you spawned them in.&lt;br/&gt;
Obviously a workaround is no substitute for the actual bug getting fixed.&lt;/p&gt;</comment>
                            <comment id="121370" author="clockspiral" created="Tue, 26 Nov 2013 18:36:23 +0100"  >&lt;p&gt;They oughta establish only one door ta be &quot;theirs&quot; at night, until broken or driven out.&lt;/p&gt;</comment>
                            <comment id="121278" author="kyoshinda" created="Tue, 26 Nov 2013 04:49:07 +0100"  >&lt;p&gt;I made it where there was a strip of glass 20 blocks long, did 5x20 doors on each side underneath, then made a house on top of it. They all crowd outside. lol&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://i.imgur.com/jOET70x.png&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://i.imgur.com/jOET70x.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Several problems with the op proposal, doing 1 per door is odd because each villager is worth 2.9 doors and what if, like in my example, some are impossible for the villager to reach?&lt;/p&gt;</comment>
                            <comment id="118366" author="firebird7" created="Sun, 10 Nov 2013 01:56:44 +0100"  >&lt;p&gt;I hope this really annoying bug gets more attention from Mojang for the upcoming 1.8 update. Currently I have to trap some of the villagers inside buildings in all corners of my village. If I don&apos;t do that they just forget most of the available doors and instead crowd in one corner of the village.&lt;br/&gt;
My village still has about 80 doors, 35 villagers and 4 golems but I almost lost interest in them because of this bug.&lt;br/&gt;
Oh and the door sounds are really annoying too.&lt;/p&gt;</comment>
                            <comment id="118335" author="insomniac_lemon" created="Sat, 9 Nov 2013 22:20:47 +0100"  >&lt;p&gt;Matthew Sladen, because Jonkagstrom was moved to the scrolls project shortly after he was hired and did and bit of basic AI work. So yeah, he&apos;s not working on Minecraft AI anymore even though that&apos;s why he was hired in the first place.&lt;/p&gt;

&lt;p&gt;David Truog, the truth is that many of these big issues go unnoticed. The &quot;quick fixes&quot; are usually the ones without assignees. Usually, if a big enough bug is confirmed by a Mojang-ster and they plan to spend time on it to fix it, they assign themselves. Some bugs are fixed without an assignee because their fix was already planned (not because of the ticket) or it was fixed accidentally and just stopped happening (related to another fix or even libraries, such as LWJGL bugs).&lt;/p&gt;</comment>
                            <comment id="118310" author="fienxjox" created="Sat, 9 Nov 2013 20:40:12 +0100"  >&lt;p&gt;@Matthew - we should note that many (or even most) of the tickets fixed in various versions never list an assignment on the individual tickets, and given the public visibility of this ticketing system I understand they wouldn&apos;t want to list a specific person for tickets so we don&apos;t have anyone to blame (other than Dinnerbone and Jeb anyway...)&lt;/p&gt;</comment>
                            <comment id="118307" author="uzumaki42" created="Sat, 9 Nov 2013 20:33:20 +0100"  >&lt;p&gt;This has 283 votes as of now and is over a year old, and STILL hasn&apos;t even been assigned yet. Why isn&apos;t Jonkagstrom on the case yet?&lt;/p&gt;</comment>
                            <comment id="117544" author="psusi" created="Mon, 4 Nov 2013 15:31:17 +0100"  >&lt;p&gt;The most annoying thing about this bug is that when they are all packed into the one house they are &lt;b&gt;constantly&lt;/b&gt; opening and closing the door, the sound of which is maddening.&lt;/p&gt;</comment>
                            <comment id="117542" author="interlogical" created="Mon, 4 Nov 2013 15:23:32 +0100"  >&lt;p&gt;I made 10 small buildings around a small area and 2/3&apos;s of my villagers crammed into one house.&lt;/p&gt;

&lt;p&gt;At first I find it funny because they run and cram in clusters but I realized the rest of the houses I built are now useless...&lt;/p&gt;</comment>
                            <comment id="116334" author="megashub" created="Mon, 28 Oct 2013 20:08:14 +0100"  >&lt;p&gt;Still present in 1.7.2.&lt;/p&gt;</comment>
                            <comment id="114448" author="likalaruku" created="Thu, 24 Oct 2013 04:38:59 +0200"  >&lt;p&gt;1.7.1 prerelease. It calmed down the past few snapshots, but they&apos;ve suddenly started cramming into a single building again.&lt;/p&gt;

&lt;p&gt;Villagers now spend their full time going into &amp;amp; out of one building. I even made sure the weather was clear.&lt;/p&gt;</comment>
                            <comment id="112862" author="insomniac_lemon" created="Sat, 19 Oct 2013 19:45:57 +0200"  >&lt;p&gt;This probably won&apos;t ever be fixed unless they transfer Jonkagstrom back to MC to finish what they originally hired him to do. House choosing/assigning needs to be done, and house detection needs to be done even more. Plus villagers need to be able to be better at defending themselves seeing as they are currently defenseless and even a couple of iron golems are not smart/fast enough to protect villagers.&lt;/p&gt;

&lt;p&gt;Villages need to generate fully lit (inside and out) and doored (with doors facing the right way), too.&lt;/p&gt;</comment>
                            <comment id="112846" author="vit" created="Sat, 19 Oct 2013 18:49:28 +0200"  >&lt;p&gt;Sure, it affects 13w42b&lt;br/&gt;
imho, nobody in moj* wants to get hands dirty in hardcoding like this bug requires to&lt;br/&gt;
one simple question: is that gonna be fixed until minecraft version 15w~? not sure it will&lt;/p&gt;</comment>
                            <comment id="112816" author="jeuvke" created="Sat, 19 Oct 2013 17:26:05 +0200"  >&lt;p&gt;Yes, corrected.&lt;/p&gt;</comment>
                            <comment id="112810" author="ezekielelin" created="Sat, 19 Oct 2013 17:18:59 +0200"  >&lt;p&gt;Do you mean 13w42b?&lt;/p&gt;</comment>
                            <comment id="112807" author="jeuvke" created="Sat, 19 Oct 2013 17:17:17 +0200"  >&lt;p&gt;Can partially reproduce in 13w42b. Some houses (mainly in the centre of the village) are much more populated than others.&lt;/p&gt;</comment>
                            <comment id="112778" author="ezekielelin" created="Sat, 19 Oct 2013 16:31:14 +0200"  >&lt;p&gt;Is this still a concern in the latest Minecraft version &lt;b&gt;13w42b&lt;/b&gt;? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.&lt;/p&gt;</comment>
                            <comment id="107625" author="bugi74" created="Sun, 29 Sep 2013 18:43:57 +0200"  >&lt;p&gt;@Andrew Thomas&lt;br/&gt;
For a better idea for the cause, check my old comment &lt;a href=&quot;https://mojang.atlassian.net/browse/MC-78?focusedCommentId=44199&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-44199&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mojang.atlassian.net/browse/MC-78?focusedCommentId=44199&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-44199&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That comment also provides some tested changes that make this problem less severe (to &quot;buy time&quot; to create a proper fix). (However, since Mojang isn&apos;t really using this JIRA properly, that idea of providing those change ideas has lost its point.)&lt;/p&gt;

&lt;p&gt;Note also that among the comments there is a link to a forum thread about discussing how a house should be defined (for the villagers), part of a proper fix. Though it is now so old thread that someone might call it &quot;necro&quot; if anyone ever replies in it &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/tongue.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="107124" author="vicr123" created="Sat, 28 Sep 2013 06:06:04 +0200"  >&lt;p&gt;&lt;font color=&quot;green&quot;&gt;&#9632;&lt;/font&gt; Confirmed on:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;HP ProBook4330s&lt;/li&gt;
	&lt;li&gt;Windows 7&lt;/li&gt;
	&lt;li&gt;Minecraft 1.6.4&lt;/li&gt;
	&lt;li&gt;Java 1.7.0_25&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="106696" author="hayes2232" created="Thu, 26 Sep 2013 22:48:02 +0200"  >&lt;p&gt;I agree with Wesley&apos;s statement. I have a large village with many doors and even half of the village is vacant, which the villagers mush together in one or two hotspots for a few rainy days or starry nights, only leaving to a new hotspot that is once again overcrowded, not spreading like butter like they should. I want a normal looking village with normal behaving villagers, not ones that want house parties every night. This is a problem that after all this time needs SOME attention and SOME kind of action.. Its slack not putting this as a top priority by this point in time.&lt;/p&gt;</comment>
                            <comment id="106691" author="5thhorseman" created="Thu, 26 Sep 2013 22:22:21 +0200"  >&lt;p&gt;Andrew, your analysis is incorrect. This has nothing to do with new behaviors (It was first reported a year ago) or distance between doors. I never build regular villages any more and instead build &quot;MegaVillage&quot;s with literally hundreds of doors in an area less than 4 square chunks (32x32). My villagers ALWAYS congregate in 2 or 3 areas at night, enough to push their fellow villagers through walls sometimes, into areas that a villager simply cannot go or (far more frequently) killing them with suffocation damage. &lt;/p&gt;

&lt;p&gt;They can see probably a hundred doors within 16 blocks, and it doesn&apos;t affect where they crowd. The only thing that you can do is cordon them off during the day and then they just crowd up next to the fence, trying to get to their shared &quot;home.&quot;&lt;/p&gt;</comment>
                            <comment id="106653" author="greatmastermario" created="Thu, 26 Sep 2013 20:42:10 +0200"  >&lt;p&gt;Confirmed in 1.7 snapshots through 13w39a.&lt;/p&gt;

&lt;p&gt;This is likely caused by how they detect doors in a village.&lt;/p&gt;

&lt;p&gt;Villagers only spawn once in the world. Therefore, they will stay in a certain part of a village unless they detect another door. &lt;/p&gt;

&lt;p&gt;To detect a valid door, they must be within 16 blocks long either axis. However, many times the spots villagers congregate in have no doors meeting this criteria (even though there are many more doors in the naturally spawning village). &lt;/p&gt;

&lt;p&gt;To fix this, simply build more intermediate houses between structures to entice villagers to new houses. This will both increase possible population cap of the official village, and spread them out.&lt;/p&gt;

&lt;p&gt;The other problem has to do with their social AI. Villagers tend to stay in groups of two or more and &quot;talk.&quot; This is part of the new AI where villagers gained some sort of psuedo-intelligence. This is another reason (and more likely) that villagers stick together.&lt;/p&gt;

&lt;p&gt;Check the end of this section for detection of door rule. &lt;a href=&quot;http://minecraft.gamepedia.com/Tutorials/Village_mechanics#Housing&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://minecraft.gamepedia.com/Tutorials/Village_mechanics#Housing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read this section for info on Villagers&apos; social tendencies:&lt;br/&gt;
&lt;a href=&quot;http://minecraft.gamepedia.com/Villager#Behavior&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://minecraft.gamepedia.com/Villager#Behavior&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="105018" author="ctt811" created="Sat, 21 Sep 2013 03:34:22 +0200"  >&lt;p&gt;They arent AI&apos;d properly and i hope they fix it in 1.7&lt;/p&gt;</comment>
                            <comment id="104254" author="darthriddle" created="Wed, 18 Sep 2013 07:02:21 +0200"  >&lt;p&gt;Bah, this is getting out of hand lol &lt;/p&gt;</comment>
                            <comment id="104253" author="darthriddle" created="Wed, 18 Sep 2013 07:02:07 +0200"  >&lt;p&gt;Still in 1.6.2 all villagers congregate in one area. Do we think there will eventually be a fix? Its comical for sure. &lt;/p&gt;</comment>
                            <comment id="83086" author="bugi74" created="Fri, 5 Jul 2013 07:43:16 +0200"  >&lt;p&gt;@Patrick:&lt;br/&gt;
&quot;If you want to be nice to the players, you could tweak the overnight check to make a player count as 3 or so villagers for crowding purposes. (That is, if the player moves into a building, villagers give them room.)&quot;&lt;/p&gt;

&lt;p&gt;The biggest reason why this issue exists at all is mostly because that counting mechanism is not working. So, your idea would not work, unless the counting mechanism works, and if it works, your idea is not really needed.&lt;/p&gt;

&lt;p&gt;About deciding what makes a house; there is a thread about that on forums (the supposedly correct place for put ideas/features in). Me and David we&apos;re getting off-topic (about what makes a house) in a lengthy way, so I made this &lt;a href=&quot;http://www.minecraftforum.net/topic/1690912-villagers-should-be-smarter-about-what-makes-a-house/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.minecraftforum.net/topic/1690912-villagers-should-be-smarter-about-what-makes-a-house/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;About village shape: better matching of internal and visual village shapes would be good. Coding complexities affect, but one of the changes I listed earlier would help a bit while still being quite easy to implement. (The change to base on bounding box instead of mass center of doors.)&lt;/p&gt;</comment>
                            <comment id="81766" author="ouatcheur" created="Wed, 3 Jul 2013 21:14:08 +0200"  >&lt;p&gt;@David Harmon:  If you want to be nice to the players, you could tweak the overnight check to make a player count as 3 or so villagers for crowding purposes. (That is, if the player moves into a building, villagers give them room.)&lt;/p&gt;

&lt;p&gt;That would not always be nice. When trying to trade with villagers, seeing most of them suddenly escape the house you just entered would be bad.&lt;/p&gt;



&lt;p&gt;The entire way villages are defined is kind of sucky.  1 door = 1 housing space is very limiting.&lt;/p&gt;

&lt;p&gt;Houses with lots of doors yet an obviously lower &quot;habitability&quot; can&apos;t work weel. For example, if a player makes each room inside a big mansion house not only have it&apos;s own set of doubledoors plus doors for each closets too, obviously this would at last triple the housing&quot; value of the house for no good reason. Sure it should have more villagers after all it&apos;s a mansion, but it should not have THAT many villagers in it. Even if the masion&apos;.s rooms where without closests and single doors, the &quot;rooms per occupant&quot; of luxury houses is instinctively not the same as for slum housing. In the same way, a storage shed with lots of cubicles, made for decoration, should not suddenly automtically become a house for lots of villagers in it. Or a house that the player uses as his &quot;own&quot;&apos; yet doesn&apos;t want to be constantly annoyed by &quot;impromptu visitors&quot;. And not all wooden doors player places in his own base should not also automaticaly count as potential village doors.&lt;/p&gt;

&lt;p&gt;In short, wooden doors, while an imporant aspect of villager navigation, should not be what defines the  housing unit criterion itself. Something else that is not a door is needed, and a way to differentiate &quot;housing&quot; doors from &quot;normal&quot; doors too. But it is just the simplest way right now.&lt;/p&gt;



&lt;p&gt;Also, in the case of super long villages or villages with weird shapes say, an L shaped village, using the center mass makes villagers wander, on those sides without houses, quite farther away than normal (when counting the nearest housesdistance, not the village center) to unsafe spots. Also, several nearby villages tend to create funky village dynamics where villagers can just suddenlty abandon one village forever, cramming into the next village.&lt;/p&gt;

&lt;p&gt;Instead of a single village of varying boundary, maybe have a &quot;village rating&quot; in the section? (not a chunk because chunks are 256 blocks high = 16 sections that are 16x16x16) is determined. Then villagers just occupy those sections, so that a village of any weird shape or size will, because of villager semi-random travels, eventually be filled more or less evenly.  You could build a huge city that way.&lt;/p&gt;


&lt;p&gt;Any way, each villager should definitely have &quot;his&quot; house and stick to it as much as possible during the night. Currently finding a specific villager for trading is a real nightmare except in the tiniest of villages. It would look cooler to see villagers sleep in the house they spawned in (librarian in the library, etc.)&lt;/p&gt;

&lt;p&gt;But just making the villagers stop crowding all in the same spot would already be a boon.&lt;/p&gt;</comment>
                            <comment id="81677" author="firebird7" created="Wed, 3 Jul 2013 19:10:28 +0200"  >&lt;p&gt;I hope this really annoying bug gets more attention from Mojang for the upcoming 1.7 update. Currently I have to trap some of the villagers inside buildings in all corners of my village. If I don&apos;t do that they just forget most of the available doors and instead crowd in one corner of the village.&lt;br/&gt;
My village still has about 80 doors, 35 villagers and 4 golems but i somewhat lost interest in them because of this bug.&lt;/p&gt;</comment>
                            <comment id="81305" author="bugi74" created="Wed, 3 Jul 2013 07:57:22 +0200"  >&lt;p&gt;@Kevin: They already do all that. Well, not the &quot;if there are too many villagers in their immediate vicinity&quot;, as they have that near-area wanderlust to kick in simply randomly. That part of their coding works somewhat well. It could work a bit better (as indicated by my earlier tests), but their wandering is working good enough to not be the real cause for this issue.&lt;/p&gt;

&lt;p&gt;Oh, and they do not &quot;settle&quot; at all. No villager has any kind of &quot;home&quot;. Having a home has been suggested as one way to fix this problem, and yes, it would fix things. However, it has its own problems to be solved, so it is not a trivial fix.&lt;/p&gt;

&lt;p&gt;I have provided some tested changes in earlier comment. They do not fully fix this problem, but they can be done without major changes to the code, and reduce the crowding enough to not be as big an issue as it is now.&lt;/p&gt;</comment>
                            <comment id="81030" author="enochprime" created="Wed, 3 Jul 2013 00:04:51 +0200"  >&lt;p&gt;Suggestion: villagers should be programmed with a kind of &quot;wanderlust,&quot; if there are too many villagers in their immediate vicinity, that prompts them to wander in a random direction for a while, checking occasionally to see if there are doors nearby. If they find themselves in a place with many doors and few other villagers, they&apos;ll get the urge to settle down in the new location.&lt;/p&gt;</comment>
                            <comment id="76499" author="darthriddle" created="Sun, 23 Jun 2013 21:17:18 +0200"  >&lt;p&gt;I&apos;m having the same issue. My villagers are all crammed in one house, I can just sit there around the corner and kill zombies all night in one spot without moving. So many villagers and they just go to the same place to kill them. Camping at its best. &lt;/p&gt;</comment>
                            <comment id="72589" author="__stephane__" created="Sun, 9 Jun 2013 21:16:30 +0200"  >&lt;p&gt;In my villages, I always plan a trap (usually a 2x2 hole in the ground) in the north-west house, with an underground river pushing the villagers to the south-east corner, where they can escape. They still don&apos;t pay too much attention to the other houses, but at least I can see them running across the village, heading back for the north-west corner &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="70256" author="richy12" created="Sat, 1 Jun 2013 04:05:13 +0200"  >&lt;p&gt;I got this all the time. I have like a 50 to 60 house village and 70% is abandoned&lt;br/&gt;
while 20% is overcrowded. This bug only seems to happen occasionally but it happens every time it rains.&lt;/p&gt;
</comment>
                            <comment id="70206" author="likalaruku" created="Sat, 1 Jun 2013 01:11:58 +0200"  >&lt;p&gt;Oh good, it&apos;s not just me. &lt;/p&gt;

&lt;p&gt;They all insist on cramming into the tiniest building in the village; not a single villager in a different house.&lt;/p&gt;

&lt;p&gt;I can force them to leave, but they always head to the same next house. They also have a bad habit of standing in front of the door to block other villagers from entering.&lt;/p&gt;</comment>
                            <comment id="69684" author="agilerelic" created="Wed, 29 May 2013 22:08:26 +0200"  >&lt;p&gt;85% of the village i built is a ghost town, meanwhile the other 15% is overflowing with villagers.&lt;/p&gt;</comment>
                            <comment id="69492" author="shadus" created="Tue, 28 May 2013 18:12:01 +0200"  >&lt;p&gt;This is in fact getting terribly annoying.  We built over 40 structures (in the style of the originals) at a large npc village.  95% of the villagers cram into one 3x3 building every single night.  They&apos;re worthless for trading and it takes 15m in the morning for the concentration levels to get low enough that you can efficiently trade and any of the further out buildings never get filled or have villagers near them.  Even though they&apos;re only 30-40 blocks away.  Really really annoying.&lt;/p&gt;

&lt;p&gt;Completely random buildings would be better than this.&lt;/p&gt;</comment>
                            <comment id="65859" author="busmap23" created="Fri, 10 May 2013 20:46:57 +0200"  >&lt;p&gt;It gets so bad, that the villagers glitch out, suffocate, and appear to &quot;float&quot; out of the building.&lt;/p&gt;</comment>
                            <comment id="65834" author="wkust" created="Fri, 10 May 2013 19:06:11 +0200"  >&lt;p&gt;I have this problem all of the time.... it makes it very hard to trade with them and you cannot get to most of them. &lt;/p&gt;</comment>
                            <comment id="59620" author="busmap23" created="Wed, 10 Apr 2013 13:38:54 +0200"  >&lt;p&gt;This is confirmed with 1.5.1.&lt;/p&gt;</comment>
                            <comment id="58585" author="charon96" created="Wed, 3 Apr 2013 03:59:55 +0200"  >&lt;p&gt;Awww that&apos;s so mean! Now I&quot;m back to being pissed about this bug - I didn&apos;t even know it had been going on for a year. WTF Mojang. Ridiculous!&lt;/p&gt;</comment>
                            <comment id="58575" author="hayes2232" created="Wed, 3 Apr 2013 02:49:15 +0200"  >&lt;p&gt;This has been happening for a year and they still haven&apos;t gotten around fixing it... I pretty much revolve the game around making many villages and soon turning it into a metropolis, but I can&apos;t do that with so many empty houses and 50 villagers cramming into the same dang house!&lt;/p&gt;</comment>
                            <comment id="58315" author="5thhorseman" created="Mon, 1 Apr 2013 15:58:23 +0200"  >&lt;p&gt;Alex didn&apos;t make the joke, he mistakenly thought the 2.0 joke by Mojang was a real announcement.&lt;/p&gt;

&lt;p&gt;This is still a bug, it still should be worked on, it&apos;s still not being worked on, and we still don&apos;t know why. But we do know that &quot;Minecraft 2.0&quot; is not the reason.&lt;/p&gt;</comment>
                            <comment id="58311" author="wbradford" created="Mon, 1 Apr 2013 15:52:16 +0200"  >&lt;p&gt;Alex, that&apos;s a mean April Fool&apos;s joke . . .&lt;/p&gt;</comment>
                            <comment id="58310" author="alisha161fishy" created="Mon, 1 Apr 2013 15:44:03 +0200"  >&lt;p&gt;^ Minecraft 2.0 is an April Fools&apos; joke&#8230;&lt;/p&gt;</comment>
                            <comment id="58283" author="charon96" created="Mon, 1 Apr 2013 13:32:27 +0200"  >&lt;p&gt;Of course as soon as I post the above comment they announce they&apos;ve been secretly working on 2.0&lt;br/&gt;
No wonder this wasn&apos;t a priority. We only get frustrated because we love you Mojang.&lt;/p&gt;</comment>
                            <comment id="58032" author="charon96" created="Sat, 30 Mar 2013 21:44:13 +0100"  >&lt;p&gt;This bug is super annoying and makes it pointless to bother interacting with villages. Why is still not even assigned while all kinds of trivial bugs are being fixed with every update? I /had/ been building an empire of villages across an entire continent, so it&apos;s not even worth playing until this is resolved.&lt;/p&gt;</comment>
                            <comment id="54996" author="firebird7" created="Mon, 18 Mar 2013 11:32:10 +0100"  >&lt;p&gt;I hope this annoying bug gets more attention from Mojang for the upcoming 1.6 update. Currently I have to trap some of the villagers inside buildings in all corners of my village. If I don&apos;t do that they just forget most of the available doors and instead crowd in one corner of the village.&lt;br/&gt;
My village has 80 doors, 35 villagers and 4 golems.&lt;/p&gt;</comment>
                            <comment id="49818" author="vit" created="Tue, 5 Mar 2013 01:01:59 +0100"  >&lt;p&gt;Updated&lt;/p&gt;</comment>
                            <comment id="49724" author="pizza2004" created="Mon, 4 Mar 2013 21:43:08 +0100"  >&lt;p&gt;Can we get a confirmation of whether this happens in 13w10a and an update to the affected versions?&lt;/p&gt;</comment>
                            <comment id="47596" author="bugi74" created="Mon, 25 Feb 2013 21:54:18 +0100"  >&lt;p&gt;Paul Aslin: That is not a fix, but a kludge that makes the current mess even messier, just with apparently useful side-effects. Also it won&apos;t make them to go the &apos;last&apos; door they encountered (though it often may be that door, by chance). The problem is, as soon as someone wants to actually improve something with the villages / villagers, that change will bite back.&lt;/p&gt;

&lt;p&gt;Basically, that change only breaks the notion of villages having a center and villagers basing their common lives around that. Thus, the villagers would think each of having different &quot;home&quot; area and unable to move far enough to completely discard some parts of the village (the useful side-effect).&lt;/p&gt;

&lt;p&gt;Without testing (have to delay that to tomorrow), I&apos;d guess that change would allow some villagers having &quot;home&quot; at the edge of a large village to be able to move quite far away from that village, possibly far enough to &quot;lose&quot; that home village.&lt;/p&gt;

&lt;p&gt;That change is certainly good enough as, say, a mod that allows temporary improvement until the issue gets properly fixed by Mojang.&lt;/p&gt;

&lt;p&gt;The general idea in bug fixing is to make code to work more correctly, not to make it work even less correctly, even if such change seems to have some beneficial spot effects. I&apos;ve already given several fixes that actually improve the sub-tasks involved, but even those are not enough to fully overcome the real bug causing the crowding. One straight forward solution for that main issue is also known, but needs large enough changes for me to keep away from it; it is not difficult one, but needs to change the saved data and becomes too large to be posted here.&lt;/p&gt;</comment>
                            <comment id="47594" author="fabricator77" created="Mon, 25 Feb 2013 21:01:14 +0100"  >&lt;p&gt;Easy fix, been using this one for a while, as have others.&lt;/p&gt;

&lt;p&gt;in EntityVillager&lt;br/&gt;
find:&lt;br/&gt;
ChunkCoordinates var1 = this.villageObj.getCenter();&lt;br/&gt;
Villagers cluster around center of village&lt;/p&gt;

&lt;p&gt;replace with:&lt;br/&gt;
VillageDoorInfo var1 = this.villageObj.findNearestDoorUnrestricted(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));&lt;br/&gt;
Villagers go to last door they encountered.&lt;/p&gt;</comment>
                            <comment id="47190" author="numbermaniac" created="Sat, 23 Feb 2013 10:47:10 +0100"  >&lt;p&gt;Can someone please add 13w07a to the  version list&#65311; It still happens there.&lt;/p&gt;</comment>
                            <comment id="47189" author="numbermaniac" created="Sat, 23 Feb 2013 10:45:48 +0100"  >&lt;p&gt;You&apos;re right. Hopefully it might just convince mojang to really deal with the issue.&lt;/p&gt;</comment>
                            <comment id="47188" author="bugi74" created="Sat, 23 Feb 2013 10:37:18 +0100"  >&lt;p&gt;Its okay. Even if redundant comment, it still confirms that the idea is obviously a decent and acceptable one as others get the same idea. Might convince Mojang to go for it.&lt;/p&gt;</comment>
                            <comment id="47164" author="numbermaniac" created="Sat, 23 Feb 2013 02:37:50 +0100"  >&lt;p&gt;Sorry Markku.&lt;/p&gt;</comment>
                            <comment id="46697" author="bugi74" created="Wed, 20 Feb 2013 09:59:15 +0100"  >&lt;p&gt;Lleyton J, if you read my comment earlier, the last part of it under &quot;What would still be needed&quot;, it is explaining the same you did, although without example. Just &quot;least bound door&quot;. Note, the doors do not need numeric ids for that. The currently existing list of door is enough, but the door info needs to be added a counter (or repurpose the current restriction counter which isn&apos;t working well).&lt;/p&gt;</comment>
                            <comment id="46694" author="numbermaniac" created="Wed, 20 Feb 2013 09:08:40 +0100"  >&lt;p&gt;There are usually more villagers than doors, but perhaps each door should be given a number or ID, and each villager that spawns should be given the door ID, in order. This means that if there are 5 doors, for example, the first villager gets, door A, the second gets door B, and so on, until the sixth gets door A again. This means that each house should have an even number of villagers.&lt;/p&gt;</comment>
                            <comment id="46534" author="mahamatan" created="Tue, 19 Feb 2013 04:33:30 +0100"  >&lt;p&gt;I&apos;ve noticed this in 1.4.7. I&apos;ve made a huge village and they all crowd into the same 3 houses in the far north/west corner of the village.&lt;/p&gt;

&lt;p&gt;My suggestion for changing this in villagers... we know that village population is tied to the number of wooden doors in a village, so that must mean that all doors are counted or indexed in some fashion. Each villager should be given an attribute that is a &apos;favorite&apos; door he prefers to walk towards when idle, hiding from the dark, or when running from zombies. This favorite door should be a door that is not another villager&apos;s favorite, if possible. &lt;/p&gt;</comment>
                            <comment id="46145" author="wbradford" created="Sat, 16 Feb 2013 23:10:56 +0100"  >&lt;p&gt;Oh . . . well I feel kinda dumb. Well in any case I how Mojang has the time to look into this bug soon. I&apos;m starting to get apathetic about village building. . . &lt;/p&gt;</comment>
                            <comment id="46121" author="bugi74" created="Sat, 16 Feb 2013 20:24:26 +0100"  >&lt;p&gt;Those &quot;repairs&quot; are just comments about how I modified my own &quot;test platform&quot; Minecraft and what effects they had. As far as I know, Mojang hasn&apos;t even seen them yet, let alone included in a snapshot.&lt;/p&gt;</comment>
                            <comment id="46106" author="wbradford" created="Sat, 16 Feb 2013 19:55:00 +0100"  >&lt;p&gt;Will the repairs that have been made so far (The repairs listed since the 7th of February)be available in the 1.5 update or the snapshots leading up to it? By the way, we all really appreciate the work you guys do!&lt;/p&gt;</comment>
                            <comment id="45958" author="bugi74" created="Fri, 15 Feb 2013 21:58:43 +0100"  >&lt;p&gt;David, it was just &lt;em&gt;one&lt;/em&gt; example, to show you that naive algorithms simply fail. But we&apos;re getting kinda offtopic here. This issue is about villagers crowding, not about how they detect houses. So, I&apos;ll make a feature request about this on the forums, lets continue there. Here&apos;s the forum thread: &lt;br/&gt;
&lt;a href=&quot;http://www.minecraftforum.net/topic/1690912-villagers-should-be-smarter-about-what-makes-a-house/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.minecraftforum.net/topic/1690912-villagers-should-be-smarter-about-what-makes-a-house/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="45917" author="mentalmouse" created="Fri, 15 Feb 2013 19:46:17 +0100"  >&lt;p&gt;Markku:  &amp;lt;i&amp;gt;Not very good house after all. &amp;lt;/i&amp;gt;&lt;/p&gt;

&lt;p&gt;The example you gave sounds like an error or backstab by the player building it, and it&apos;s not reasonable to expect villagers to outsmart the players.  &lt;/p&gt;

&lt;p&gt;I&apos;d say the villagers could settle for a door leading to an enclosed space with no open sky, and no holes in the wall over 1 block high) that lead to outside (windows and doors don&apos;t count as holes).  (Note that this would also rule out your example.)  (If the player wants to let spiders in, whatever &amp;#8211; they don&apos;t attack villagers anyway.)  If you want to be fancy, you could have any villager who finds a non-zombie monster indoors, declare the house unfit.  (Zombies, of course, can spawn inside houses &amp;#8211; just one more problems with the current overcrowding situation.)&lt;/p&gt;

&lt;p&gt;The hard part would be keeping track of bounding boxes for the village&apos;s houses, especially if there are tunnels involved.&lt;/p&gt;</comment>
                            <comment id="45622" author="numbermaniac" created="Thu, 14 Feb 2013 00:26:09 +0100"  >&lt;p&gt;It&apos;s true. In a previous world that I had, when rain or night came, i would often get up to 50 villagers in the one house, while all the others would be empty.&lt;/p&gt;</comment>
                            <comment id="45621" author="bugi74" created="Thu, 14 Feb 2013 00:07:38 +0100"  >&lt;p&gt;Villagers currently do not have &quot;this is my door&quot; knowledge; it is all based on what they happen to &quot;see&quot; at each time. They do already try to restrict a nearby door in certain situation, but that functionality is not working well (the main problem for this issue). I.e. the value you call &quot;villager count&quot; is actually much more weirder value and isn&apos;t working as expected/desired.&lt;/p&gt;

&lt;p&gt;Currently, villagers do know their village, and the village does know every valid door found by all the villagers.&lt;/p&gt;

&lt;p&gt;What I suggested was basically adding the knowledge of one door to each villager - its &quot;home door&quot;. It doesn&apos;t matter much whether it is for this night or a bit more permanent choice, but the latter choice would give a bit more realistic behaviour (getting back to own home each night), and would need less computation at night fall (since the knowledge is already there).&lt;/p&gt;

&lt;p&gt;It is indeed trivial to spread the villagers quite evenly over the doors of the village even with the existing data. The problem is the missing data explained above, whichever way it is then used.&lt;/p&gt;</comment>
                            <comment id="45608" author="megatrain" created="Wed, 13 Feb 2013 23:33:43 +0100"  >&lt;p&gt;Please don&apos;t alter the &quot;what is a house&quot; detection mechanism, that would be a significant breaking change, and lots of village/iron golem farm designs would no longer work.&lt;/p&gt;

&lt;p&gt;One question to help clarify this issue for me: in your &quot;choose a door to enter tonight&quot; code, do you have global knowledge of all the other door choices that have already been made by other villagers? If so, then you can just restrict door choice to the closest door that hasn&apos;t been chosen by any other villager (or by the least number of villagers, if villagers&amp;gt;doors).&lt;/p&gt;

&lt;p&gt;Or does each villager only have &quot;knowledge&quot; of what they can determine from the world?&lt;br/&gt;
Even in that case, you could add a &quot;villager count&quot; attribute to your village door object, that would get cleared in the morning, and would increment every time a villager selected it at evening time.&lt;/p&gt;

&lt;p&gt;Hope that makes some sense. Still sounds like your revision is an improvement on the current.&lt;/p&gt;</comment>
                            <comment id="45593" author="bugi74" created="Wed, 13 Feb 2013 22:55:25 +0100"  >&lt;p&gt;@David Harmon&lt;br/&gt;
The villager does not have to move in order to do that process; it is enough to move a variable and keep checking blocks wherever it goes. The benefit from this is the need for less memory (to remember all the places having been visited) for long periods; instead, it is enough to hold it for a shorter period. Like the duration of running a single method.&lt;/p&gt;

&lt;p&gt;Now, whether it is the villager or an abstract pointer, it will still be an algorithm that tries to figure out what makes a house. And while it first sounds easy, there are plenty of traps to fall in. Just as &lt;em&gt;one&lt;/em&gt; example to the algorithm you gave; what if the &quot;house&quot; has one nice door, very nice two block high walls, ceiling at 4 blocks higher. Nice. But then ground outside has a place for monsters to climb up those two blocks and they can slip in. Not very good house after all. There are more similar oopsies...&lt;/p&gt;

&lt;p&gt;As I said, detecting/figuring out a good house is a difficult task (for a computer/program).&lt;/p&gt;

&lt;p&gt;And the biggest problem for &lt;em&gt;this&lt;/em&gt; issue is not the detection of houses (or doors), but how the villagers end up getting crowded into one to few of the available houses (doors). Even if the CPU is put to its knees to be smart about what makes a house, without fixes to the real problem here, they&apos;d just crowd in one to few &lt;em&gt;nice&lt;/em&gt; houses. (The house detection should be another issue, or more likely, moderators will judge it to be a feature request.)&lt;/p&gt;

&lt;p&gt;Also, even detecting how many villagers are (or will be soon) in a single house is a challenge. That is the main thing currently bugging out badly. And due to it being so difficult problem to solve, I proposed the binding of a villager to a &quot;home&quot; house, and using that as the primary house choice; no need to worry about counting how many are in a house, as it is easy to distribute the villagers to houses at that level (the valid doors (i.e. houses) of the village are known well).&lt;/p&gt;</comment>
                            <comment id="45585" author="mentalmouse" created="Wed, 13 Feb 2013 22:22:00 +0100"  >&lt;p&gt;What I&apos;m suggesting here is that the movements of the villagers could themselves be used to figure out what a house is, along the lines of &quot;after passing through a door, wander around a bit, keeping track of where I&apos;ve stepped.  If I find myself under open sky without passing through another (or the same) door, this isn&apos;t a (very good) house.  If I pass through another door, I expect to be under open sky within a few blocks &amp;#8211; if not, I might still be in a house&quot;.  &lt;/p&gt;</comment>
                            <comment id="45549" author="bugi74" created="Wed, 13 Feb 2013 20:01:13 +0100"  >&lt;p&gt;Detecting when a player (or anything else) is in a house is quite a difficult task. In fact, figuring out what really makes a house and what is its inside or outside is very complex task to start with. That is why the current mechanism is so simple, and concentrates its minor effort on doors.&lt;/p&gt;

&lt;p&gt;The attachment of a villager to a door (&quot;house&quot;) is something I already mentioned above, as was the knowledge about how many villagers would be in each house, and to look for new one if old door becomes &quot;invalid&quot;. (Check the last part for those; the rest of the text is for just the quick-and-dirty remedy that could keeps us player somewhat happy while implementing bigger and better changes.)&lt;/p&gt;</comment>
                            <comment id="45545" author="mentalmouse" created="Wed, 13 Feb 2013 19:42:24 +0100"  >&lt;p&gt;A better way might be to let villagers map out the buildings themselves (perhaps rejecting pathological buildings such as &lt;a href=&quot;http://www.minecraftwiki.net/wiki/File:Bare_Minimum_House.png&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.minecraftwiki.net/wiki/File:Bare_Minimum_House.png&lt;/a&gt; and &lt;a href=&quot;http://www.minecraftwiki.net/wiki/File:Minimum_House.png&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.minecraftwiki.net/wiki/File:Minimum_House.png&lt;/a&gt; ), and then attach themselves to particular houses.  They would also remember how crowded they were (villagers/inside area) in the old building.  If they find themselves in an overly crowded building overnight (check at midnight?), they might take a 1/(N+1) chance of rejecting their current home altogether, after which they would later pick a different building.&lt;/p&gt;

&lt;p&gt;For performance reasons, you&apos;d probably want a &quot;house-hunting mode&quot; that they would only invoke occasionally &amp;#8211; for example, when they find a new door (or any door, if they&apos;re currently homeless), or if their prior house has been too badly damaged.  Naturally, they could also share info about how many villagers have already chosen a given house.  If you want to be nice to the players, you could tweak the overnight check to make a player count as 3 or so villagers for crowding purposes.  (That is, if the player moves into a building, villagers give them room.)&lt;/p&gt;</comment>
                            <comment id="44203" author="bugi74" created="Thu, 7 Feb 2013 16:05:18 +0100"  >&lt;p&gt;And also: related to &lt;a href=&quot;https://bugs.mojang.com/browse/MC-4662&quot; title=&quot;Iron golems spawned in a village walk around 1 place&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-4662&quot;&gt;&lt;del&gt;MC-4662&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="44199" author="bugi74" created="Thu, 7 Feb 2013 15:46:29 +0100"  >&lt;p&gt;After trying multiple different changes in the code, I couldn&apos;t get it even near &quot;good&quot;, but at least I managed to make the villagers spread more evenly around the village, and somewhat in the houses, too. There could still occasionally be 3-5 villagers in the same house, but with around 15 villagers, at least 5-8 houses were occupied each night. So, an improvement, but not fully fixed.&lt;/p&gt;

&lt;p&gt;Also, if a house has more than one door, the house has a higher chance to get crowding, even with the changes. The other door(s) lure the villagers out away from the door they are supposed to restrict.&lt;/p&gt;

&lt;p&gt;The biggest problem to solve this issue somewhat easily is the door restriction operation. Basically, it does not work. There is no point in trying to work out a well working algorithm that takes occupation into account when that occupation data is mostly useless.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The changes&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;1) Changed the villagers&apos; &quot;home area&quot; to be based on the bounding box of village&apos;s doors (instead of mass center). This matches better the needed area of movement, though the current way has the minor benefit of bringing the villagers slightly closer together during daytime - sort of looks like &quot;community behaviour&quot;.&lt;/p&gt;

&lt;p&gt;2) Increased the radius factor from 0.6 to 0.9. The 0.6 for the current mass center -based solution does make sense as the most distant door from that mass center can indeed be quite far away, and larger factor could allow villagers to wander quite far &quot;out&quot; in the opposite direction. Unfortunately, that will also limit their chances to move to that distant house that &lt;em&gt;is&lt;/em&gt; in the village. With bounding box center -based &quot;home area&quot;, the radius can be higher without that problem.&lt;/p&gt;

&lt;p&gt;3) Changed the way villagers choose which door they&apos;d like to go to. In current code the distance is given unnecessarily large disadvantage weight (squared and in addition anything beyond 16 blocks was given an extra about x30 distance which in practice means fully ignored), and when near enough, it has no effect at all. I changed the distance weight to linear, multiplied by just 4, and &lt;em&gt;added&lt;/em&gt; the restriction value (for whatever rare effect it has). Also, I made it keep 3 best choices and pick randomly one of them in the end. The randomness tries to diminish the effects of the remaining badly working things.&lt;/p&gt;

&lt;p&gt;4) Removed any extra doors from multi-door houses. Not a nice change, and not absolutely needed.&lt;/p&gt;

&lt;p&gt;1 and 2 together spread the villagers quite nicely around the village. This already decreased the crowding effect a lot, but local hotspots would still be a problem.&lt;/p&gt;

&lt;p&gt;3 and 4 reduce the local hotspots a bit. Not that well, but at least better than the current code.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What would still be needed&lt;/b&gt;&lt;br/&gt;
The above changes are merely a minor fine-tuning to reduce the worst of the issue.&lt;/p&gt;

&lt;p&gt;Full fix would require quite a total rethinking/design for the way a door or house is marked occupied. To me, it seems that it would be best to simply bind each villager to a single door. Easy when generating the village (the code can just bind the generated villager to the house/door it was generated for). When spawning a new villager or when a door gets invalid/destroyed, there would need to be new code that looks for least bound doors and picks one of those, to spread the villagers evenly.&lt;/p&gt;

&lt;p&gt;Then, when villager wants to get inside, it would prefer its &quot;home door&quot; unless it is really far away (like more than 50 blocks away?), in which case it could just pick a random valid door nearby for that night.&lt;/p&gt;</comment>
                            <comment id="44076" author="wbradford" created="Wed, 6 Feb 2013 23:17:22 +0100"  >&lt;p&gt;I just creating 3 (properly spaced) villages. In each village only one house was used (2 houses were sometimes used in the largest 23 house village). Suddenly all villagers from all three villages mobbed two houses in one village. My entire set up was ruined. I hope they fix this soon. I think the best choice would be to permanently be assign a villager to a door, and one villager per door. If there are too few doors, an unassigned villager should stay with a neighbor but continuously search for a new door. Potentially, this may make an untouched natural village look more realistic as well. The blacksmith would stay at the forge and priest would stay in the church, ect.&lt;/p&gt;</comment>
                            <comment id="40796" author="agilerelic" created="Mon, 28 Jan 2013 23:22:51 +0100"  >&lt;p&gt;Yes, I&apos;ve built a huge village with lots of nice houses but they only stay in one little area. I&apos;ve lost all interest into finishing the village.&lt;/p&gt;</comment>
                            <comment id="39811" author="bugi74" created="Fri, 25 Jan 2013 19:01:51 +0100"  >&lt;p&gt;The &quot;0.6x radius&quot; factor, as the way the radius is defined, are both hardcoded, and can not be affected. There seems to be no maximum radius (took a quick look only), but at least I&apos;d say it can become a challenge to play with the villagers to spread further when the other ends starts to get unloaded &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/tongue.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;What can be (partially) affected is how the radius changes over time. It is defined by the valid active doors, which in turn are noticed by the villagers. So build houses to spread the village around, and once a villager is even temporarily in a perimeter house you want to &quot;keep&quot;, block the villager inside. Repeat in all directions. Adjust the area between as desired. The blocked villagers will keep the village radius large enough to always include all those - depending where the center of village moves, the radius may still extend at other sides to beyond those blocked houses.&lt;/p&gt;

&lt;p&gt;Village center in turn is based on the &quot;center of mass&quot; of the (active/valid) doors (of houses). So a bit of math or even decent ability to estimate that can give a good hint how the village is in the minds of the villagers.&lt;/p&gt;</comment>
                            <comment id="39535" author="maisumgustavo" created="Thu, 24 Jan 2013 23:09:14 +0100"  >&lt;p&gt;MisterSanderson, sorry about that. (I had not seen the attachment option in the comment window, so I just put it at my Dropbox.)&lt;br/&gt;
Markku, I had a simple vision of the solution, like the ones posted by the OP and Sid Ben. I know almost nothing about source codes, so I assume you must know a thousand times more than me and, well, probably you&apos;re right. Still, I&apos;m looking very forward to this fix, despite its complexity.&lt;br/&gt;
About that &quot;radius times 0.6&quot; formula, if I make an artificial village, can I deliberately choose the radius? Is there a maximum radius?&lt;/p&gt;</comment>
                            <comment id="39378" author="league" created="Thu, 24 Jan 2013 13:24:33 +0100"  >&lt;p&gt;please Jon we need you back!&lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; everybody go beg &lt;a href=&quot;https://twitter.com/jonkagstrom&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://twitter.com/jonkagstrom&lt;/a&gt;&lt;br/&gt;
to return to minecraft!&lt;/p&gt;</comment>
                            <comment id="39309" author="bugi74" created="Wed, 23 Jan 2013 22:41:10 +0100"  >&lt;p&gt;The reddit link Sid Ben provided seemed to have somewhat nice description about a few possible/likely reasons (i.e. bugs or design flaws) behind this issue.&lt;/p&gt;

&lt;p&gt;However, those are not the only reasons that affect the problem. The Villager&apos;s have a &quot;home village&quot; (or at least they usually have one), and they set their &quot;home area&quot; to that village&apos;s radius... times 0.6! That village radius is defined by the valid door (house) furthest from the center.  And their movement AI wants them to stay about in that home area, instead of the full village radius. So, in a large city, the villagers that have somehow gotten to the perimeter area have a tendency to come back towards center, and thus not only possibly loosing sight of the furthest doors (at least temporarily), but also bringing villagers closer together. Being closer together means many of the villagers will concentrate on the houses closer to center.&lt;/p&gt;

&lt;p&gt;I did not test the assumption above (based on reading source code), as getting proper facts on the village center, radius, each NPC&apos;s AI states etc. etc. is a bit difficult without proper debugging setup (e.g. overlaying some visible markers in the view of the world). (Which I&apos;m sure Mojang has available in their development version.)&lt;/p&gt;

&lt;p&gt;Gustavo, AI problems can often be hard problems to fix, especially when designed in the way they are in Minecraft; multiple partially independent &quot;goals&quot;. One &quot;fix&quot; could easily affect few other goals, breaking them or make them behave otherwise in unintended ways. But I don&apos;t mean this issue should not be looked at, and the details given by players already give a lot of help.&lt;/p&gt;</comment>
                            <comment id="38388" author="mistersanderson" created="Sat, 19 Jan 2013 23:03:42 +0100"  >&lt;p&gt;Gustavo, it is recommended that you attach screenshots directly here.&lt;/p&gt;</comment>
                            <comment id="38364" author="maisumgustavo" created="Sat, 19 Jan 2013 20:49:22 +0100"  >&lt;p&gt;I can confirm this. I have 3 small villages and it happens in all of them. Please, fix this. I do not think it is a hard problem to fix and, besides, it is one of the most popular issues.&lt;/p&gt;

&lt;p&gt;Here are some screenshots.&lt;br/&gt;
&amp;lt;EDIT: Uploaded screenshots properly&amp;gt;&lt;/p&gt;</comment>
                            <comment id="28108" author="ashtonr12" created="Thu, 13 Dec 2012 19:58:18 +0100"  >&lt;p&gt;yeah villager AI is a peice of crap atm i don&apos;t understand wy they dont fix it rather than adding more problems :/&lt;/p&gt;</comment>
                            <comment id="23804" author="ericjs" created="Wed, 21 Nov 2012 06:32:52 +0100"  >&lt;p&gt;Well, it can be bad if you&apos;re trying to grow your village, get golems, etc. And it&apos;s quite hit or miss (maybe depending on the way the building happen to generate?)...in some villages they cluster quite badly but in others you hardly notice it.&lt;/p&gt;</comment>
                            <comment id="23786" author="gulden" created="Wed, 21 Nov 2012 03:24:27 +0100"  >&lt;p&gt;I can confirm this, but IMHO it isn&apos;t that bad, sometimes it looks sweet how they gather together and form a community. there are worse bugs&lt;/p&gt;</comment>
                            <comment id="21416" author="dravarden" created="Wed, 14 Nov 2012 14:25:48 +0100"  >&lt;p&gt;Someone else here from BdoubleO?&lt;/p&gt;

&lt;p&gt;Anyway, I can confirm this. I have a natural village (not even made by me) and they just stay in the 3 middle houses.&lt;/p&gt;</comment>
                            <comment id="21156" author="mistersanderson" created="Tue, 13 Nov 2012 02:42:08 +0100"  >&lt;p&gt;When I use a spawn egg to create a new Villager on the Est side of the village, he/she instantly runs to the West side, where all the 20 are using five houses, at maximum.&lt;/p&gt;</comment>
                            <comment id="19158" author="shelter" created="Wed, 7 Nov 2012 15:17:39 +0100"  >&lt;p&gt;This is very annoying indeed, they also seem to move within one very specific area, kind of like Eric mentioned above.&lt;/p&gt;</comment>
                            <comment id="18431" author="jfbarras" created="Mon, 5 Nov 2012 16:57:02 +0100"  >&lt;p&gt;What if the number of villagers per house (at night time) was proportionate to the size of the house? For example, the small 2x3 (inside) huts could have 1-2 villagers and the large T-shaped one could have a dozen or so. Of course the total number of villagers would still be regulated by the number of doors in the village.&lt;/p&gt;</comment>
                            <comment id="18360" author="league" created="Mon, 5 Nov 2012 10:45:51 +0100"  >&lt;p&gt;I can&apos;t wait untill Jonkagstrom returns to minecraft from scrolls to work on the AI again. Untill that moment I guess we just have to wait&lt;/p&gt;</comment>
                            <comment id="18066" author="ericjs" created="Sun, 4 Nov 2012 18:59:09 +0100"  >&lt;p&gt;The behavior of villagers in terms of wandering or failing to wander is definitely erratic and unbalanced. I&apos;ve seen the same &quot;crowding into a single building&quot; though it was in a previous version (a whole mob had jammed themselves into a &quot;church&quot; and many of them kept leaping off the top to their deaths).&lt;/p&gt;

&lt;p&gt;In 1.4.2 I had built a large number of new houses and no villager would &quot;discover&quot; the new doors (over many many days) and therefore would not breed. It completely looked like part of the same village, but I think the problem was that the houses on the street leading to the new street of houses had doors too far apart. They were large houses (either generated naturally, or copies of houses that were generated naturally) and the distance between the doors was perhaps 15 or 20 blocks, and the villagers simply never wandered far enough to find them. Though I swear I&apos;ve seen villagers wander quite a long ways out into a field. I ended up moving these houses closer and putting in a new house between them and the new street and that was enough for the villagers to discover the new houses and set off the baby boom I was looking for.&lt;/p&gt;

&lt;p&gt;It seems to me that the &quot;wandering&quot; algorithm could use adjusting. Perhaps this behavior should take into account crowding (moving away from clusters of people when they get too dense), as well as roads (there should be a certain amount of bias toward following a road rather than wandering across grass).&lt;/p&gt;</comment>
                            <comment id="15933" author="vit" created="Wed, 31 Oct 2012 17:28:10 +0100"  >&lt;p&gt;So, that means now guys from mojang have to fix it because this bug really old and annoying&lt;/p&gt;</comment>
                            <comment id="15917" author="sidben" created="Wed, 31 Oct 2012 16:57:03 +0100"  >&lt;p&gt;There is a bug with the AI, on reddit an user (ninti) described the bug in detail.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.reddit.com/r/Minecraft/comments/12aist/suggestion_why_dont_villagers_use_valid_beds/c6tn2hs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.reddit.com/r/Minecraft/comments/12aist/suggestion_why_dont_villagers_use_valid_beds/c6tn2hs&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="15885" author="ileon" created="Wed, 31 Oct 2012 15:51:45 +0100"  >&lt;p&gt;My villagers don&apos;t go in their houses anymore. &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="15323" author="xxcoder" created="Tue, 30 Oct 2012 08:24:32 +0100"  >&lt;p&gt;I solved this problem short term simply by destroying doors from most popular apartment (my world has few large apartments with many rooms for villagers) and villagers randomly selected rooms afterwards. After I put doors back on, 1/4 of them went there again. In least room is usable for them now.&lt;/p&gt;</comment>
                            <comment id="15307" author="takatino" created="Tue, 30 Oct 2012 05:18:53 +0100"  >&lt;p&gt;Logically, there can be more than 1 villager in a house, like how there are families in a real life house. I think an alternative way is to limit the max number of villager in a house, so that they dont over flow. This will possibly disable the infinite breeding, which I think is considered cheating.&lt;/p&gt;</comment>
                            <comment id="15015" author="severedfingernail" created="Mon, 29 Oct 2012 15:21:58 +0100"  >&lt;p&gt;I just want them to have sounds, longer pregnancies, and to hold hoes and farm realisticly.&lt;/p&gt;</comment>
                            <comment id="13104" author="necril" created="Thu, 25 Oct 2012 13:12:52 +0200"  >&lt;p&gt;Wouldn&apos;t it be a bit better if houses are the arrays, instead of the doors, and the space in the houses determining how many villagers can be in them? This way you will have &quot;families&quot; so as to say, instead of a-social villagers &lt;img class=&quot;emoticon&quot; src=&quot;https://bugs.mojang.com/images/icons/emoticons/biggrin.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="12939" author="zombygeek" created="Thu, 25 Oct 2012 05:45:49 +0200"  >&lt;p&gt;I also agree. I have a village with 66 houses and they all try to cram into one. Eventually I worked around this by adding tunnels from house to house for &apos;overflow&apos;. Also adding ladders to the roof with fence around it.&lt;/p&gt;</comment>
                            <comment id="12231" author="sciguyryan" created="Wed, 24 Oct 2012 18:56:55 +0200"  >&lt;p&gt;I&apos;ve noticed this too.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10101">
                    <name>Cloners</name>
                                                                <inwardlinks description="is cloned by">
                                        <issuelink>
            <issuekey id="23885">MC-10046</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10102">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="27537">MC-12677</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="32612">MC-16708</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="59255">MC-37114</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="60708">MC-38479</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="65749">MC-42081</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="76535">MC-50663</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="14968">MC-3079</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10103">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="24819">MC-10841</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="16211">MC-3944</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="24758">MC-10782</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="33250">MC-17247</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="60215">MC-38040</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="17190">MC-4662</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="10654" name="2012-10-09_19.37.59.png" size="466954" author="vit" created="Wed, 24 Oct 2012 18:37:14 +0200"/>
                            <attachment id="11993" name="2012-11-03_13.34.35.png" size="353772" author="mrsergio" created="Sat, 3 Nov 2012 13:42:07 +0100"/>
                            <attachment id="13251" name="2012-11-14_15.05.13.png" size="402599" author="mistersanderson" created="Thu, 15 Nov 2012 04:33:38 +0100"/>
                            <attachment id="26632" name="2013-04-02_21.10.07.png" size="243934" author="Hayes2232" created="Wed, 3 Apr 2013 03:11:12 +0200"/>
                            <attachment id="26633" name="2013-04-02_21.13.23.png" size="284932" author="Hayes2232" created="Wed, 3 Apr 2013 03:13:53 +0200"/>
                            <attachment id="41619" name="2013-09-17_23.jpg" size="1312291" author="DarthRiddle" created="Wed, 18 Sep 2013 07:02:07 +0200"/>
                            <attachment id="45810" name="2013-10-25_15.25.42.png" size="439022" author="_benjamindu11_" created="Fri, 25 Oct 2013 15:59:13 +0200"/>
                            <attachment id="45809" name="2013-10-25_15.29.50.png" size="506750" author="_benjamindu11_" created="Fri, 25 Oct 2013 15:59:13 +0200"/>
                            <attachment id="52913" name="2014-01-13_16.14.15.png" size="385602" author="jonathanho1226" created="Mon, 13 Jan 2014 09:16:27 +0100"/>
                            <attachment id="85147" name="Villager house (1.8.1-pre3).png" size="458849" author="marcono1234" created="Fri, 31 Oct 2014 18:44:56 +0100"/>
                            <attachment id="20113" name="Villagers 1.png" size="96777" author="maisumgustavo" created="Mon, 28 Jan 2013 10:59:00 +0100"/>
                            <attachment id="20114" name="Villagers 2.png" size="100299" author="maisumgustavo" created="Mon, 28 Jan 2013 10:59:00 +0100"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10701" key="com.atlassian.jira.plugin.system.customfieldtypes:datetime">
                        <customfieldname>CHK</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 17 Nov 2012 01:41:00 +0100</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10303"><![CDATA[Confirmed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10900" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Pinned</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0l4jr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>