Skip to content

definition_schemas

Trplnr edited this page Jun 15, 2026 · 11 revisions

Definition Schemas

This article describes the schemas for making a slideshow.

All schemas here will use TypeScript as the pseudocode language.


Identifier

A string that follows https://minecraft.wiki/w/Identifier#Legal_characters

Schema

// https://minecraft.wiki/w/Identifier#Legal_characters
type Identifier = string

Example

"namespace:path"
"my.project:path/to/thing"

Slideshow

A list of pages.

Schema

/** Identifier pointing to pages. */
type Slideshow = Identifier[];

Example

[
    "trplnr:summit_slideshow/intro",
    "trplnr:summit_slideshow/what_is_reef",
    "trplnr:summit_slideshow/outro",
    "trplnr:summit_slideshow/credits"
]

Page

A single page that contains elements and other metadata.

Schema

type Page = {
    /** 
     * List of commands to run depending on the event. 
     * Runs as and at the screen. 
     */
    commands?: {
        /** Commands to run when the page data loads. */
        on_load: string[];
        /** Commands to run after all the elements have been placed. */
        on_enter: string[];
        /** Commands to run when another page is about the overwrite the current loaded page data. */
        on_unload: string[];
    };

    /** Transition to play when transitioning to this page. */
    transition?: Identifier;

    /** A list of element groups to display sequentially when reef:api/screen/next is ran. */
    sequence: Element[][];
}

Example

{
    "commands": {
        "on_enter": [
            "summon cat ~ ~ ~ {Tags:['my.cat']}",
            "playsound minecraft:entity.cat.ambient master @a ~ ~ ~ 2 1 2"
        ],
        "on_unload": [
            "tp @n[type=cat, tag=my.cat] ~ ~-500 ~",
            "kill @n[type=cat, tag=my.cat"
        ]
    },
    "transition": "trplnr:color_wipe",
    "sequence": [
        [{
            "type": "graphic",
            ...
        }],
        [
            {
                "type": "text",
                ...
            },
            {
                "type": "animated_element",
                ...
            }
        ]
    ]
}

Element

The main building block of pages.

Schema

/** Can either be a graphic element, a text element, or an animated graphic element based on the `type` field. */
type Element = GraphicElement | TextElement | AnimatedGraphicElement;

interface ElementBase {
    /** 
     * List of commands to run depending on the event. 
     * Runs as and at the element.
     */
    commands?: {
        /** Commands to run when the element spawns. */
        on_enter: string[];
        /** Commands to run when the element is about to be removed. */
        on_exit: string[];
    };

    /** Entity position of the element */
    pos?: Vector3;

    /** Decomposed transformation form (See https://minecraft.wiki/w/Display#Entity_data "Tags common to all display entities"). */
    translation?: Transformation.translation;
    scale?: Transformation.scale;
    left_rotation?: Transformation.left_rotation;
    right_rotation?: Transformation.right_rotation;

    /** 
     * Optional map of additional (non-default) data components (See https://minecraft.wiki/w/Data_component_format). 
     * ⚠ It is not advised to change the `minecraft:item_model` and the `minecraft:custom_model_data` component unless you know what you are doing!
     */
    components?: ItemStack.components; 
}

interface GraphicElement extends ElementBase {
    /** An element that displays a static or animated texture */
    type: "graphic";

    /** Identifier pointing to an items model definition (See https://minecraft.wiki/w/Items_model_definition). */
    model: Identifier;
}

interface TextElement extends ElementBase {
    /** An element that displays a text component */
    type: "text";

    /** See https://minecraft.wiki/w/Display#Text_Displays */
    text: TextComponent;
    background?: int;
    alignment?: "left" | "center" | "right";
    line_width?: int;
}

interface AnimatedGraphicElement extends ElementBase {
    /** An element that displays an animated texture and holds the last frame. */
    type: "animated_graphic";

    /** Identifier pointing to an items model definition (See https://minecraft.wiki/w/Items_model_definition). */
    model: Identifier;

    /** Frame count of the animated texture. */
    frames: int;
}

Examples

{
    "type": "graphic",
    "model": "trplnr:my_slideshow/background_image",
    "pos": [5, 5, 5],
    "scale": [2, 1, 2]
}
{
    "type": "text",
    "text": ["", {"text": "Welcome to my very cool presentation!"}, "\n", {"player": "Trplnr"}],
    "background": 65280,
    "alignment": "left",
    "line_width": 500,
    "pos": [10, 5, 10]
}
{
    "type": "animated_graphic",
    "model": "trplnr:my_slideshow/walking_moose",
    "frames": 35
}
{
    "type": "graphic",
    "model": "trplnr:my_evil_slideshow/haha_die_everyone_image",
    "commands": {
        "on_enter": ["tellraw @a 'You all are about to die when I move to the next page >:D'"],
        "on_exit": ["kill @a"]
    },
}

Transition

A transition.

Schema

type Transition = {
    /** Frame count of the animated texture. */
    frames: int

    /** The frame point of the transition where the screen switches pages. */
    switch_frame: int

    /** Identifier pointing to an items model definition (See https://minecraft.wiki/w/Items_model_definition). */
    model: Identifier
}

Example

{
    "frames": 20,
    "switch_frame": 5,
    "model": "trplnr:my_transition"
}

ReefMini

A Reef Mini definition.

Schema

type ReefMini = {
    /** Transition to play when transitioning to this page. */
    transition?: Identifier;

    /** Identifier pointing to an items model definition with a custom model data range dispatch (See https://minecraft.wiki/w/Items_model_definition). */
    model: Identifier;

    page_count: int;
}

Example

{
    "transition": "trplnr:color_wipe",
    "model": "trplnr:my_mini_slideshow",
    "page_count": 10
}

Clone this wiki locally