Waystones (Fabric Edition)

Waystones (Fabric Edition)

4M Downloads

[Feature] Player To Not Spawn on Top of Waystone

Yourname942 opened this issue ยท 2 comments

commented

Minecraft 1.16.4
Forge 35.1.37
Waystones 7.3.1

Please make it so players do not teleport directly on top of the waystone block.

Issue:
Players get teleported directly on top of the waystone. It is awkward, immersion breaking, and limiting (we have to build ceilings higher than what we want - otherwise the player suffocates)

Proposal:
Players teleport into a 3x3 area around the waystone (excluding the waystone's position):

[ ] [ ] [ ]
[ ] [X] [ ]
[ ] [ ] [ ]

Breakdown:
Each waystone has an acceptedTeleportPoints array which contains eight teleportPointObjects.
Each teleportPointObject (the eight surrounding blocks around the waystone) has four properties:

  1. x coordinate
  2. y coordinate
  3. z coordinate
  4. blocktype

Two examples of TeleportPoint objects:
{
x: -100
y: 56
z: 280
blocktype: minecraft:air
isValid: true
}

{
x: -101
y: 56
z: 281
blocktype: minecraft:stone
isValid: false
}

Example of waystone's acceptedTeleportPoints array: [{}, {}, {}, {}, {}, {}, {}, {}]

The TeleportPoint objects are updated/populated on waystone placement.

Function to select which point to teleport to with validation to prevent the player from sufficating in a wall:
// on player selecting a waystone to teleport to..
// if all 8 blocks' isValid values are false, then player cannot teleport there - mark the
waystone name in red, or make it unselectable, or tell the player that waystone is
unavailable or something.
// randomly select one of teleportPointObjects in the AcceptedTeleportPoints array
// if that object's isValid value is true..
// player will be teleported to that xyz coordinate
// else randomly select another teleportPointObject

Option For Better Performance:
Issue:
players can update blocks around the waystone after it has been placed (which means the objects in the AcceptedTeleportPoints array needs to be updated to match)

When/how often to update TeleportPoint objects?
To not have the block-validation-check run all the time, only update the array when the player tries to teleport to that waystone.

Note:
If you have a more concise/better coding solution, please feel free to do it your own way. I just wanted to share my thoughts and how I would probably go about doing this.

commented

Players already spawn in front of the Waystone. What facing do your waystones say they have when you look at them with F3?

commented

Closing since unable to reproduce and very similar to #234 in what would be the fix