Options
All
  • Public
  • Public/Protected
  • All
Menu

Core Engine API

Index

Type aliases

ItemInstanceArray

ItemInstanceArray: number[]

Array of theee elements representing item id, count and data respectively. Used in many old functions and when extra data is not required

jbyte

jbyte: number

Type used to mark Java bytes

Variables

Const BlockID

BlockID: {}

Object containing string custom block string ids as keys and their numeric ids as values

Type declaration

  • [key: string]: number

Const ItemID

ItemID: {}

Object containing string custom item string ids as keys and their numeric ids as values

Type declaration

  • [key: string]: number

__config__

__config__: Config

Main mod configuration manager, settings are stored in config.json file

__dir__

__dir__: string

Full path to the mod's directory, ends with "/"

__mod__

__mod__: Object

Java object of the mod, contains some useful values and methonds

__name__

__name__: string

Mod name

__packdir__

__packdir__: string

Full path to current Horizon pack directory

Functions

EXPORT

  • EXPORT(name: string, lib: any): void
  • Exports object from library using specified name

    Parameters

    • name: string

      object name to be used when calling IMPORT. If the name contains a column (":"), the number after column is used to specify version of the library this export corresponds to. To provide backward compatibility, library authors can use multiple exports for different library versions inside a single file. This mechanism currently works only for library dependencies

    • lib: any

      object to be exported with specified name, can be of any valid js/java type

    Returns void

EntityAIWatcher

  • EntityAIWatcher(customPrototype: any): any

EntityModel

  • EntityModel(parentModel: any): any

EntityModelWatcher

  • EntityModelWatcher(entity: number, model: any): any

GameObject

  • GameObject(name: any, Prototype: any): any

IMPORT

  • IMPORT(name: string, value?: string): void
  • Imports library dependency. Libraries should be stored in the *"libraryDir"* directory, specified in your build.config. You can either import the whole library or single function/value using value parameter

    Parameters

    • name: string

      library name specified in the library's EXPORT declaration

    • Optional value: string

      name of the function or value you wish to import, or "*" to import the whole library. Defaults to importing the whole library

    Returns void

IMPORT_NATIVE

  • IMPORT_NATIVE(name: string, target: object): any
  • Injects methods from C++ into the target object to use in the mod

    Parameters

    • name: string

      name of the module, as registered from native code

    • target: object

      target object, where all the methods from native module will be injected

    Returns any

ItemExtraData

  • ItemExtraData(): any

LIBRARY

  • LIBRARY(description: { api: string; dependencies: string[]; name: string; shared: boolean; version: number }): void
  • Library declaration, specifies all the information about library it is called from. Cannot be called from user code.

    Parameters

    • description: { api: string; dependencies: string[]; name: string; shared: boolean; version: number }

      object containing all the required information about the library

      • api: string

        API name, one of the "CoreEngine", "AdaptedScript" or "PrefsWinAPI" strings

      • dependencies: string[]

        List of names of libraries that should be loaded before the current library is loaded. Every entry should be either just a library name or library name and version separated by a column (":")

      • name: string

        Library name, used to avoid conflicts when several mods have the same library installed

      • shared: boolean

        If set to true, the context of the library is shared between mods to allow for better integration

      • version: number

        Library version, used to load the lates library version if different mods have different library version installed

    Returns void

WRAP_NATIVE

  • WRAP_NATIVE(name: string): object
  • Allows to create new JS modules imported from C++ code and use it in the mod

    Parameters

    • name: string

      name of the module, as registered from native code

    Returns object

    js module, implemented in native (C++) code

__debug_typecheck__

  • __debug_typecheck__(): void
  • Empty function used to verify Rhino functionality. Should not be called by hand

    Returns void

alert

  • alert(arg: string): any
  • Displays android.widget.Toast with specified message. If this function is called more then once, messages are stacked and displayed together

    Parameters

    • arg: string

    Returns any

getCoreAPILevel

  • getCoreAPILevel(): number

getMCPEVersion

  • getMCPEVersion(): { array: number[]; main: number; str: string }
  • Returns { array: number[]; main: number; str: string }

    minecraft version information in some readable form

    • array: number[]

      array containing three version numbers

    • main: number

      version number, calculated as array[0] * 17 + array[1]

    • str: string

      string version representation, three dot-separated numbers

importLib

  • importLib(name: string, value?: string): void

runCustomSource

  • runCustomSource(name: string, scope?: object): void
  • Runs custom source in the specified context by its name. Define custom sources using *"sourceType": "custom"* for the source in your build.config.

    Parameters

    • name: string

      path to the executable. Can be built the way built-in source types are built

    • Optional scope: object

      additional scope to be added to the current context

    Returns void

runOnMainThread

  • runOnMainThread(func: () => void): void
  • Runs specified funciton in the main thread

    Parameters

    • func: () => void

      function to be run in the main thread

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc