add keygen documentation

This commit is contained in:
ZXMushroom63 2024-12-01 19:03:10 +08:00
parent 59a2e8f08d
commit 647d1060e2
2 changed files with 14 additions and 3 deletions

View File

@ -65,13 +65,16 @@ The global object has the following properties:
- Once the dedicated server worker has started, it is unuseable.
- More: [DedicatedServerDocumentation](dedicatedserver.md)
- `ModAPI.meta`
- This object is used to register metadata for mods such as their title, credits, icon and description.
- This module is used to register metadata for mods such as their title, credits, icon and description.
- More: [MetaDocumentation](meta.md)
- `ModAPI.array`
- This object is used to interact and create arrays easily.
- This module is used to interact and create arrays easily.
- More: [ArrayDocumentation](array.md)
- `ModAPI.keygen`
- This module is used to get IDs for registering blocks and items without hardcoding an ID.
- More: [KeygenDocumentation](keygen.md)
- `ModAPI.resolution`
- This object is used to query information about GUI dimensions, to make drawing to the screen easier, generated when the `frame` event is fired.
- This module is used to query information about GUI dimensions, to make drawing to the screen easier, generated when the `frame` event is fired.
- Deprecated alias (please do not use): `ModAPI.ScaledResolution`
- More: [ArrayDocumentation](array.md)
- `ModAPI.version: String`

8
docs/apidoc/keygen.md Normal file
View File

@ -0,0 +1,8 @@
## ModAPI.keygen
ModAPI.keygen contains the API for getting item and block IDs from a string. It looks at the registries for items and blocks to derive the IDs, so IDs will not be automatically reserved until a block/item is actually registered. Ideally, you'd want to call a keygen method just before registering your block.
Methods:
- `ModAPI.keygen.item(itemId: String) : number`
- Example usage is: `var id = ModAPI.keygen.item("my_example_item");`
- `ModAPI.keygen.block(blockId: String) : number`
- Example usage is: `var id = ModAPI.keygen.block("my_example_block");`