mirror of
https://github.com/minetest-mods/i3.git
synced 2025-07-02 08:30:21 +02:00
API Cleanup
This commit is contained in:
32
API.md
32
API.md
@ -55,9 +55,9 @@ Sets the current tab by name. `player` is an `ObjectRef` to the user.
|
||||
|
||||
Overrides a tab by name. `def` is the tab definition like seen in `i3.set_tab`.
|
||||
|
||||
#### `i3.get_tabs()`
|
||||
#### `i3.tabs`
|
||||
|
||||
Returns the list of registered tabs.
|
||||
A list of registered tabs.
|
||||
|
||||
---
|
||||
|
||||
@ -81,28 +81,28 @@ i3.register_craft_type("digging", {
|
||||
#### Registering a custom crafting recipe (examples)
|
||||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
i3.register_craft {
|
||||
type = "digging",
|
||||
result = "default:cobble 2",
|
||||
items = {"default:stone"},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
i3.register_craft {
|
||||
result = "default:cobble 16",
|
||||
items = {
|
||||
"default:stone, default:stone, default:stone",
|
||||
"default:stone, , default:stone",
|
||||
"default:stone, default:stone, default:stone",
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Recipes can be registered in a Minecraft-like way:
|
||||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
i3.register_craft {
|
||||
grid = {
|
||||
"X #",
|
||||
" ## ",
|
||||
@ -114,13 +114,13 @@ i3.register_craft({
|
||||
['X'] = "default:glass",
|
||||
},
|
||||
result = "default:mese 3",
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Multiples recipes can also be registered:
|
||||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
i3.register_craft {
|
||||
{
|
||||
result = "default:mese",
|
||||
items = {
|
||||
@ -138,15 +138,15 @@ i3.register_craft({
|
||||
"default:mese_crystal, default:mese_crystal",
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Recipes can be registered from a given URL containing a JSON file (HTTP support is required¹):
|
||||
|
||||
```Lua
|
||||
i3.register_craft({
|
||||
i3.register_craft {
|
||||
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
@ -182,10 +182,6 @@ end)
|
||||
|
||||
Removes all recipe filters and adds a new one.
|
||||
|
||||
#### `i3.remove_recipe_filter(name)`
|
||||
|
||||
Removes the recipe filter with the given `name`.
|
||||
|
||||
#### `i3.recipe_filters`
|
||||
|
||||
A map of recipe filters, indexed by name.
|
||||
@ -229,10 +225,6 @@ i3.add_search_filter("types", function(item, drawtypes)
|
||||
end)
|
||||
```
|
||||
|
||||
#### `i3.remove_search_filter(name)`
|
||||
|
||||
Removes the search filter with the given `name`.
|
||||
|
||||
#### `i3.search_filters`
|
||||
|
||||
A map of search filters, indexed by name.
|
||||
|
Reference in New Issue
Block a user