Skip to main content

Action On Wake Up (Power Type)

Runs an entity action, a block action or both when the player wakes up after sleeping.

Type ID: apoli:action_on_wake_up

Fields

FieldTypeDefaultDescription
entity_actionEntity Action TypeoptionalIf set, this action runs on the player when they wake up.
block_actionBlock Action TypeoptionalIf set, this action runs on the bed block.
block_conditionBlock Condition TypeoptionalIf set, the actions only run when the bed block passes this condition.
require_full_sleepBooleantrueOnly run when the sleep finished, meaning the night or the storm passed and the game woke the player. With false, the actions also run when the player climbs out of bed early, is teleported away or has the bed broken under them.
note

The power fires as the player leaves the bed, while the bed's position is still known, so block_condition can test the bed they slept in. It runs on the server only.

Examples

{
    "type": "apoli:action_on_wake_up",
    "entity_action": {
        "type": "apoli:and",
        "actions": [
            {
                "type": "apoli:execute_command",
                "command": "title @s actionbar {\"translate\": \"You feel %1$s but %2$s\", \"color\": \"yellow\", \"with\": [{\"text\": \"rejuvenated\", \"color\": \"green\"}, {\"text\": \"hungry...\", \"color\": \"red\"}]}"
            },
            {
                "type": "apoli:apply_effect",
                "effects": [
                    {
                        "effect": "minecraft:regeneration",
                        "duration": 100,
                        "amplifier": 1,
                        "is_ambient": true,
                        "show_particles": true,
                        "show_icon": true
                    },
                    {
                        "effect": "minecraft:hunger",
                        "duration": 100,
                        "amplifier": 2,
                        "is_ambient": true,
                        "show_particles": true,
                        "show_icon": true
                    }
                ]
            }
        ]
    },
    "block_condition": {
        "type": "apoli:block",
        "block": "minecraft:red_bed"
    }
}

When the player wakes up after sleeping in a red bed, this gives them Regeneration II and Hunger III for 5 seconds and shows "You feel rejuvenated but hungry..." in the action bar.