Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseMod

Hierarchy

Implements

Index

Constructors

constructor

  • new BaseMod(index: number): BaseMod
  • Parameters

    • index: number

    Returns BaseMod

Properties

Readonly event

event: IEventEmitter<this, IModEvents> = new EventEmitter<this, E>(this)

Methods

getIndex

  • getIndex(): number
  • Returns number

getLog

  • getLog(): Log
  • Returns Log

getName

  • getName(): string
  • Returns the name of this mod.

    Returns string

getPath

  • getPath(): string
  • Returns string

getPrefix

  • getPrefix(): string
  • Returns the prefix for this mod used in registrations. Example: A mod named Debug Tools would be ModDebugTools

    Returns string

getRegistryName

  • getRegistryName(name: string): string
  • Returns the full registry name for the given registration name, concatenating the mod registration prefix. Example: A mod named Debug Tools registering Cool Thingy would be ModDebugToolsCoolThingy

    Parameters

    • name: string

    Returns string

initializeGlobalData

  • initializeGlobalData(data: any): any
  • Called when the global data for this mod is retrieved from a field decorated with @Mod.globalData.

    Parameters

    • data: any

      Any existing data, or undefined

    Returns any

    The data that should be returned. Conventionally, this is an object of some kind. It must be JSON serializable.

    This method is meant to be overridden. It is called internally.

initializeSaveData

  • initializeSaveData(data: any): any
  • Called when the save data for this mod is retrieved from a field decorated with @Mod.saveData.

    Parameters

    • data: any

      Any existing data, or undefined

    Returns any

    The data that should be returned. Conventionally, this is an object of some kind. It must be JSON serializable.

    This method is meant to be overridden. It is called internally.

loadFile

  • loadFile(file: string, callback: (fileText: string, success: boolean) => void): boolean
  • Parameters

    • file: string
    • callback: (fileText: string, success: boolean) => void
        • (fileText: string, success: boolean): void
        • Parameters

          • fileText: string
          • success: boolean

          Returns void

    Returns boolean

Protected registerEventHandlers

  • registerEventHandlers(...untilEvents: Array<keyof Events<this>>): void
  • Registers event handlers, injections, and bind handlers. This is called on the preLoad event by default, and the handlers are deregistered on the unload event.

    If you call this manually before preLoad, it won't be called on preLoad and it won't deregister on unload.

    Please note that registering handlers when the mod is initialized means that the handlers will remain registered even when the user is playing on a server that doesn't support the mod.

    Parameters

    • Rest ...untilEvents: Array<keyof Events<this>>

    Returns void

Generated using TypeDoc