2 API
Mikita Wiśniewski edited this page 2023-04-16 01:21:36 +00:00

This mod adds and utilizes many functions (which form mod's API), and some of them can be used to expand its content.

Useful links if you're getting started with MT modding:

Plus some MCL-specific stuff:

  • MineClone's API (good as a starting point; references many API functions that you may want to use)

Chairs and tables

function mcl_decor.register_chair_and_table(name, desc, desc2, material, tiles, group)

This function registers both chair and a table at once using params provided. Quite useful if your mod adds new type(s) of wood and you want to support mine.

Parameters:

  • name: name of the wood type, which will be included in the node name as mcl_decor:name_chair

    Example: "larch"

  • desc: description (visible name) for the chair. Hint: Append S before it and put it into parentheses to make it translatable

    Example: S("Larch Chair")

  • desc2: description (visible name) for the table. Hint: Append S before it and put it into parentheses to make it translatable

    Example: S("Larch Table")

  • material: name (including modname) of node which should be used as main material to craft registered chairs and tables

    Example: "mcl_larch:larchwood"

  • tiles: texture which will be used for registered chairs and tables

    Example: "mcl_larch_larchwood.png"

  • group: luatable of groups, which applies only if specified (if not, there's a fallback luatable which pretty much suits ANY wood out there). you can ignore that param unless your type of wood is slippery, bouncy or fire-resistant. About MCL groups

Full usage example:

  • mcl_decor.register_chair_and_table("larch", S("Larch Chair"), S("Larch Table"), "mcl_larch:larchwood", "mcl_larch_larchwood.png")

[See definiton] [See usage]

function mcl_decor.register_slab_table(name, desc, material, tiles, group)

This function registers a slab table.

Parameters:

  • name: name of the wood type, which will be included in the node name as mcl_decor:name_stable

    Example: "larch"

  • desc: description (visible name) for the slab table. Hint: Append S before it and put it into parentheses to make it translatable

    Example: S("Larch Slab Table")

  • material: name (including modname) of node which should be used as main material to craft the slab table

    Example: "mcl_larch:larchwood"

  • tiles: texture which will be used for the slab table

    Example: "mcl_larch_larchwood.png"

  • group: luatable of groups, which applies only if specified (if not, there's a fallback luatable which pretty much suits ANY wood out there). you can ignore that param unless your type of wood is slippery, bouncy or fire-resistant. About MCL groups

Full usage example:

  • mcl_decor.register_slab_table("larch", S("Larch Slab Table"), "mcl_larch:larchwood", "mcl_larch_larchwood.png")

[See definiton] [See usage]

Hedges

function mcl_decor.register_hedge(name, desc, material, tiles)

This function registers a hedge.

Parameters:

  • name: name of the wood type, which will be included in the node name as mcl_fences:name_hedge

    Example: "larch"

  • desc: description (visible name) for the hedge. Hint: Append S before it and put it into parentheses to make it translatable

    Example: S("Larch Hedge")

  • material: name (including modname) of node which should be used as main material to craft the hedge

    Example: "mcl_larch:larchleaves"

  • tiles: texture which will be used for the hedge

    Example: "mcl_larch_larchleaves.png"

Full usage example:

  • mcl_decor.register_hedge("larch", S("Larch Hedge"), "mcl_larch:larchleaves", "mcl_larch_larchleaves.png")

[See definiton] [See usage]

Paths

function mcl_decor.register_path(name, desc, material, tiles, sgroup, sounds)

This function registers a path. Quite useful if your mod adds new type(s) of stone and you want to support mine.

Parameters:

  • name: name of the wood type, which will be included in the node name as mcl_decor:name_path

    Example: "slate"

  • desc: description (visible name) for the path. Hint: Append S before it and put it into parentheses to make it translatable

    Example: S("Slate Path")

  • material: name (including modname) of node which should be used as main material to craft the path

    Example: "mcl_slate:slate"

  • tiles: texture which will be used for the path

    Example: "mcl_slate_slate.png"

  • sgroup: group which will be applied to the path alongside predefined ones. based on the material: use "pickaxey" if it is pickaxey and "shovely" if it is shovely. About MCL groups

    Example: "pickaxey"

  • sounds: sound that will play when interacting with the path

    Example: mcl_sounds.node_sound_stone_defaults()

Full usage example:

  • mcl_decor.register_path(
        "slate",
        S("Slate Path"),
        "mcl_slate:slate",
        "mcl_slate_slate.png",
        "pickaxey",
        mcl_sounds.node_sound_stone_defaults()
    )
    

[See definiton] [See usage]