Skip to content

Commit 217e11c

Browse files
Fix nether portal linking (#793): don't scale Y by dimension multiplier (#905)
Fixes #793 Problem NetherPortalBlockMixin applies the dimension coordinate multiplier (8x for Nether→Overworld, 0.125x for Overworld→Nether) to all three axes (X, Y, Z) when calculating the portal destination target position. Vanilla Minecraft only scales X and Z — the Y coordinate is never scaled by the dimension multiplier. This causes the portal search target to have a wildly incorrect Y value (e.g., Y=118 becomes Y=944 when going Nether→Overworld), resulting in the game selecting the wrong destination portal. Fix Remove * multiplier from the Y coordinate in the clampToBounds call (line 31 of NetherPortalBlockMixin.java). Tested Verified fix resolves the issue in both singleplayer and multiplayer. Portal linking now correctly selects the closest portal by Euclidean distance, matching vanilla behavior.
1 parent c5e4737 commit 217e11c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

common/src/main/java/dev/ryanhcode/sable/mixin/portal/NetherPortalBlockMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class NetherPortalBlockMixin {
2828

2929
return instance.clampToBounds(
3030
globalPos.x * multiplier,
31-
globalPos.y * multiplier,
31+
globalPos.y,
3232
globalPos.z * multiplier
3333
);
3434
}

0 commit comments

Comments
 (0)