Skip to main content

Change Selected Slot (Entity Action Type)

Changes which hotbar slot the player is holding.

Type ID: apoli:change_selected_slot

Fields

FieldTypeDefaultDescription
slotIntegerrequiredThe hotbar slot to select, from 0 on the far left to 8 on the far right. Values outside that range are clamped. With relative: true this is an offset instead.
relativeBooleanfalseAdds slot to the current selection and wraps around, so 1 cycles right and -1 cycles left.

It does nothing for entities that aren't players. The new selection is sent to the client straight away, so the hotbar highlight and the held item model update on the same tick.

Examples

{
    "type": "apoli:change_selected_slot",
    "slot": 0
}

This puts the player back on the first hotbar slot.

{
    "type": "apoli:change_selected_slot",
    "slot": 1,
    "relative": true
}

This cycles one slot to the right, wrapping from slot 8 back to slot 0.