
ModMIT
EndGatewayFix
Fixes the alignment in end gateway generation.
30
Downloads
1
Followers
4 months ago
Updated
📦
1
Versions
📖About EndGatewayFix
Fixes the End gateway generation to be symmetrical.
Technical Explanation- Whenever you kill the ender dragon and a gateway spawns, a chunk of code is run that roughly looks like this:
x = floor(diameter * cos(2 * (-pi + toRadians(9) * gatewayNum)));
z = floor(diameter * sin(2 * (-pi + toRadians(9) * gatewayNum)));
- The issue lies in using
floorover the entire equation for two reasons.
The floor method always rounds down to the nearest integer, which means it will always be offset on any point with a negative decimal that would otherwise be rounded up.
The floating point inaccuracies of
picause it to be rounded down where it especially shouldn't, such as on a 0 (for example, creating -1 from -0.00000000000001).
- This mod fixes this issue by instead opting to use the
roundmethod from the built-in Java Math class, which just rounds down when a number is 0.0 to 0.499…, and up when its 0.5 to 0.99….

