-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Labels
Description
This issue actually predates the unofficial fork, and occurs in 5.08, 5.09, and 5.10, but Greg fixed it for GT6 back in May 2015 (ref: http://forum.industrial-craft.net/index.php?page=Thread&postID=187659#post187659)
Current code is this:
if ((Math.abs(this.mX / 16) % 3 == 1) && (Math.abs(this.mZ / 16) % 3 == 1))However, that results in a pattern like this:
Math.abs(-160 / 16) % 3 = 1
Math.abs(-144 / 16) % 3 = 0
Math.abs(-128 / 16) % 3 = 2
Math.abs(-112 / 16) % 3 = 1
Math.abs(-96 / 16) % 3 = 0
Math.abs(-80 / 16) % 3 = 2
Math.abs(-64 / 16) % 3 = 1
Math.abs(-48 / 16) % 3 = 0
Math.abs(-32 / 16) % 3 = 2
Math.abs(-16 / 16) % 3 = 1
Math.abs(0 / 16) % 3 = 0
Math.abs(16 / 16) % 3 = 1
Math.abs(32 / 16) % 3 = 2
Math.abs(48 / 16) % 3 = 0
Math.abs(64 / 16) % 3 = 1
Math.abs(80 / 16) % 3 = 2
Math.abs(96 / 16) % 3 = 0
Math.abs(112 / 16) % 3 = 1
Math.abs(128 / 16) % 3 = 2
Math.abs(144 / 16) % 3 = 0
Which produces excess overlap near the axes. However, if one adds a large multiple of 3 after dividing by 16 instead of taking the absolute value, proper spacing is maintained:
(-160 / 16 + 402653184) % 3 = 2
(-144 / 16 + 402653184) % 3 = 0
(-128 / 16 + 402653184) % 3 = 1
(-112 / 16 + 402653184) % 3 = 2
(-96 / 16 + 402653184) % 3 = 0
(-80 / 16 + 402653184) % 3 = 1
(-64 / 16 + 402653184) % 3 = 2
(-48 / 16 + 402653184) % 3 = 0
(-32 / 16 + 402653184) % 3 = 1
(-16 / 16 + 402653184) % 3 = 2
(0 / 16 + 402653184) % 3 = 0
(16 / 16 + 402653184) % 3 = 1
(32 / 16 + 402653184) % 3 = 2
(48 / 16 + 402653184) % 3 = 0
(64 / 16 + 402653184) % 3 = 1
(80 / 16 + 402653184) % 3 = 2
(96 / 16 + 402653184) % 3 = 0
(112 / 16 + 402653184) % 3 = 1
(128 / 16 + 402653184) % 3 = 2
(144 / 16 + 402653184) % 3 = 0
I don't know why Greg chose that particular number. Given that Minecraft limits the playable area to -30000000<=x, z<30000000 (ref http://minecraft.gamepedia.com/World_boundary), adding 1875000 after dividing by 16 would be sufficient.