Skip to main content

Teleport To Spawn (Entity Action Type)

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. It falls back to the world spawn when the entity isn't a player, has no respawn point set, its respawn dimension isn't 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"
}

This 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 can't use portals: standing in one throws the player back to the world spawn.

note

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 isn't drained, because this is a move and not a respawn.