paths - Uberi/MineTest-API GitHub Wiki

Minetest API

Paths

Startup

Mods are loaded during server startup from the mod load paths by running the init.lua scripts in a shared environment.

Mod load path

Mods are loaded from the following folders:

[path_share]/games/[gameid]/mods/
[path_share]/mods/[gameid]/
[path_user]/games/[gameid]/mods/
[path_user]/mods/[gameid]/ <-- User-installed mods
[worldpath]/worldmods/
  • [path_share] - used for run-in-place installations (windows default).
  • [path_user] - used for system-wide installations (linux default).
  • [worldpath] -will be [path_share]/worlds or [path_user]/worlds depending on your installation.

Eg: run-in-place installation (windows default):

minetest-0.4.x/games/[gameid]/mods/
minetest-0.4.x/mods/[gameid]/ <-- User-installed mods
minetest-0.4.x/worlds/[worldname]/worldmods/

Eg: system-wide installation (linux default):

/usr/share/minetest/games/[gameid]/mods/
~/.minetest/mods/[gameid]/ <-- User-installed mods
~/.minetest/worlds/[worldname]/worldmods/
  • [gameid] is the game mode you are applying mods to. By default this is minetest_game.
  • [worldname] is the name of the world you created.

Mod load path for world-specific games

It is possible to include a game in a world; in this case, no mods or games are loaded or checked from anywhere else.

This is useful for eg. adventure worlds.

This happens if the following directory exists:

[worldname]/game/

Mods should be then be placed in:

[worldname]/game/mods/

Modpack support

Mods can be put in a subdirectory, if the parent directory, which otherwise should be a mod, contains a file named modpack.txt. This file shall be empty, except for lines starting with #, which are comments.

Mod directory structure

mods
|-- modname
|   |-- depends.txt
|   |-- init.lua
|   |-- textures
|   |   |-- modname_stuff.png
|   |   `-- modname_something_else.png
|   |-- sounds
|   |-- media
|   `-- your_custom_data
`-- another

Modpack directory structure

mods
|-- modpackname
|   |-- modpack.txt
|   |-- modname
|   |   |-- depends.txt
|   |   |-- init.lua
|   |   |-- textures
|   |   |   |-- modname_stuff.png
|   |   |   `-- modname_something_else.png
|   |   |-- sounds
|   |   |-- media
|   |   `-- your_custom_data
|   `-- another
`-- another
  • modname The location of this directory can be fetched by using [minetest.get_modpath](minetest.get_modpath)(modname)

  • depends.txt List of mods that have to be loaded before loading this mod. A single line contains a single modname.

  • modpack.txt If this file is present then init.lua will be loaded from each subfolder

  • init.lua The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the registered callbacks.

  • textures, sounds, media Media files (textures, sounds, whatever) that will be transferred to the client and will be available for use by the mod.

    • your_custom_data
      You can create any additional folders that you wish. These can be used to store scripts that are included into your main script, or data your script depends on.

Afterword

Minetest Links

Lua Links

We're Social

Chat with us

There are developers, modders, themers, server admins and players on IRC at freenode on the channel #minetest (chatlogs)

Webchat