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
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
- That feature is obsolete
No longer supported.
Parameters
modName: string
func: any
Returns void
addTexturePack
- That feature is obsolete
No longer supported.
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
- That feature is obsolete
No longer supported.
Parameters
modName: string
Returns void
getModList
- That feature is obsolete
No longer supported.
Returns string[]
getModPEList
- That feature is obsolete
No longer supported.
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
- That feature is obsolete
No longer supported.
Parameters
modName: string
Returns void
registerAPI
Registers new API for the mod and invokes mod API callback.
More about capabilitiesSometimes it is useful to provide the ability to run third party code in your own mod, you can create a method that provides such possibility:
requireGlobal(command) {
return eval(command);
}Parameters
name: string
API name used to import it in the other mods
api: object
object that is shared with the other mods; may contain other objects, methods, variables, etc.
optionaldescr: { name?: string; props?: object }
simple documentation for the mod API
optionalname: string
Full name of the API, if not specified, name parameter value is used.
optionalprops: object
Object containing descriptions of methods and properties of the API, where keys are methods and properties names and values are their descriptions.
That feature is obsoleteWriting documentation that way is not recommended.
Returns void
requireAPI
Gets API by it's name. The best approach is to call this method in the function passed as the second parameter of ModAPI.addAPICallback.
Learn how to useImporting API registered by IndustrialCraft PE:
let ICore = null;
ModAPI.addAPICallback("ICore", function(api) {
ICore = api;
});When using ICore variable from the example, be sure to check it for
null
because Industrial Craft PE may not be installed on the user's phone.Parameters
name: string
API name from ModAPI.registerAPI call
Returns Nullable<object>
API object if an API with specified was previously registered,
null
otherwise.
requireAPIPropertyDoc
Fetches information about the method or property of mod API.
That feature is obsoleteWriting documentation that way is not recommended.
Parameters
name: string
API name from ModAPI.registerAPI call
prop: string
property or method name
Returns Nullable<string>
String description of the method or null if no description was provided by API vendor.
requireAPIdoc
- That feature is obsolete
Writing documentation that way is not recommended.
Parameters
name: string
API name from ModAPI.registerAPI call
Returns Nullable<ModDocumentation>
Documentation for the specified mod API.
requireGlobal
Executes string in Core Engine's global context. Can be used to get functions and objects directly from Adapted Script.
Parameters
name: string
string to be executed in Core Engine's global context
Returns any
null
if execution failed or appropriate variable same.
Module used to share mods' APIs.