From c024d0b6c84dbbf3c6f9709db31b2a3661b064c5 Mon Sep 17 00:00:00 2001 From: Medley <198984680+maplemedley@users.noreply.github.com> Date: Mon, 6 Oct 2025 23:44:36 +0200 Subject: [PATCH] Add explanation and example of material usage (#54) --- doc/materials.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/materials.md b/doc/materials.md index 6eca5b3..77c75f9 100644 --- a/doc/materials.md +++ b/doc/materials.md @@ -1,3 +1,11 @@ # Materials API -consult `/src/materials/minetest.lua` at this time \ No newline at end of file +The materials can be accessed anywhere in your mod with `xcompat.materials.material_name`. + +**Example**: `xcompat.materials.steel_ingot` returns the string of whichever item would closest represent the steel_ingot material in the current game. + +Behind the scenes, the xcompat mod automatically changes the `xcompat.materials` variable to contain the correct materials for whichever game the mod is launched in. + +See the [the support table in the readme](https://github.com/mt-mods/xcompat/tree/master?tab=readme-ov-file#directly-supported-games-and-mods) for an overview of supported games, and see the contents of `/src/materials/` for the supported materials and their names. + +**Example**: the `/src/materials/mineclonia.lua` file shows what the keys of `xcompat.materials` resolve to when playing Mineclonia, such as `xcompat.materials.steel_ingot` resolving to `mcl_core:iron_ingot`, and `xcompat.materials.mesa_crystal` resolving to `mcl_redstone:redstone` if supported.