mojira.dev
MC-11199

Eye of Ender does not always lead to the nearest Stronghold

When throwing an Eye of Ender it does not always lead you to the nearest structure due to a typo in the method for that.

What I expected to happen:
I expected the Eye of Ender to always lead to the nearest stronghold

What actually happend:
It sometimes shows a stronghold farther away

Steps to reproduce:
Easy way:
1. Create a superflat world with the preset
2;7,2x3,2;1;stronghold(distance=10 count=10 spread=10)
2. Teleport to 0 10 0
3. Fly close to a Stronghold
4. Throw Eyes of Ender
5. From some points they will not lead to the Stronghold you are closest to.

Harder way to prove it's not due to the preset or flatworlds:
1. Create a world with the seed 3351546583236556057 (Creative, so you can teleport and fly)
2. Teleport to -515 80 601 so it generates the stronghold at that position
3. Teleport to 693 80 269 and dig down until you find the stronghold (At y=44)
4. Throw Eyes of Ender

Why it happens:
In the structure class, where it tries to find the nearest instance it calculates the distance as
d2 = i + i * j * j + k * k;
where it should be
d2 = i * i + j * j + k * k;
In 1.5 it is in the agm class in lines 145 and 164.

Comments 13

reproduction step 3 is quite vague! after steps 1 and 2, i tossed a hundred ender eyes while standing still, all went the same way. followed the eye direction for a bit, tossing numerous more eyes, everything appears to be functioning normally

Okay, I did not phrase that well. What I meant was fly close to a stronghold and throw Eyes of Ender from there. Sometimes they will not fly to the Stronghold closest to you even if you are just some blocks away from it. I will update the description with a better reproduction guide.
E.g., with the seed 6946425067433012199 and the preset
2;7,2x3,2;1;stronghold(distance=10 count=10 spread=10),
teleport to 160 36 -250.
You are standing on a portal room, but the Eyes still lead you to another direction.
All Eyes always fly in the same direction from one point, it's just that the calculation of that direction is wrong.

Confirmed with the given flatland preset and coordinates, but not sure if the algorithm won't get confused by the many strongholds.

You can of course try it with another preset, like 2;7,2x3,2;1;stronghold(distance=10),
that will just make the strongholds appear 10 chunks from 0 0 0 instead of the normal 32.
You can do the same thing, fly close to the strongholds, throw the eyes, and it will fail for some coordinates because the calculation of the distance is wrong.
It's just a small type, as posted in the description.

3 more comments

Didn't work for me UNLESS I generate more than 5 Strongholds in the same world.

Okay steps for noticing with a normal world, not a superflat, so no presets and everything all normal.
• Create a world with the seed 3351546583236556057 (Creative, so you can teleport and fly)
• Teleport to -515 80 601 so it generates the stronghold at that position
• Teleport to 693 80 269 and dig down until you find the stronghold (At y=44)
• Throw Eyes of Ender

They will fly toward the first stronghold located at -515 29 601.
I hope that disarms the doubts...
(I also added this guide to the description so it's easier to find.)

This is actually an old issue that maybe was fixed or supposedly fixed at some intermediate point. In my old SMP world I had stumbled across one stronghold and when I used Eye of Ender to try for another it sent me to another area even if I was standing above the stronghold I had located. To add insult to injury the "stronghold" it was directing me to had been obliterated by other terrain generation.

Eventually I employed AMIDST to confirm my coordinates and test it against the third stronghold. The Eye of Ender would not find either of the existing, unmolested strongholds even while standing above their end portals. It would only direct me to the location where the missing end portal should have been.

This was back around 1.3.1 at the latest, though I do not have an accurate lower bound on the version number in which either the testing or terrain generation occurred.

Fixed in 13w24a!
Thanks EvilSeph 😉

(I know this is resolved, but I just want to add this.)

I noticed this sort of thing on my server when I was finding all the strongholds in Creative mode. The Eyes of Ender pointed to one stronghold when I was closer to the ground, and then they pointed to a different one in about the opposite direction when I gained altitude.

Ferd Erik

(Unassigned)

Confirmed

nearest, stronghold, structure, world

Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w10a, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.5.2

Snapshot 13w24a

Retrieved