Перейти к основному содержанию

LowLevelUtils

Specific methods, for the most part, are designed to work with Inner Core internals and debug various data.

@since

2.2.1b110

Index

Interfaces

ICustomErrorCallback

  • ICustomErrorCallback(message: string, error: Throwable, log: string, stacktrace: string): boolean
  • Parameters

    • message: string

      html-formatted message of error, what was happened

    • error: Throwable

      throwable, that was catched by logger

    • log: string

      html-formatted log of error

    • stacktrace: string

      html-formatted stacktrace of error

    Returns boolean

Type Aliases

ThreadTypeMarker

ThreadTypeMarker: CLIENT | SERVER | UNKNOWN

Marking for current thread, unknown thread are used by default if this thread is not indented to be server or client-side.

Functions

addRuntimePack

  • addRuntimePack(type: resource | behavior | behaviour, name: string): string
  • Creates an empty resource or behavior pack with a manifest to add content during mod loading. Please use names without special characters and only with ASCII characters.


    Parameters

    • type: resource | behavior | behaviour
    • name: string

      pack title to be used for folder and displayed in pack list; folder will receive "runtime_<name>" name and title in interface will be "runtime pack: <name>"

    Returns string

debugAPILookUp

  • debugAPILookUp(): void
  • Dumps AdaptedScript API hieracly to log with debug priority.


    Returns void

debugBmp

  • debugBmp(bitmap: Bitmap): void
  • Displays dialog with given bitmap image and title " bitmap <width>x<height>".


    Parameters

    • bitmap: Bitmap

    Returns void

debugStr

  • debugStr(message: string): void
  • Displays dialog with given message and without title.


    Parameters

    • message: string

    Returns void

evalInScope

  • evalInScope(code: string, scope: object, name: string): object
  • Executes any code in the script body of a given object, the object itself becomes a local list of variables for code execution.

    @since

    2.2.0b76


    Parameters

    • code: string

      text to evaluate in given scope

    • scope: object

      object in which context code is executed

    • name: string

      script name for errors, debugging, etc.

    Returns object

forceNativeCrash

  • forceNativeCrash(): void
  • Causes a native error, which immediately leads to the forced closure of the game.


    Returns void

getContext

  • getContext(): android.app.Activity

getCurrentThreadType

  • It can be used to make sure that an action is performed in intended thread, e.g. sending packet to clients on server.


    Returns ThreadTypeMarker

getInnerCoreVersion

  • getInnerCoreVersion(): string

  • Returns string

    "2.0.0.0"

getMinecraftVersion

  • getMinecraftVersion(): string

getNetwork

isDefaultPrevented

  • isDefaultPrevented(): boolean

isMainThreadStopped

  • isMainThreadStopped(): boolean
  • Gets status of server tick, e.g. is tick disabled due to error. After restarting the world/server, this state is reset.


    Returns boolean

runAsUi

  • runAsUi(func: () => void): void
  • Calls an action in the Android interface thread. Any unexpected errors here will lead to the closure of the game, please add try-catch blocks to prevent this.


    Parameters

    • func: () => void

      Returns void

    runOnClientThread

    • runOnClientThread(func: () => void): void

    runOnMainThread

    • runOnMainThread(func: () => void): void

    setCustomFatalErrorCallback

    • Instead of displaying fatal error type in dialog with a log, the specified function will be called to change this behavior.


      Parameters

      Returns void

    setCustomNonFatalErrorCallback

    • Instead of displaying non-fatal error type in dialog with a log, the specified function will be called to change this behavior.


      Parameters

      Returns void

    setCustomStartupErrorCallback

    • Instead of displaying startup error type in dialog with a log, the specified function will be called to change this behavior. For startup errors, only message and recent log are available, all other data will be passed as null.


      Parameters

      Returns void

    setLoadingTip

    • setLoadingTip(tip: string): void
    • Changes bottom label on mod loading screen, it is recommended to use it for debugging or visualization of long work during startup.


      Parameters

      • tip: string

      Returns void

    setNativeThreadPriority

    • setNativeThreadPriority(priority: number): void
    • @deprecated

      Parameters

      • priority: number

      Returns void

    simulateBackPressed

    • simulateBackPressed(): void

    throwException

    • throwException(message: string): void
    • @throws

      Java java.lang.RuntimeException with specified message.


      Parameters

      • message: string

      Returns void