Husk Spawn (Fabric)

Husk Spawn (Fabric)

59.7k Downloads

mod:World Border more options for "wrap" logic

Erumaaro opened this issue ยท 0 comments

commented

Information

Minecraft version: 1.20.1
Modloader: Forge
Mod name: World Border

Feature description

The current "wrap" logic teleports the player to the opposite side of the map, which effectivly makes the playable area similar to a torus.
I would like it if was possible to choose a different/new "wrap" logic for each direction:

border types: teleport inside, wrap, pole (choose one)
if pole type: teleport logic will move player half the distance between the other two borders along the current border (in whichever direction puts him inside the playable area) and rotate their view (yaw).

This would make it possible to make the playable area similar to a "sphere" if one diretion has borders that are "poles" and the other one wraps around.
It would also create an interesting geometry if both directions have "poles".

example:

config:
x wraps, z is poles, 2 block margin
X: -180, +180
Z: -90, +90
(mimicking degrees of latitue and longitude on a sphere)

event:
player goes north (-z) and crosses border at (-30, -90) while looking NE (old_yaw = -140), which is a "pole" border.

effect:
player is teleported to (+150, -88) and is looking SE (new_yaw = -40).
(If you go straight to the north pole, you are not teleported to the southpole but you will be walking south on the opposite meridian without having turned around)

pseudocode:

move math for poles in z direction (North-Pole and South-Pole) when crossing +z border:
new_pos.x = modulo( (old_pos.x - minX) + (maxX-minX)/2 , maxX-minX ) + minX ;
new_pos.z = old_pos.z - distanceTeleportedBack ;

move math for poles in x direction ("East-Pole" and "West-Pole") when crossing +x border:
new_pos.x = old_pos.x - distanceTeleportedBack ;
new_pos.z = modulo( (old_pos.z - minZ) + (maxZ-minZ)/2 , maxZ-minZ ) + minZ ;

rotation math for poles in x direction:
new_yaw = - old_yaw

rotation math for poles in z direction:
new_yaw = modulo( - old_yaw , 2 * pi) - pi ;

PS

additional features I would like to request but are (I believe) already requested:
-bigger size limit, preferrably all the way to 30M
-the ability to choose different teleportation logic for each direction of every dimension, including modded dimensions.