Skip to content
‮(gorg) edited this page Jun 25, 2024 · 6 revisions

Items

Items are found in the args tags in blocks. The args tags follows the pattern

{
    items: Argument[]
}

Arguments follow the pattern

{
    item: Item,
    slot: number // the slot in the chest it's found in. This means the order of the array `items` is irrelevant.
}

Item

They all follow the pattern

{
    id:   "bl_tag" | "g_val" | "Bitem" | "Bloc" | "num" | "part" | "pot" | "snd" | "txt" | "comp" | "pn_el" | "var" | "vec" | "hint",
    data: any
}

Named: Numbers, Strings, Components, Parameters, and Variables

txt is for strings, an artifact of their previous use and names.
All these have the name value in common, which dictates what the value/name of the item is

{
    id: "num" | "txt" | "comp", // variable and param is different
    data: {
        name: string  // number doesn't use number since % codes can be used.
    }
}

Variable

Variables have an extra value in data to store the scope.

{
    id: "var",
    data: {
        name:  string,
        scope: "saved" | "unsaved" | "local" | "line" // unsaved is GAME
    }
}

Parameter

{
    id: "pn_el",
    data: {
        name: string, // Short for `pattern_element`. Parameters, each bullet in a actions Chest Parameters is a pattern internally.
        type: 'txt' | 'comp' | 'num' | 'loc' | 'vec' | 'snd' | 'part' | 'pot' | 'item' | 'any' | 'var' | 'list' | 'dict'.
        plural?: boolean, // You can't have plural `var` type params, or if has a default value.
        optional?: boolean // Ditto, I think.
        note?: string, // Next line after arrows
        description?: string, // Same line as the name with a dash behind it.
        default: Item, // See #item, must match the selected type, cannot be used on var, list, or dict yet (expression items?).       
    }
}

Location

{
    id: "loc",
    data: {
        isBlock: boolean; // When true pitch and yaw are hidden. This is included for legacy support in df (i forgor where dev said that)
        loc: {
            x:     number
            y:     number
            z:     number
            pitch: number
            yaw:   number
        }
    }
}

Vector

{
    id: 'vec',
    data: {
        x: number,
        y: number,
        z: number,
    }
}

Potion

{
    id: 'pot',
    data: {
        pot: string, // The full name of the potion shown in the lore
        dur: number, // Duration in ticks
        amp: number  // Amplifier, or strength. It's supposed to be limited from -255 to 255.
    }
}

Sound

{
    id: 'snd',
    data: {
        sound: string, // The full name of the sound shown in the lore
        pitch: number, // 0 to 2. I think Minecraft doesn't change the sound at 0.5 and below
        vol:  number   // Volume
    }
}

Game Value

{
    id: 'g_val',
    data: {
        type:   string,
        target: "Selection" | "Default" | "Victim" | "Killer" | "Damager" | "Shooter" | "Projectile" | "LastEntity"
        // doesn't matter on Plot or Event values, and is hidden.
    }
}

Particle

Every tag name with ? after is optional.
Each particle type has different options shown in data.data

{
    id: 'part',
    data: {
        particle: string, // The name of the particle as seen in the lore. (I think)
        cluster: {
            amount:     number;
            horizontal: number;
            vertical:   number;
        }
        data: {
            motionVariation?: number,
            x?:               number,
            y?:               number,
            z?:               number,
            colorVariation?:  number,
            rgb?:             number, // Hex is base 16. Converting it to base 10 gets what you need here. Some goes other way round
            sizeVariation?:   number,
            size?:            number,
            material?:        string
        }
    }
}

Items

{
    id: 'item',
    data: {
        item: string // The nbt data turned into a string. NBT isn't json.
    }
}

Block Tags

Block tags are the option in the bottom right of a chest, going to the left.

{
    id: 'bl_tag',
    data: {
        option: string, // The name of the selected option.
        tag:    string, // The name of the tag.
        action: string, // The action (or subAction) on the block.
        block:  "call_func" | "control" | "else" | "entity_action" | "entity_event" | "event" | "func" | "game_action" | "if_entity" | "if_game" | "if_player" | "if_var" | "player_action" | "process" | "repeat" | "select_obj" | "set_var" | "start_process"
        variable?: Variable // Variable tags.
    }
}

Hints

{
    id: 'hint',
    data: {
        id: 'function' // You can select something else, it'll show an error.
    }
}