<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sun Jan 12 12:23:05 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-10046] Random destination routine has a small statistical tendency to move more north west (fix included)</title>
                <link>https://bugs.mojang.com/browse/MC-10046</link>
                <project id="10400" key="MC">Minecraft: Java Edition</project>
                    <description>&lt;p&gt;&lt;b&gt;Update&lt;/b&gt; (see &lt;a href=&quot;https://bugs.mojang.com/browse/MC-10046?focusedCommentId=304613&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-304613):&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://bugs.mojang.com/browse/MC-10046?focusedCommentId=304613&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-304613):&lt;/a&gt;&lt;br/&gt;
seems the second part of the bug is still (or again?) in effect in 1.9. I do not change my code examples below, since I do not have the latest code to check the changes against, but looks like the fix would be obvious.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;This bug is somewhat difficult (or at least slow) to reproduce, because it needs a long time and controlled environment to be noticed. While issue &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; (perhaps related) sounds like it would be seen easily, this issue here can not be seen easily or quickly (unless certain range is temporarily changed to a smaller value).&lt;/p&gt;

&lt;p&gt;It should affect both survival and creative, and any and all activities and mob types that use the same method. Some activities are not affected as badly by this, as they do not accumulate over time.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Wander
	&lt;ul&gt;
		&lt;li&gt;Villager, iron golem, animals, skeleton, zombie, witch, wither, ...&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Move through village&lt;/li&gt;
	&lt;li&gt;Panic&lt;/li&gt;
	&lt;li&gt;Play&lt;/li&gt;
	&lt;li&gt;Avoid entity&lt;/li&gt;
	&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;b&gt;The bug&lt;/b&gt;&lt;br/&gt;
When the AI routine for wandering requests a random destination, the method used to roll and calculate that random destination has &lt;del&gt;two&lt;/del&gt; small &quot;math&quot; mistakes.&lt;/p&gt;

&lt;p&gt;&lt;del&gt;1) It rolls the relative random target location using random.nextInt(2*range) - range. For example, if range is 10 (i.e. +/-10 blocks from current location), the possible result range will be -10 to +9, with even distribution. This already has a small (but significant) statistical shift to negative value (i.e. north and west).&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;2) The result is then added the Math.floor(entity.pos) to make it absolute coordinate. However, this truncation discards any fractional part of entity position (towards north and west), and the thrown away part is never brought back or compensated.&lt;/p&gt;

&lt;p&gt;The end effect is seen as tendency to move, on the average, about 0.6 to 0.9 blocks per AI activity launched towards north west. I confirmed this by letting the game keep calculating the average relative movements over couple thousand &quot;wanderings&quot;, both for villagers and for chickens (separately for each type), and results were indeed values like -0.6 to -0.9 (fits within normal random differences due to &quot;small&quot; set of data). (The expected value would naturally be very near 0.)&lt;/p&gt;

&lt;p&gt;Showing the original method in complete as the changes are quite spread in it. Using MCP naming and my own renamings.&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;RandomPositionGenerator&lt;/b&gt;&lt;/div&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;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; Vec3 findRandomTargetBlock(EntityCreature entity, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; hor, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; ver, Vec3 inDir) {
        Random rng = entity.getRNG();
        &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; foundTarget = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; x = 0;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; y = 0;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; z = 0;
        &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; bestValue = -99999.0F;
        &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; var10;

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (entity.hasHome()) {
            &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; var11 = (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) (entity.getHomePosition().getDistanceSquared(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY), MathHelper.floor_double(entity.posZ)) + 4.0F);
            &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; var13 = (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) (entity.getMaximumHomeDistance() + (&lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt;) hor);
            var10 = var11 &amp;lt; var13 * var13;
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            var10 = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        }

        &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var16 = 0; var16 &amp;lt; 10; ++var16) {
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var12 = rng.nextInt(2 * hor) - hor;
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var17 = rng.nextInt(2 * ver) - ver;
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var14 = rng.nextInt(2 * hor) - hor;

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (inDir == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; || (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) var12 * inDir.xCoord + (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) var14 * inDir.zCoord &amp;gt;= 0.0D) {
                var12 += MathHelper.floor_double(entity.posX);
                var17 += MathHelper.floor_double(entity.posY);
                var14 += MathHelper.floor_double(entity.posZ);

                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!var10 || entity.isWithinHomeDistance(var12, var17, var14)) {
                    &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; pathValue = entity.getBlockPathWeight(var12, var17, var14);
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (pathValue &amp;gt; bestValue) {
                        bestValue = pathValue;
                        x = var12;
                        y = var17;
                        z = var14;
                        foundTarget = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
                    }
                }
            }
        }

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (foundTarget) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; entity.worldObj.getWorldVec3Pool().getVecFromPool((&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) x, (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) y, (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) z);
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;The fix&lt;/b&gt;&lt;br/&gt;
&lt;del&gt;1) random.nextInt(2*range+1) - range. This gives results between -range and +range, with even distribution and average of 0.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;2) Use the truncated absolute destination position for checking various things, but then the full value to set where to move. Thus, the effect will be 0.&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;RandomPositionGenerator&lt;/b&gt;&lt;/div&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;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; Vec3 findRandomTargetBlock(EntityCreature entity, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; hor, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; ver, Vec3 inDir) {
        Random rng = entity.getRNG();
        &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; foundTarget = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; x = 0;
        &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; y = 0;
        &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; z = 0;
        &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; bestValue = -99999.0F;
        &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; var10;

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (entity.hasHome()) {
            &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; var11 = (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) (entity.getHomePosition().getDistanceSquared(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY), MathHelper.floor_double(entity.posZ)) + 4.0F);
            &lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt; var13 = (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) (entity.getMaximumHomeDistance() + (&lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt;) hor);
            var10 = var11 &amp;lt; var13 * var13;
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            var10 = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        }

        &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var16 = 0; var16 &amp;lt; 10; ++var16) {
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var12 = rng.nextInt(2 * hor + 1) - hor;
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var17 = rng.nextInt(2 * ver + 1) - ver;
            &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var14 = rng.nextInt(2 * hor + 1) - hor;

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (inDir == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; || (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) var12 * inDir.xCoord + (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;) var14 * inDir.zCoord &amp;gt;= 0.0D) {
                &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var12b = var12 + MathHelper.floor_double(entity.posX);
                &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var17b = var17 + MathHelper.floor_double(entity.posY);
                &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; var14b = var14 + MathHelper.floor_double(entity.posZ);

                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!var10 || entity.isWithinHomeDistance(var12b, var17b, var14b)) {
                    &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; pathValue = entity.getBlockPathWeight(var12b, var17b, var14b);

                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (pathValue &amp;gt; bestValue) {
                        bestValue = pathValue;
                        x = entity.posX + var12;
                        y = entity.posY + var17;
                        z = entity.posZ + var14;
                        foundTarget = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
                    }
                }
            }
        }

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (foundTarget) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; entity.worldObj.getWorldVec3Pool().getVecFromPool(x, y, z);
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When testing the fixes on 1.4.7, the corresponding results for chickens were  now like this: &quot;Average wander delta now (3477): -0,0538, 2,0290, 0,0060&quot;. Very decent values, though they do naturally vary randomly from run to run, with small values on both sides of zero (as expected). Ignore the vertical delta of 2; chickens&apos; specialty. The 3477 is how many wanderings were averaged.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Minor optimization possibility in the same method, while at it&lt;/b&gt;&lt;br/&gt;
For villagers, the entity.getBlockPathWeight() method always return 0. Thus, the first roll will end up being the chosen destination, but all the 10 tries will always be rolled. Something might be done for that so that there won&apos;t be any wasted extra tries.&lt;/p&gt;</description>
                <environment></environment>
        <key id="23885">MC-10046</key>
            <summary>Random destination routine has a small statistical tendency to move more north west (fix included)</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="grum">[Mojang] Grum (Erik Broes)</assignee>
                                    <reporter username="bugi74">Markku</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Feb 2013 19:48:39 +0100</created>
                <updated>Sun, 10 May 2020 13:43:40 +0200</updated>
                            <resolved>Tue, 24 May 2016 13:10:20 +0200</resolved>
                                    <version>Minecraft 1.4.7</version>
                    <version>Minecraft 1.5</version>
                    <version>Minecraft 1.6.1</version>
                    <version>Minecraft 1.6.2</version>
                    <version>Minecraft 1.6.4</version>
                    <version>Minecraft 1.7.2</version>
                                    <fixVersion>Minecraft 14w02a</fixVersion>
                    <fixVersion>Minecraft 16w21a</fixVersion>
                                                        <votes>22</votes>
                                    <watches>9</watches>
                                                                            <comments>
                            <comment id="311775" author="5tr4" created="Wed, 8 Jun 2016 21:35:59 +0200"  >&lt;p&gt;I&apos;m curious if this bug also affects pocket edition.&lt;/p&gt;</comment>
                            <comment id="306959" author="grum" created="Tue, 24 May 2016 13:10:20 +0200"  >&lt;p&gt;Please verify it works as it should after the next snapshot! Thanks for the infos &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="304621" author="bugi74" created="Sat, 14 May 2016 20:14:16 +0200"  >&lt;p&gt;For easier check of its history, I&apos;m just going to strike-through the rest, keeping point 2.&lt;/p&gt;

&lt;p&gt;I can not reduce the code parts, and most of the description still applies (even if e.g. with slightly different numbers), so it wasn&apos;t much of a reduction. Should be clear that point 1 is not in effect, though.&lt;/p&gt;</comment>
                            <comment id="304615" author="JIRAUSER71590" created="Sat, 14 May 2016 19:46:00 +0200"  >&lt;p&gt;Reopened, &lt;a href=&quot;https://bugs.mojang.com/secure/ViewProfile.jspa?name=bugi74&quot; class=&quot;user-hover&quot; rel=&quot;bugi74&quot;&gt;bugi74&lt;/a&gt; please reduce the report to point 2 only.&lt;/p&gt;</comment>
                            <comment id="304613" author="marcono1234" created="Sat, 14 May 2016 19:42:28 +0200"  >&lt;p&gt;Please link to this comment in the description&lt;/p&gt;

&lt;p&gt;The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.&lt;/p&gt;

&lt;p&gt;The second part of this bug is not fixed in 1.9&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;2) The result is then added the Math.floor(entity.pos) to make it absolute coordinate. However, this truncation discards any fractional part of entity position (towards north and west), and the thrown away part is never brought back or compensated.&lt;/p&gt;&lt;/blockquote&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;/**
 * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction of
 * par3Vec3, then points to the tile &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; which creature.getBlockPathWeight returns the highest number
 */
&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; Vec3d findRandomTargetBlock(EntityCreature entitycreatureIn, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; xz, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; y, Vec3d targetVec3)
{
    PathNavigate pathnavigate = entitycreatureIn.getNavigator();
    Random random = entitycreatureIn.getRNG();
    &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; flag = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; i = 0;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; j = 0;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; k = 0;
    &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; f = -99999.0F;
    &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; flag1;

    &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; j1 = 0; j1 &amp;lt; 10; ++j1)
    {
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; l = random.nextInt(2 * xz + 1) - xz;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; k1 = random.nextInt(2 * y + 1) - y;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; i1 = random.nextInt(2 * xz + 1) - xz;

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (targetVec3 == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; || (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;)l * targetVec3.xCoord + (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;)i1 * targetVec3.zCoord &amp;gt;= 0.0D)
        {
            &lt;span class=&quot;code-comment&quot;&gt;//...
&lt;/span&gt;
            l = l + MathHelper.floor_double(entitycreatureIn.posX);
            k1 = k1 + MathHelper.floor_double(entitycreatureIn.posY);
            i1 = i1 + MathHelper.floor_double(entitycreatureIn.posZ);
            BlockPos blockpos1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; BlockPos(l, k1, i1);

            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ((!flag1 || entitycreatureIn.isWithinHomeDistanceFromPosition(blockpos1)) &amp;amp;&amp;amp; pathnavigate.func_188555_b(blockpos1))
            {
                &lt;span class=&quot;code-object&quot;&gt;float&lt;/span&gt; f1 = entitycreatureIn.getBlockPathWeight(blockpos1);

                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (f1 &amp;gt; f)
                {
                    f = f1;
                    i = l;
                    j = k1;
                    k = i1;
                    flag = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
                }
            }
        }
    }

    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (flag)
    {
        &lt;span class=&quot;code-comment&quot;&gt;// Still using floor method
&lt;/span&gt;        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Vec3d((&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;)i, (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;)j, (&lt;span class=&quot;code-object&quot;&gt;double&lt;/span&gt;)k);
    }
    &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
    {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; A problem is as well that the field &lt;tt&gt;net.minecraft.entity.EntityCreature.homePosition&lt;/tt&gt; is a &lt;tt&gt;BlockPos&lt;/tt&gt;, but its integer values are used to get a vector used for movement without using the center of the block. An example for this is the method &lt;tt&gt;net.minecraft.entity.ai.EntityAIMoveTowardsRestriction.shouldExecute()&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="125797" author="sammyiam" created="Wed, 18 Dec 2013 19:46:25 +0100"  >&lt;p&gt;Hooray!  Excited that this is fixed.  I couldn&apos;t figure out why my villagers were all gathering in one corner of the village; I didn&apos;t even think about the fact that it might be a bug.  Thanks, Grum! &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="125134" author="jccreszminecraft" created="Sun, 15 Dec 2013 02:55:26 +0100"  >&lt;p&gt;Why are all these comments about a 1.8 bug when it&apos;s a non-existent version yet?&lt;/p&gt;</comment>
                            <comment id="125104" author="grum" created="Sat, 14 Dec 2013 23:47:02 +0100"  >&lt;p&gt;Told them cows to not group in the NorthWest anymore, they didn&apos;t even realise they were doing it. The chickens just clucked suspiciously.&lt;/p&gt;</comment>
                            <comment id="112804" author="jeuvke" created="Sat, 19 Oct 2013 17:14:50 +0200"  >&lt;p&gt;Still in 1.6.4. Very annoying, especially with animal farms.&lt;/p&gt;</comment>
                            <comment id="109716" author="the_tracker" created="Mon, 7 Oct 2013 21:56:42 +0200"  >&lt;p&gt;A screenshot of an (artificial) iron golems farm.&lt;br/&gt;
We can see that the villagers go in the top-right hand corner of the screen, which is North-West.&lt;/p&gt;</comment>
                            <comment id="90569" author="gerbilcrab475" created="Sun, 14 Jul 2013 00:18:57 +0200"  >&lt;p&gt;This is a very annoying glitch. Many of the mobs in my zoo get stick to the North-west corners of each exhibit. If I could post a picture, I would. It&apos;s very noticeable with spiders and horses.&lt;/p&gt;</comment>
                            <comment id="88929" author="bugi74" created="Thu, 11 Jul 2013 08:00:35 +0200"  >&lt;p&gt;I checked at the code level, too, and updated the version list.&lt;/p&gt;</comment>
                            <comment id="88903" author="dv king" created="Thu, 11 Jul 2013 07:23:42 +0200"  >&lt;p&gt;I placed a bunch of sheep around me, trying to place them a little south east of  where I was standing at the origin. I left it on while I was gone from home for 6 hours and got the picture NWtrend as my result.&lt;br/&gt;
I think this bug is clearly confirmed and in 1.6.2.&lt;/p&gt;

&lt;p&gt;Just to quantify this, in each quadrant I had the given number of sheep&lt;br/&gt;
Northwest: 12&lt;br/&gt;
Northeast: 3&lt;br/&gt;
Southeast: 0&lt;br/&gt;
Southwest: 4&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;That is based on the sheep which were rendered in the overhead picture. There were some not pictured.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If you play for any extended period of time I think this is very, very noticeable. &lt;/p&gt;</comment>
                            <comment id="86938" author="stalephish" created="Tue, 9 Jul 2013 11:57:37 +0200"  >&lt;p&gt;This is the most convincing argument I&apos;ve seen for these symptoms that I&apos;ve seen to date, which combined with the animals-escaping-pen (which was recently supposedly fixed), meant animal enclosures were very hard to manage. I run a Bukkit server and have seen evidence of this numerous times; conveniently, there exists a large square pen with sheep, which leave evidence (in the form of eaten grass) which is viewable on DynMap, proving that they have migrated mostly north-west, but also north-east. See attached picture.&lt;/p&gt;</comment>
                            <comment id="86143" author="dv king" created="Mon, 8 Jul 2013 19:01:09 +0200"  >&lt;p&gt;@ANBO Motohiko&lt;br/&gt;
No, that is a problem with core path-drawing methods, explained in &lt;a href=&quot;https://bugs.mojang.com/browse/MC-21109&quot; title=&quot;Pathfinding is fundamentally flawed (it strictly follows the grid)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-21109&quot;&gt;&lt;del&gt;MC-21109&lt;/del&gt;&lt;/a&gt;, which honestly is the same problem as &lt;a href=&quot;https://bugs.mojang.com/browse/MC-12427&quot; title=&quot;Mobs get stuck in the North-West corner of a fence&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-12427&quot;&gt;&lt;del&gt;MC-12427&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://bugs.mojang.com/browse/MC-4661&quot; title=&quot;Chickens (And small mobs) cannot path when standing in/next to fences&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-4661&quot;&gt;&lt;del&gt;MC-4661&lt;/del&gt;&lt;/a&gt; (which have the same cause in the code), but explained in more detail for more situations. In that bug, an entity is trying to path from inside a fence. In this bug the random destinations animals choose to move in tend to be weighted northwest of it. Both bugs are annoying and should be fixed however.&lt;/p&gt;</comment>
                            <comment id="86052" author="amotohiko" created="Mon, 8 Jul 2013 17:13:20 +0200"  >&lt;p&gt;related?: &lt;a href=&quot;https://bugs.mojang.com/browse/MC-12427&quot; title=&quot;Mobs get stuck in the North-West corner of a fence&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MC-12427&quot;&gt;&lt;del&gt;MC-12427&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="85921" author="filter62" created="Mon, 8 Jul 2013 10:46:45 +0200"  >&lt;p&gt;Well, I can confirm this, due to all my animals stay in one corner of huge farm.&lt;/p&gt;</comment>
                            <comment id="74978" author="dv king" created="Tue, 18 Jun 2013 10:25:13 +0200"  >&lt;p&gt;I have had animals swim off , to (from kilometers away), and past my island home following a northwest path. By and large it seems all the animals in my world migrate northwest unless I enclose them. Actually, if you look at large animal enclosures you can see a slight northwest bias. I hope this gets fixed as it is an annoyance when you have lived in an area a long time. Good work.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10101">
                    <name>Cloners</name>
                                            <outwardlinks description="clones">
                                        <issuelink>
            <issuekey id="11322">MC-78</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10102">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="27187">MC-12352</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="122617">MC-89509</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="135203">MC-97698</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="16211">MC-3944</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10103">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="138082">MC-100001</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="225659">MCPE-41092</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="163835">MC-113979</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="27267">MC-12427</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="52372">MC-31153</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="36221" name="2013-07-08_12.54.08.png" size="1631165" author="filter62" created="Mon, 8 Jul 2013 10:57:40 +0200"/>
                            <attachment id="43673" name="2013-10-07_21.38.02.png" size="356747" author="the_Tracker" created="Mon, 7 Oct 2013 21:56:42 +0200"/>
                            <attachment id="43674" name="2013-10-07_21.54.17.png" size="780646" author="the_Tracker" created="Mon, 7 Oct 2013 21:56:42 +0200"/>
                            <attachment id="36775" name="NWtrend.png" size="482155" author="DV King" created="Thu, 11 Jul 2013 07:23:42 +0200"/>
                            <attachment id="36447" name="ScreenHunter025b.png" size="54364" author="stalephish" created="Tue, 9 Jul 2013 11:57:37 +0200"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10701" key="com.atlassian.jira.plugin.system.customfieldtypes:datetime">
                        <customfieldname>CHK</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 21 Feb 2013 22:08:00 +0100</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10301"><![CDATA[Plausible]]></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="10305"><![CDATA[Creative]]></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|i0iwsv:</customfieldvalue>

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