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

Callback

Module used to handle callbacks. Investigate details about the callback mechanism and the list of pre-defined callbacks.

Index

Interfaces

BlockChangedFunction

  • Parameters

    • coords: Vector

      coordinates where block change occurred

    • oldBlock: Tile

      the block that is being replaced

    • newBlock: Tile

      replacement block

    • region: BlockSource

    Returns void

BreakBlockFunction

  • Parameters

    • region: BlockSource
    • coords: ItemUseCoordinates

      coordinates where the block is placed and side from where it is placed

    • block: Tile

      block that is placed

    • dropAllowed: boolean
    • playerUid: number

      player entity unique numeric ID

    • item: ItemInstance

      item that was in the player's hand when it breaked the block

    Returns void

BuildBlockFunction

  • Parameters

    • coords: ItemUseCoordinates

      coordinates where the block is placed and side from where it is placed

    • block: Tile

      block that is placed

    • playerUid: number

      player entity unique numeric ID

    Returns void

ConnectingToHostFunction

  • ConnectingToHostFunction(host: string, minecraftPort: number, moddedPort: number): void
  • Parameters

    • host: string
    • minecraftPort: number
    • moddedPort: number

    Returns void

ContainerClosedFunction

  • ContainerClosedFunction(container: Container, window: IWindow, byUser: boolean): void
  • Parameters

    • container: Container

      container that was closed

    • window: IWindow

      window that was loaded in the container

    • byUser: boolean

      if true, container was closed by user, from the code otherwise

    Returns void

ContainerOpenedFunction

  • Parameters

    • container: Container

      container that was opened

    • window: IWindow

      window that was loaded in the container

    Returns void

CoreConfiguredFunction

  • CoreConfiguredFunction(config: Config): void
  • Parameters

    • config: Config

      Inner Core default config instance

    Returns void

CraftRecipePreProvidedFunction

  • Parameters

    • recipe: WorkbenchRecipe

      object containing recipe information

    • field: WorkbenchField

      object containing crafting field information

    • playerUid: number

      player which caused craft, since 2.4.0b122

    Returns void

CraftRecipeProvidedFunction

  • Parameters

    • recipe: WorkbenchRecipe

      object containing recipe information

    • field: WorkbenchField

      object containing crafting field information

    • isPrevented: boolean

      if true, recipe was prevented by craft function

    • playerUid: number

      player which caused craft, since 2.4.0b122

    Returns void

CustomBlockTessellationFunction

  • Parameters

    • renderer: RenderAPI

      object used to manipulate block rendering process

    • coords: Vector

      rendering block coordinates

    • block: Tile

      block information

    Returns void

CustomDimensionTransferFunction

  • CustomDimensionTransferFunction(entityUid: number, from: number, to: number): void
  • Parameters

    • entityUid: number

      entity that was transferred between dimensions

    • from: number

      ID of the dimension the entity was transferred from

    • to: number

      ID of the dimension the entity was transferred to

    Returns void

CustomWindowFunction

  • CustomWindowFunction(window: IWindow): void
  • Parameters

    • window: IWindow

      window that was opened

    Returns void

DestroyBlockContinueFunction

  • Parameters

    • coords: ItemUseCoordinates

      coordinates where the block is destroyed and side from where it is destroyed

    • block: Tile

      block that is destroyed

    • progress: number

      current fraction of breaking progress

    Returns void

DestroyBlockFunction

  • Parameters

    • coords: ItemUseCoordinates

      coordinates where the block is destroyed and side from where it is destroyed

    • block: Tile

      block that is destroyed

    • playerUid: number

      player entity unique numeric ID

    Returns void

DimensionLoadedFunction

  • DimensionLoadedFunction(currentId: number, lastId: number): void
  • Parameters

    • currentId: number

      vanilla dimension ID, one of the EDimension values, or custom dimension ID

    • lastId: number

      previous unloaded dimension ID

    Returns void

DimensionUnloadedFunction

  • DimensionUnloadedFunction(dimensionId: number): void
  • Parameters

    • dimensionId: number

    Returns void

EntityDeathFunction

  • EntityDeathFunction(entityUid: number, attackerUid: number, damageType: number): void
  • Parameters

    • entityUid: number
    • attackerUid: number

      entity that caused damage, determines actor of damage source, -1 otherwise

    • damageType: number

      existing Entity.DamageSource or any inclusive value between 25 and 32

    Returns void

EntityFunction

  • EntityFunction(entityUid: number): void
  • Parameters

    • entityUid: number

      entity unique ID

    Returns void

EntityHurtFunction

  • EntityHurtFunction(attackerUid: number, entityUid: number, damageValue: number, damageType: number, armorReducesDamage: boolean): void
  • Parameters

    • attackerUid: number

      entity that caused damage, determines actor of damage source, -1 otherwise

    • entityUid: number
    • damageValue: number

      produced damage value in half-hearts

    • damageType: number

      existing Entity.DamageSource or any inclusive value between 25 and 32

    • armorReducesDamage: boolean

      if true, damage can be reduced by armor

    Returns void

EntityInteractFunction

  • EntityInteractFunction(entityUid: number, playerUid: number, coords: Vector): void
  • Parameters

    • entityUid: number

      entity unique ID

    • playerUid: number

      player entity unique ID

    • coords: Vector

      exact vector in which interaction happened

    Returns void

EntityPickUpDropFunction

  • EntityPickUpDropFunction(entityUid: number, dropEntityUid: number, item: ItemInstance, count: number): any
  • Parameters

    • entityUid: number

      entity that picked up the item (this callback is currently called only for players)

    • dropEntityUid: number

      dropped item's entity

    • item: ItemInstance

      ItemInstance of the drop entity

    • count: number

      which count of item stack

    Returns any

ExpAddFunction

  • ExpAddFunction(exp: number, playerUid: number): void
  • Parameters

    • exp: number

      amount of experience to be added

    • playerUid: number

      player's unique ID

    Returns void

ExpLevelAddFunction

  • ExpLevelAddFunction(level: number, playerUid: number): void
  • Parameters

    • level: number

      amount of levels to be added

    • playerUid: number

      player's uID

    Returns void

ExpOrbsSpawnedFunction

  • ExpOrbsSpawnedFunction(region: BlockSource, amount: number, coords: Vector, playerUid: number): void
  • Parameters

    • region: BlockSource
    • amount: number

      amount of experience to be added

    • coords: Vector

      dropped orbs entity coordinates

    • playerUid: number

      player entity unique numeric ID

    Returns void

ExplosionFunction

  • Parameters

    Returns void

ExplosionParams

ExplosionParams:

entity

entity: number

If explosion is produced by an entity, entity unique ID, -1 otherwise.

onFire

onFire: boolean

If true, explosion produced the fire.

power

power: number

Explosion power.

someBool

someBool: boolean

Should explosion break blocks or not.

someFloat

someFloat: number

Max block resistance.

FoodEatenFunction

  • FoodEatenFunction(food: number, ratio: number, playerUid: number): void
  • You can use Entity.getCarriedItem to get info about food item.


    Parameters

    • food: number

      food amount produced by eaten food

    • ratio: number

      saturation ratio produced by food

    • playerUid: number

      player entity UID

    Returns void

GenerateChunkFunction

  • GenerateChunkFunction(chunkX: number, chunkZ: number, random: Random, dimensionId: number, chunkSeed: number, worldSeed: number, dimensionSeed: number): void
  • Parameters

    • chunkX: number

      chunk X coordinate; multiply by 16 to receive corner block coordinates

    • chunkZ: number

      chunk Z coordinate; multiply by 16 to receive corner block coordinates

    • random: Random

      random object that should be used for generation process; already seeded by appropriate values

    • dimensionId: number

      current dimension's numeric ID

    • chunkSeed: number

      chunk-specific seed to use in chunk random generation

    • worldSeed: number

      world-specific seed to use in chunk generation

    • dimensionSeed: number

      dimension-specific seed to use in chunk generation

    Returns void

GenerateCustomDimensionChunkFunction

  • GenerateCustomDimensionChunkFunction(chunkX: number, chunkZ: number, random: Random, dimensionId: number): void
  • Parameters

    • chunkX: number

      chunk X coordinate; multiply by 16 to receive corner block coordinates

    • chunkZ: number

      chunk Z coordinate; multiply by 16 to receive corner block coordinates

    • random: Random

      random object that should be used for generation process; already seeded by appropriate values

    • dimensionId: number

      current dimension's numeric ID

    Returns void

ItemDispensedFunction

  • Parameters

    • coords: ItemUseCoordinates

      full coords object, where the main coords are the position of the dispenser block, relative ones are the position of the block to which the dispenser is pointed, and vec are the coords for the item to be dropped at

    • item: ItemInstance

      item that was dispensed

    • region: BlockSource

      BlockSource object

    • slot: number

      numeric ID of the slot from which the item was dispensed

    Returns void

ItemIconOverrideFunction


  • Parameters

    • item: ItemInstance

      information about item that is used in override function

    • isModUi: boolean

      whether icon override is working in mod ui or in vanilla one

    Returns void | TextureData

    Nothing if used in callback, Item.TextureData if used in item override function to return texture that will be used for the item.

ItemNameOverrideFunction

  • ItemNameOverrideFunction(item: ItemInstance, translation: string, name: string): string | void

  • Parameters

    • item: ItemInstance

      information about item that is used in override function

    • translation: string

      translated item name

    • name: string

      original item name

    Returns string | void

    Nothing if used in callback, string if used in item override function to return new name that will be displayed.

ItemUseCoordinates

ItemUseCoordinates:

Object used in some callbacks for coordinate set with side information and relative coordinates set.

relative

relative: Vector

Relative coordinates, coordinates of the block to the specified side of current block.

side

side: number

Side of the block, one of the EBlockSide constants.

optionalvec

vec?: Vector

Exact touch point, absolute point coordinates. Used only in "ItemUse" callback.

x

x: number

y

y: number

z

z: number

ItemUseFunction

  • Parameters

    • coords: ItemUseCoordinates

      set of all coordinate values that can be useful to write custom use logics

    • item: ItemInstance

      item that was in the player's hand when it touched the block

    • block: Tile

      block that was touched

    • playerUid: number

      player entity UID

    Returns void

ItemUseNoTargetFunction

  • ItemUseNoTargetFunction(item: ItemInstance, playerUid: number): void
  • Parameters

    • item: ItemInstance

      item that was in the player's hand when the event occurred

    • playerUid: number

    Returns void

ItemUsingCompleteFunction

  • ItemUsingCompleteFunction(item: ItemInstance, playerUid: number): void
  • Parameters

    • item: ItemInstance

      item that was in the player's hand when the event occurred

    • playerUid: number

    Returns void

ItemUsingReleasedFunction

  • ItemUsingReleasedFunction(item: ItemInstance, ticks: number, playerUid: number): void
  • Parameters

    • item: ItemInstance

      item that was in the player's hand when the event occurred

    • ticks: number

      amount of ticks left to the specified max use duration value

    • playerUid: number

    Returns void

LegacyItemUseFunction

  • Parameters

    • coords: ItemUseCoordinates

      set of all coordinate values that can be useful to write custom use logics, relative and vectorized one

    • item: ItemInstance

      item that was in the player's hand when it touched the block

    • block: Tile

      block that was touched

    • isExternal: boolean

      received from external player on server

    • playerUid: number

      player entity UID

    Returns void

LevelLoadedFunction

  • LevelLoadedFunction(isServer: boolean): void
  • Parameters

    • isServer: boolean

      server-side or remote level is loaded

    Returns void

LevelSelectedFunction

  • LevelSelectedFunction(worldName: string, worldDir: string): void
  • Parameters

    • worldName: string

      name of the selected world

    • worldDir: string

      name of the directory where the world is stored; worlds directories are located at games/horizon/packs/Inner_Core/worlds/

    Returns void

NativeCommandFunction

  • NativeCommandFunction(command: string): void
  • Parameters

    • command: string

      command that was entered or null if no command was providen

    Returns void

NativeGuiChangedFunction

  • NativeGuiChangedFunction(screenName: string, lastScreenName: string, isPushEvent: boolean): void
  • Parameters

    • screenName: string

      current screen name

    • lastScreenName: string

      previous screen name

    • isPushEvent: boolean

      if true, the new screen was pushed to the screen stack, popped from the stack otherwise

    Returns void

PlayerAttackFunction

  • PlayerAttackFunction(attackerUid: number, victimUid: number): void
  • Parameters

    • attackerUid: number

      player entity unique ID

    • victimUid: number

      attacked entity unique ID

    Returns void

PlayerChangedDimensionFunction

  • PlayerChangedDimensionFunction(playerUid: number, currentId: number, lastId: number): void
  • Parameters

    • playerUid: number

      player entity unique numeric ID

    • currentId: number

      vanilla dimension ID, one of the EDimension values, or custom dimension ID

    • lastId: number

      previous unloaded dimension ID

    Returns void

PlayerEatFunction

  • PlayerEatFunction(playerUid: number, food: number, ratio: number): void
  • You can use Entity.getCarriedItem to get info about food item.


    Parameters

    • playerUid: number

      player entity UID

    • food: number

      food amount produced by eaten food

    • ratio: number

      saturation ratio produced by food

    Returns void

PlayerFunction

  • PlayerFunction(playerUid: number): void
  • Parameters

    • playerUid: number

      unique ID of the player entity, that has been connected to server

    Returns void

PlayerTickFunction

  • PlayerTickFunction(playerUid: number, isDead: boolean): void
  • Parameters

    • playerUid: number

      player entity unique ID

    • isDead: boolean

      is following player dead

    Returns void

PopBlockResourcesFunction

  • PopBlockResourcesFunction(coords: Vector, block: Tile, explosionRadius: number, cause: number, region: BlockSource): void
  • Parameters

    • coords: Vector

      coordinates of the block that was broken

    • block: Tile

      information about the block that was broken

    • explosionRadius: number

      explosion power in case of exploding

    • cause: number

      cause information, supposed to always be zero

    • region: BlockSource

    Returns void

ProjectileHitFunction

  • Parameters

    • projectileUid: number

      projectile entity unique ID

    • item: ItemInstance

      projectile item

    • target: ProjectileHitTarget

      object containing hit coordinates and information about hit entity/block

    Returns void

ProjectileHitTarget

ProjectileHitTarget:

Object containing hit coordinates and information about hit entity/block.

coords

Coordinates and side of the hit block or null if an entity was hit.

entity

entity: number

If an entity was hit, entity unique ID, -1 otherwise.

x

x: number

Exact hit position x.

y

y: number

Exact hit position y.

z

z: number

Exact hit position z.

RedstoneSignalFunction

  • Parameters

    Returns void

RedstoneSignalParams

RedstoneSignalParams:

onLoad

onLoad: boolean

true if it is loading change.

power

power: number

Redstone signal power.

signal

signal: number

SavesFunction

  • SavesFunction(globalScope: object): void
  • Parameters

    • globalScope: object

    Returns void

SystemKeyEventDispatchedFunction

  • SystemKeyEventDispatchedFunction(code: number, state: number): void
  • Parameters

    • code: number

      key code of pressed button

    • state: number

      pressing state, such as down, etc.

    Returns void

TileEntityAddedFunction

TileEntityRemovedFunction

VanillaWorkbenchCraftFunction

  • VanillaWorkbenchCraftFunction(result: ItemInstance, workbenchContainer: Container, playerUid: number): void
  • Parameters

    • result: ItemInstance

      recipe result item

    • workbenchContainer: Container

      workbench container instance

    • playerUid: number

      player which caused craft

    Returns void

VanillaWorkbenchRecipeSelectedFunction

Functions

addCallback

  • addCallback(name: string, func: Function, priority?: number): void
  • addCallback(name: DimensionLoaded, func: DimensionLoadedFunction, priority?: number): void
  • addCallback(name: DimensionUnloaded, func: DimensionUnloadedFunction, priority?: number): void
  • addCallback(name: LocalPlayerChangedDimension, func: PlayerChangedDimensionFunction, priority?: number): void
  • addCallback(name: PlayerChangedDimension, func: PlayerChangedDimensionFunction, priority?: number): void
  • addCallback(name: CustomDimensionTransfer, func: CustomDimensionTransferFunction, priority?: number): void
  • addCallback(name: tick, func: () => void, priority?: number): void
  • addCallback(name: LocalTick, func: () => void, priority?: number): void
  • addCallback(name: LocalPlayerTick, func: PlayerTickFunction, priority?: number): void
  • addCallback(name: ServerPlayerTick, func: PlayerTickFunction, priority?: number): void
  • addCallback(name: ItemUse, func: LegacyItemUseFunction, priority?: number): void
  • addCallback(name: ItemUseLocalServer, func: LegacyItemUseFunction, priority?: number): void
  • addCallback(name: ItemUseServer, func: ItemUseFunction, priority?: number): void
  • addCallback(name: ItemUseLocal, func: ItemUseFunction, priority?: number): void
  • addCallback(name: ItemUseNoTarget, func: ItemUseNoTargetFunction, priority?: number): void
  • addCallback(name: ItemUsingReleased, func: ItemUsingReleasedFunction, priority?: number): void
  • addCallback(name: ItemUsingComplete, func: ItemUsingCompleteFunction, priority?: number): void
  • addCallback(name: ItemDispensed, func: ItemDispensedFunction, priority?: number): void
  • addCallback(name: ItemIconOverride, func: ItemIconOverrideFunction, priority?: number): void
  • addCallback(name: ItemNameOverride, func: ItemNameOverrideFunction, priority?: number): void
  • addCallback(name: DestroyBlock, func: DestroyBlockFunction, priority?: number): void
  • addCallback(name: DestroyBlockStart, func: DestroyBlockFunction, priority?: number): void
  • addCallback(name: DestroyBlockContinue, func: DestroyBlockContinueFunction, priority?: number): void
  • addCallback(name: BuildBlock, func: BuildBlockFunction, priority?: number): void
  • addCallback(name: BlockChanged, func: BlockChangedFunction, priority?: number): void
  • addCallback(name: BreakBlock, func: BreakBlockFunction, priority?: number): void
  • addCallback(name: RedstoneSignal, func: RedstoneSignalFunction, priority?: number): void
  • addCallback(name: BlockEventEntityInside, func: EntityInsideFunction, priority?: number): void
  • addCallback(name: BlockEventEntityStepOn, func: EntityStepOnFunction, priority?: number): void
  • addCallback(name: BlockEventNeighbourChange, func: NeighbourChangeFunction, priority?: number): void
  • addCallback(name: PopBlockResources, func: PopBlockResourcesFunction, priority?: number): void
  • addCallback(name: Explosion, func: ExplosionFunction, priority?: number): void
  • addCallback(name: CustomBlockTessellation, func: CustomBlockTessellationFunction, priority?: number): void
  • addCallback(name: FoodEaten, func: FoodEatenFunction, priority?: number): void
  • addCallback(name: LocalPlayerEat, func: PlayerEatFunction, priority?: number): void
  • addCallback(name: ServerPlayerEat, func: PlayerEatFunction, priority?: number): void
  • addCallback(name: EntityAdded, func: EntityFunction, priority?: number): void
  • addCallback(name: EntityRemoved, func: EntityFunction, priority?: number): void
  • addCallback(name: EntityAddedLocal, func: EntityFunction, priority?: number): void
  • addCallback(name: EntityRemovedLocal, func: EntityFunction, priority?: number): void
  • addCallback(name: PlayerAttack, func: PlayerAttackFunction, priority?: number): void
  • addCallback(name: EntityHurt, func: EntityHurtFunction, priority?: number): void
  • addCallback(name: EntityDeath, func: EntityDeathFunction, priority?: number): void
  • addCallback(name: EntityInteract, func: EntityInteractFunction, priority?: number): void
  • addCallback(name: EntityPickUpDrop, func: EntityPickUpDropFunction, priority?: number): void
  • addCallback(name: ExpAdd, func: ExpAddFunction, priority?: number): void
  • addCallback(name: ExpLevelAdd, func: ExpLevelAddFunction, priority?: number): void
  • addCallback(name: ExpOrbsSpawned, func: ExpOrbsSpawnedFunction, priority?: number): void
  • addCallback(name: ProjectileHit, func: ProjectileHitFunction, priority?: number): void
  • addCallback(name: ChunkLoadingStateChanged, func: ChunkStateChangedFunction, priority?: number): void
  • addCallback(name: LocalChunkLoadingStateChanged, func: ChunkStateChangedFunction, priority?: number): void
  • addCallback(name: GenerateChunk, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: GenerateChunkUnderground, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: GenerateNetherChunk, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: GenerateEndChunk, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: GenerateChunkUniversal, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: GenerateCustomDimensionChunk, func: GenerateCustomDimensionChunkFunction, priority?: number): void
  • addCallback(name: GenerateBiomeMap, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: PreProcessChunk, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: PostProcessChunk, func: GenerateChunkFunction, priority?: number): void
  • addCallback(name: EnchantPostAttack, func: DamageCallback, priority?: number): void
  • addCallback(name: EnchantGetProtectionBonus, func: ProtectionBonusProvider, priority?: number): void
  • addCallback(name: EnchantGetDamageBonus, func: AttackDamageBonusProvider, priority?: number): void
  • addCallback(name: EnchantPostHurt, func: DamageCallback, priority?: number): void
  • addCallback(name: NativeCommand, func: NativeCommandFunction, priority?: number): void
  • addCallback(name: CraftRecipePreProvided, func: CraftRecipePreProvidedFunction, priority?: number): void
  • addCallback(name: CraftRecipeProvidedFunction, func: CraftRecipeProvidedFunction, priority?: number): void
  • addCallback(name: VanillaWorkbenchCraft, func: VanillaWorkbenchCraftFunction, priority?: number): void
  • addCallback(name: VanillaWorkbenchPostCraft, func: VanillaWorkbenchCraftFunction, priority?: number): void
  • addCallback(name: VanillaWorkbenchRecipeSelected, func: VanillaWorkbenchRecipeSelectedFunction, priority?: number): void
  • addCallback(name: TileEntityAdded, func: TileEntityAddedFunction, priority?: number): void
  • addCallback(name: TileEntityRemoved, func: TileEntityRemovedFunction, priority?: number): void
  • addCallback(name: ContainerClosed, func: ContainerClosedFunction, priority?: number): void
  • addCallback(name: ContainerOpened, func: ContainerOpenedFunction, priority?: number): void
  • addCallback(name: NativeGuiChanged, func: NativeGuiChangedFunction, priority?: number): void
  • addCallback(name: CustomWindowOpened, func: CustomWindowFunction, priority?: number): void
  • addCallback(name: CustomWindowClosed, func: CustomWindowFunction, priority?: number): void
  • addCallback(name: AddRuntimePacks, func: () => void, priority?: number): void
  • addCallback(name: PreBlocksDefined, func: () => void, priority?: number): void
  • addCallback(name: BlocksDefined, func: () => void, priority?: number): void
  • addCallback(name: CoreConfigured, func: CoreConfiguredFunction, priority?: number): void
  • addCallback(name: PreLoaded, func: () => void, priority?: number): void
  • addCallback(name: APILoaded, func: () => void, priority?: number): void
  • addCallback(name: ModsLoaded, func: () => void, priority?: number): void
  • addCallback(name: PostLoaded, func: () => void, priority?: number): void
  • addCallback(name: OptionsChanged, func: () => void, priority?: number): void
  • addCallback(name: LevelSelected, func: LevelSelectedFunction, priority?: number): void
  • addCallback(name: ConnectingToHost, func: ConnectingToHostFunction, priority?: number): void
  • addCallback(name: LevelCreated, func: () => void, priority?: number): void
  • addCallback(name: LevelPreLoaded, func: LevelLoadedFunction, priority?: number): void
  • addCallback(name: LevelLoaded, func: LevelLoadedFunction, priority?: number): void
  • addCallback(name: LocalLevelLoaded, func: () => void, priority?: number): void
  • addCallback(name: LocalPlayerLoaded, func: PlayerFunction, priority?: number): void
  • addCallback(name: RemoteLevelLoaded, func: () => void, priority?: number): void
  • addCallback(name: RemoteLevelPreLoaded, func: () => void, priority?: number): void
  • addCallback(name: ServerLevelLoaded, func: () => void, priority?: number): void
  • addCallback(name: ServerLevelPreLoaded, func: () => void, priority?: number): void
  • addCallback(name: ServerPlayerLoaded, func: PlayerFunction, priority?: number): void
  • addCallback(name: LevelDisplayed, func: () => void, priority?: number): void
  • addCallback(name: ReadSaves, func: SavesFunction, priority?: number): void
  • addCallback(name: WriteSaves, func: SavesFunction, priority?: number): void
  • addCallback(name: SystemKeyEventDispatched, func: SystemKeyEventDispatchedFunction, priority?: number): void
  • addCallback(name: NavigationBackPressed, func: () => void, priority?: number): void
  • addCallback(name: GameLeft, func: () => void, priority?: number): void
  • addCallback(name: LevelPreLeft, func: () => void, priority?: number): void
  • addCallback(name: LevelLeft, func: () => void, priority?: number): void
  • addCallback(name: LocalLevelPreLeft, func: () => void, priority?: number): void
  • addCallback(name: LocalLevelLeft, func: () => void, priority?: number): void
  • addCallback(name: ServerLevelPreLeft, func: () => void, priority?: number): void
  • addCallback(name: ServerLevelLeft, func: () => void, priority?: number): void
  • addCallback(name: ServerPlayerLeft, func: PlayerFunction, priority?: number): void
  • addCallback(name: AppSuspended, func: () => void, priority?: number): void
  • Adds callback function for the specified callback name. Most of native events can be prevented using Game.prevent call.


    Parameters

    • name: string

      callback name, should be one of the pre-defined or a custom name if invoked via Callback.invokeCallback

    • func: Function

      function to be called when an event occurs

    • optionalpriority: number

      the more this value is, the earlier your callback handler will be called when an event occurs

    Returns void

invokeCallback

  • invokeCallback(name: string, o1?: any, o2?: any, o3?: any, o4?: any, o5?: any, o6?: any, o7?: any, o8?: any, o9?: any, o10?: any): void
  • Invokes callback with any name and up to 10 additional parameters. You should not generally call pre-defined callbacks until you really need to do so. If you want to trigger some event in your mod, use your own callback names.


    Parameters

    • name: string

      callback name

    • optionalo1: any
    • optionalo2: any
    • optionalo3: any
    • optionalo4: any
    • optionalo5: any
    • optionalo6: any
    • optionalo7: any
    • optionalo8: any
    • optionalo9: any
    • optionalo10: any

    Returns void