Teleport To Spawn (Entity Action Type)

Teleports the entity to its respawn point, or to the world spawn.

Teleports the entity to its respawn point — the bed or respawn anchor it last used — or to the world spawn.

Type ID: apoli:teleport_to_spawn

Fields

FieldTypeDefaultDescription
player_spawnBooleantrueWhether to use the player’s own respawn point. Falls back to the world spawn when the entity is not a player, has no respawn point set, its respawn dimension is not loaded, or the respawn point no longer works. false always uses the world spawn.
success_actionEntity Action TypeoptionalRuns on the entity once it has arrived.
fail_actionEntity Action TypeoptionalRuns on the entity when the teleport is refused, which for this action means apoli:prevent_teleport.

Examples

"entity_action": {
    "type": "apoli:teleport_to_spawn"
}

Sends the player home the way a bed would.

{
    "type": "apoli:action_over_time",
    "interval": 20,
    "condition": {
        "type": "apoli:in_block",
        "block_condition": { "type": "apoli:in_tag", "tag": "minecraft:portals" }
    },
    "entity_action": {
        "type": "apoli:teleport_to_spawn",
        "player_spawn": false
    }
}

An origin that cannot use portals: standing in one throws them back to the world spawn.

The respawn point is checked the same way dying checks it: the bed or respawn anchor has to still be there, be usable in that dimension, and have room to stand. If it was broken, buried or blocked, the action goes to the world spawn instead of dropping the player into the obstruction. A respawn anchor is not drained — this is a move, not a respawn.