Portals not linking in the y-direction correctly.
x : Overworld x, x_n: Nether x
y: Overworld y, y_n: Nether y
z: Overworld z, z_n: Nether z
I placed two over world portals in "close" proximity (approx: 100 blocks). If the nether portals are place at the extact coordinates to link (x_n = floor(x/8), y_n = floor(y/2), z_n=floor(z/8)) I come out of unexpected portals, because it appears the actual calculation is (x_n = floor(x/8), y_n = floor( y), z_n=floor(z/8)).
It appears someone forgot to divide the y direction by two when determining the distance to the closest nether portal.
I can provide a test world if you want. I work around it by making sure the portals I want are closer in the y direction then the one I don't want.
Comments 4
Horizontal coordinates and distances in the Nether are proportional to the Overworld in a 1:8 ratio. That is, by moving 1 block horizontally in the Nether, players have moved the equivalent of 8 blocks on the Overworld. This does not apply on the Y-axis, despite the Nether having only 128 layers. Thus, for a given location (X, Y, Z) in the Overworld, the corresponding coordinates in the Nether are (floor(X) ÷ 8, Y, floor(Z) ÷ 8) (the Java floor() method gives the largest integer less than or equal to the argument, so an X- or Z-coordinate of -29.5 becomes -30, not -29). Conversely, for a location (X, Y, Z) in the Nether, the matching Overworld coordinates are (floor(X) × 8, Y, floor(Z) × 8).
Note: the nether actually has the full 256 blocks height even if it only uses the bottom half. Nether portals above 128 in the nether will link to the overworld normally but nothing can link back to them. I found this out using the area above 128 for flatland building. Solved the problem by making portals next to the ladders down into the regular nether (around y 124 or so).
I assume one day they're going to change Nether generation so it uses the full 256 height and that's why they didn't try to divide Y by 2. Why fix it when they'll just have to unfix it later?
You don't know what they are going to do. All I know is right now I can't get portals to connect correctly if they are arbitrary sizes, and as you mentioned I can't travel to the portals above 127. I'm building in an amplified world and this is amplifying the problem... Your solution is unacceptable. Its a simple fix in the game that they could change later. If the soution is to make the nether taller that's great! As long as the math works to link portals correctly which right now, they do not.
This makes sense, because when they doubled the world height, they would need to divide the nether's height by 2 to compensate for the extra range in the overworld.