<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sun Jan 12 12:25:42 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-10841] Villages are persisted to NBT, yet still destroyed/recreated on chunk reload</title>
                <link>https://bugs.mojang.com/browse/MC-10841</link>
                <project id="10400" key="MC">Minecraft: Java Edition</project>
                    <description>&lt;h3&gt;&lt;a name=&quot;Thebug&quot;&gt;&lt;/a&gt;The bug&lt;/h3&gt;
&lt;p&gt;Villages and all of their doors are written to the NBT.  However, once a chunk containing village doors is unloaded those doors are removed from the village (and the village possibly destroyed if its the last door)&lt;/p&gt;

&lt;p&gt;When the player enters the area again, a completely new village is recreated from scratch.&lt;/p&gt;

&lt;p&gt;It seems the intent from writing villages to the NBT is to keep villages and their door associations correctly intact.  However, this is not the case when travelling far away or to another dimension.&lt;/p&gt;

&lt;p&gt;Suggestion:  Don&apos;t remove a door from a village if the chunk containing the door is unloaded.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;Place a wooden door and two blocks behind it a solid block (for example sandstone)&lt;/li&gt;
	&lt;li&gt;Summon a villager&lt;/li&gt;
	&lt;li&gt;Pause the game and inspect the &lt;tt&gt;villages.dat&lt;/tt&gt; file using for example the tool &lt;a href=&quot;http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1262665-nbtexplorer-nbt-editor-for-windows-and-mac&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;NBTExplorer&lt;/a&gt;&lt;br/&gt;
&#8594; The village data contains the door data&lt;/li&gt;
	&lt;li&gt;Kill the villager and wait one minute&lt;/li&gt;
	&lt;li&gt;Pause the game and inspect the file again (with NBTExplorer you have to reopen it, refreshing does not always work)&lt;br/&gt;
&#8594; The village does not contain the door anymore&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;&lt;a name=&quot;Thereason&quot;&gt;&lt;/a&gt;The reason&lt;/h3&gt;
&lt;p&gt;The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.&lt;/p&gt;

&lt;p&gt;A door is added to a village if a wooden door is in a cuboid based on the villager&apos;s position with the following size:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;x: -16 to 15&lt;/li&gt;
	&lt;li&gt;y: -4 to 3&lt;/li&gt;
	&lt;li&gt;z: -16 to 15&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If a door is already part of a village its &lt;tt&gt;net.minecraft.village.VillageDoorInfo.lastActivityTimestamp&lt;/tt&gt; gets updated. If the difference between the current time and the timestamp is greater than 1200 ticks (1 minute) the door is removed by the method &lt;tt&gt;net.minecraft.village.Village.removeDeadAndOutOfRangeDoors()&lt;/tt&gt;.&lt;br/&gt;
One approach to changing this could be saving a village if all the chunks that are part of the village are unloaded instead of removing doors. There might be other checks needed to make sure this is not exploited for iron farms.&lt;/p&gt;</description>
                <environment></environment>
        <key id="24819">MC-10841</key>
            <summary>Villages are persisted to NBT, yet still destroyed/recreated on chunk reload</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="10001">Awaiting Response</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="marcono1234">Marcono1234</reporter>
                        <labels>
                    </labels>
                <created>Sun, 3 Mar 2013 00:15:29 +0100</created>
                <updated>Tue, 2 Oct 2018 22:25:45 +0200</updated>
                            <resolved>Tue, 2 Oct 2018 22:25:45 +0200</resolved>
                                    <version>Snapshot 13w10a</version>
                    <version>Minecraft 1.5</version>
                    <version>Minecraft 1.9</version>
                    <version>Minecraft 1.9.1 Pre-Release 1</version>
                    <version>Minecraft 1.9.1 Pre-Release 2</version>
                    <version>Minecraft 1.9.1 Pre-Release 3</version>
                    <version>Minecraft 1.9.1</version>
                    <version>Minecraft 1.9.2</version>
                    <version>Minecraft 16w15b</version>
                                                                        <votes>70</votes>
                                    <watches>18</watches>
                                                                            <comments>
                            <comment id="492097" author="urielsalis" created="Tue, 2 Oct 2018 22:23:16 +0200"  >&lt;p&gt;Is this still a issue in the latest version of the game(currently 1.13.1)?&lt;/p&gt;

&lt;p&gt;If so, please add it to the affected versions, thanks!&lt;/p&gt;</comment>
                            <comment id="463517" author="qwerty23495" created="Mon, 25 Jun 2018 23:03:18 +0200"  >&lt;p&gt;Does this still affect the current versions of Minecraft? (&lt;b&gt;1.12.2, 1.13-pre3&lt;/b&gt;). If so, please update the ticket accordingly.&lt;/p&gt;</comment>
                            <comment id="301014" author="marcono1234" created="Wed, 20 Apr 2016 17:11:43 +0200"  >&lt;p&gt;The problem is probably then that the method &lt;tt&gt;net.minecraft.village.Village.removeDeadAndOutOfRangeDoors()&lt;/tt&gt; is not testing if the door position is loaded. This cannot be fixed that easily because the whole concept does not work there anymore. As soon as the door is loaded it will be removed because the tick it was last updated was too long ago.&lt;/p&gt;</comment>
                            <comment id="301012" author="marcono1234" created="Wed, 20 Apr 2016 16:41:37 +0200"  >&lt;p&gt;&lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=_droidfreak_&quot; class=&quot;user-hover&quot; rel=&quot;_droidfreak_&quot;&gt;&lt;em&gt;droidfreak&lt;/em&gt;&lt;/a&gt; I misunderstood the report then, sorry &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;

&lt;p&gt;However I can reproduce what you describe as well for 16w15b&lt;/p&gt;</comment>
                            <comment id="300958" author="_droidfreak_" created="Wed, 20 Apr 2016 06:06:43 +0200"  >&lt;p&gt;Marcono&apos;s steps to reproduce are separate from the bug in question. The bug in question is regarding village doors that are still near villagers getting removed from villages.dat when the chunks unload, whereas Marcono&apos;s steps to reproduce are about doors being removed from the village when villagers are no longer nearby (which is not a bug but a feature). The original bug has in fact been fixed in 1.9.&lt;/p&gt;

&lt;p&gt;Steps to reproduce the original bug:&lt;/p&gt;

&lt;p&gt;1) Ensure you are not in the spawn chunks (/tp @p 1000 ~ 0)&lt;br/&gt;
2) Place a villager in a fenced area and a valid village door (see &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;)&lt;br/&gt;
3) Wait a minute for the door to register and then check villages.dat. You&apos;ll see an entry for that village with one door&lt;br/&gt;
4) Teleport yourself 1000 blocks away (/tp @p 0 ~ 0)&lt;br/&gt;
5) Wait a minute for the game to register that the village is no longer loaded.&lt;br/&gt;
6) Check villages.dat again. In 1.8 and older, the village you created will no longer be listed. In 1.9 (or at least 1.9.2), it correctly remains listed in villages.dat.&lt;/p&gt;

&lt;p&gt;This bug is fixed. If Marcono wants to make a separate report for his &quot;bug&quot; he can but I&apos;d say that the situation in his steps to reproduce works as intended. Villages are supposed to die if they are no longer populated by villagers.&lt;/p&gt;</comment>
                            <comment id="297368" author="JIRAUSER71590" created="Tue, 29 Mar 2016 18:23:39 +0200"  >&lt;p&gt;changed reporter to &lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=marcono1234&quot; class=&quot;user-hover&quot; rel=&quot;marcono1234&quot;&gt;marcono1234&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="297360" author="marcono1234" created="Tue, 29 Mar 2016 17:26:20 +0200"  >&lt;p&gt;Please link to this comment in the description&lt;/p&gt;

&lt;p&gt;The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.&lt;/p&gt;

&lt;p&gt;A door is added to a village if a wooden door is in a cuboid based on the villager&apos;s position with the following size:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;x: -16 to 15&lt;/li&gt;
	&lt;li&gt;y: -4 to 3&lt;/li&gt;
	&lt;li&gt;z: -16 to 15&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If a door is already part of a village its &lt;tt&gt;net.minecraft.village.VillageDoorInfo.lastActivityTimestamp&lt;/tt&gt; gets updated. If the difference between the current time and the timestamp is greater than 1200 ticks (1 minute) the door is removed by the method &lt;tt&gt;net.minecraft.village.Village.removeDeadAndOutOfRangeDoors()&lt;/tt&gt;.&lt;br/&gt;
One approach to changing this could be saving a village if all the chunks that are part of the village are unloaded instead of removing doors. There might be other checks needed to make sure this is not exploited for iron farms.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;Place a wooden door and two blocks behind it a solid block (for example sandstone)&lt;/li&gt;
	&lt;li&gt;Summon a villager&lt;/li&gt;
	&lt;li&gt;Pause the game and inspect the &lt;tt&gt;villages.dat&lt;/tt&gt; file using for example the tool &lt;a href=&quot;http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-tools/1262665-nbtexplorer-nbt-editor-for-windows-and-mac&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;NBTExplorer&lt;/a&gt;&lt;br/&gt;
&#8594; The village data contains the door data&lt;/li&gt;
	&lt;li&gt;Kill the villager and wait one minute&lt;/li&gt;
	&lt;li&gt;Pause the game and inspect the file again (with NBTExplorer you have to reopen it, refreshing does not always work)&lt;br/&gt;
&#8594; The village does not contain the door anymore&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="297359" author="marcono1234" created="Tue, 29 Mar 2016 17:16:12 +0200"  >&lt;p&gt;Confirmed for&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;b&gt;1.9.1-pre3&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="295339" author="JIRAUSER71590" created="Fri, 18 Mar 2016 17:09:21 +0100"  >&lt;p&gt;No response for over a year.&lt;/p&gt;</comment>
                            <comment id="206606" author="galaxy_2alex" created="Thu, 30 Oct 2014 19:00:57 +0100"  >&lt;p&gt;Is this still a concern in the &lt;em&gt;current Minecraft version&lt;/em&gt;? If so, please &lt;em&gt;update the affected versions&lt;/em&gt; in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. If this has been done, we can reopen the issue.&lt;/p&gt;

&lt;p&gt;Keep in mind that the &quot;Resolved&quot;-Status on this ticket just means &quot;Answered&quot;, and that we are waiting for further information on whether this issue still exists or not. We will reopen it as soon as the requested information has been deliviered.&lt;/p&gt;</comment>
                            <comment id="106295" author="cad97" created="Thu, 26 Sep 2013 01:04:39 +0200"  >&lt;p&gt;Was this fixed by the recent structure fix (or in parallel) (1.6.4)? I remember a Mojanster saying that the only difference between 1.6.2 and 1.6.4 was the structure bug and one concerning villages... I&apos;d like someone to actively test to see if this bug was fixed or addressed in any way, but I don&apos;t have the skill set or computer to do so myself.&lt;/p&gt;</comment>
                            <comment id="96772" author="zambonifofex" created="Fri, 2 Aug 2013 18:48:56 +0200"  >&lt;p&gt;this is actually a great idea. but i think it&apos;s a bit hard to do. Maybe, minecraft would see what is the chunk present on the village nearest to the player, and, if its in the loading-radius, all the village will be loaded, if it&apos;s not on the loading radius, all the village will be unloaded...&lt;/p&gt;</comment>
                            <comment id="75963" author="cad97" created="Fri, 21 Jun 2013 19:00:50 +0200"  >&lt;p&gt;I have a possible brute force fix for the problem pointed out by Markku:  When a village exists, don&apos;t unload parts of it, only all of it.  AKA treat a village as one big chunk for loading/unloading purposes.  May cause lag issues esp. with overly large villages, but this is just a brute fix.&lt;/p&gt;</comment>
                            <comment id="62364" author="swiftcashew" created="Sun, 21 Apr 2013 19:47:03 +0200"  >&lt;p&gt;This really should be fixed.&lt;/p&gt;</comment>
                            <comment id="49305" author="bugi74" created="Sun, 3 Mar 2013 11:41:04 +0100"  >&lt;p&gt;Can confirm (by observing some added console logging for each door/village addition/removal activity).&lt;/p&gt;

&lt;p&gt;Additionally, during loading the world, the doors and the village under testing was removed &lt;em&gt;twice&lt;/em&gt;, yet no signs of adding them back. Yet, the village is there (as if there was still a third entry that was kept). Something weird, though not dangerous in that.&lt;/p&gt;

&lt;p&gt;Also, related to &lt;a href=&quot;https://bugs.mojang.com/browse/MC-78&quot; title=&quot;Villagers crowd into a single building&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-78&quot;&gt;&lt;del&gt;MC-78&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Any changes to this have lots to do with &lt;a href=&quot;https://bugs.mojang.com/browse/MC-78&quot; title=&quot;Villagers crowd into a single building&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-78&quot;&gt;&lt;del&gt;MC-78&lt;/del&gt;&lt;/a&gt;, (and its related issues), as the village behavior depends strongly on the doors.&lt;/p&gt;

&lt;p&gt;Note that simply keeping the door knowledge of a village even when the containing chunks get unloaded (as suggested in the description) may have some undesired effects unless compensated in other related code. For example, if doors are not dropped, the village center and radius stay the same. Then villagers would, over the day, move randomly over the full the village area. Once they decide to move to a spot that is unloaded, they get &quot;stuck&quot; there. This may lead to &quot;pushing&quot; the villagers (and golems) to one side of the village, with its possible side-effects, like dropping (temporarily) the doors on the nearer side of the village. (And that was just one example that came to my mind).&lt;/p&gt;

&lt;p&gt;EDIT:&lt;br/&gt;
Apparently, if one moves far enough to get the village removed by chunk unloading, it will still survive in the saved data (but only for some special case). When the world is loaded again (while being as far away), the doors and village gets either removed twice, but its data is still there (as it will not be &quot;found&quot; again while approaching it), &lt;em&gt;or&lt;/em&gt; it and its doors get scanned through and village created, with its chunks still supposedly unloaded (i.e. it will have to load the needed far away chunks just to check for the doors).&lt;/p&gt;

&lt;p&gt;This behavior only goes for one village, the one that was near when the world was created. There are two other villages I&apos;ve visited, but they seem to behave more or less as expected.&lt;/p&gt;

&lt;p&gt;Caveat: There are probably some code paths I&apos;ve not just spotted which explain some of these mysteries, and I&apos;m testing this the only way possible, i.e. using the MCP decompiled version, which may change some things.&lt;/p&gt;</comment>
                            <comment id="49237" author="brettbalsewich" created="Sun, 3 Mar 2013 01:04:55 +0100"  >&lt;p&gt;This would be so epic if it gets fixed &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>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10103">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="11322">MC-78</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10701" key="com.atlassian.jira.plugin.system.customfieldtypes:datetime">
                        <customfieldname>CHK</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 28 Mar 2013 20:22:00 +0100</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10302"><![CDATA[Community Consensus]]></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_10501" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Game Mode</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10304"><![CDATA[Survival]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0na3b:</customfieldvalue>

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