ModAPI
Index
Interfaces
ModDocumentation
Objects used to represent mod API documentation.
name
Full name of the API.
props
Object containing descriptions of methods and properties of the API, where keys are methods and properties names and values are their descriptions.
Variables
constmodAPIsinternal
Collects registered APIs objects, use ModAPI.requireAPI to directly access required instance.
Type declaration
[name string]: { api: string; descr: ModDocumentation }
Functions
addAPICallback
Adds callback for the specified mod API.
Parameters
apiName: string
API name from ModAPI.registerAPI call
func: (api: object) => void
callback that is called when API is loaded
Returns void
addModCallback
Parameters
modName: string
func: any
Returns void
addTexturePack
Parameters
path: any
Returns void
cloneAPI
Recursively copies (duplicates) the value to the new one.
Type parameters
- T
Parameters
api: T
an object to be copied
optionalrecursive: boolean
if
true
, copies the object recursively
Returns T
A copy of the object.
cloneObject
Recursively clones object to the new one counting call depth and interrupting copying after 7th recursion call.
Type parameters
- T: object
Parameters
source: T
an object to be cloned
optionalrecursive: boolean
if
true
, copies the object recursivelyoptionaldepth: number
current recursion state, if > 6, recursion stops; default value is 0
Returns T
Cloned object, all the properties that are less then 8 in depth, get copied.
debugCloneObject
Same as ModAPI.cloneObject, but if call depth is more then 6, inserts
"stackoverflow"
string value otherwise.Type parameters
- T
Parameters
source: T
optionalrecursive: boolean
optionaldepth: number
Returns T | string
getModByName
Parameters
modName: string
Returns void
getModList
Returns string[]
getModPEList
Returns string[]
inheritPrototypes
Ensures target object has all the properties the source object has, if not, copies them from source to target object.
Type parameters
- K: object
- T: object
Parameters
source: K
object to copy missing values from
target: T
object to copy missing values to
Returns K & T
isModLoaded
Parameters
modName: string
Returns void
registerAPI
Registers new API for the mod and invokes mod API callback.
Module used to share mods' APIs.