Options
All
  • Public
  • Public/Protected
  • All
Menu

Module that allows to work with current Minecraft world Most of the methods are out of date in multiplayer, use BlockSource instead

Index

Functions

  • addGenerationCallback(callbackName: string, callback: GenerateChunkFunction, uniqueHashStr?: string): void
  • Adds a new generation callback using string hash to generate a unique random seed for the chunk generator

    Parameters

    • callbackName: string

      one of the generation callbacks, see {@page Callbacks} for details

    • callback: GenerateChunkFunction

      callback function

    • Optional uniqueHashStr: string

      if specified, will be used as string hash for seed generation, otherwise default hash string will be used

    Returns void

  • canSeeSky(x: number, y: number, z: number): boolean
  • deprecated

    Out of date in multiplayer

    Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

    true, if one can see sky from the specified position, false otherwise

  • canTileBeReplaced(id: number, data: number): boolean
  • Parameters

    • id: number
    • data: number

    Returns boolean

    true, if tile can be replaced (for example, grass and water can be replaced), false otherwise

  • destroyBlock(x: number, y: number, z: number, drop?: boolean): void
  • Destroys block on the specified coordinates producing appropriate drop and particles. Do not use for massive tasks due to particles being produced

    Parameters

    • x: number
    • y: number
    • z: number
    • Optional drop: boolean

      whether to provide drop for the block or not

    Returns void

  • drop(x: number, y: number, z: number, id: number, count: number, data: number, extra?: ItemExtraData): number
  • Drops item or block with specified id, count, data and extra on the specified coordinates. For blocks, be sure to use block id, not the tile id

    Parameters

    • x: number
    • y: number
    • z: number
    • id: number
    • count: number
    • data: number
    • Optional extra: ItemExtraData

    Returns number

    created drop entity id

  • explode(x: number, y: number, z: number, power: number, fire: boolean): void
  • Creates an explosion on the specified coordinates

    Parameters

    • x: number
    • y: number
    • z: number
    • power: number

      defines how many blocks can the explosion destroy and what blocks can or cannot be destroyed

    • fire: boolean

      if true, puts the crater on fire

    Returns void

  • getBiome(x: number, z: number): number
  • Parameters

    • x: number
    • z: number

    Returns number

    biome id on the specified coordinates

  • getBiomeMap(x: number, z: number): number
  • Gets biome on the specified coordinates when generating biome map. Should be called only in GenerateBiomeMap callback

    Parameters

    • x: number

      block x coordinate

    • z: number

      block y coordinate

    Returns number

    biome's numeric id

  • getBiomeName(x: number, z: number): string
  • deprecated

    This method will return "Unknown" for all the biomes

    Parameters

    • x: number
    • z: number

    Returns string

    biome name on the specified coordinates

  • getBlock(x: number, y: number, z: number): Tile
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns Tile

    Tile object containing tile id and data of the block located on the specified coordinates

  • getBlockData(x: number, y: number, z: number): number
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns number

    data of the block located on the specified coordinates

  • getBlockID(x: number, y: number, z: number): number
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns number

    tile id of the block located on the specified coordinates

  • getGrassColor(x: number, z: number): number
  • Parameters

    • x: number
    • z: number

    Returns number

    grass color for specified coordinates, uses android integer color model

  • getGrassColorRGB(x: number, z: number): Color
  • getInverseBlockSide(side: number): number
  • Parameters

    • side: number

      number from 0 to 6 (exclusive)

    Returns number

    opposite side to argument

  • getLightLevel(x: number, y: number, z: number): number
  • deprecated

    Out of date in multiplayer

    Parameters

    • x: number
    • y: number
    • z: number

    Returns number

    light level on the specified coordinates, from 0 to 15

  • getRelativeCoords(x: number, y: number, z: number, side: number): Vector
  • Retrieves coordinates relative to the block. For example, the following code will return coordinates of the block above the specified:

    World.getRelativeCoords(x, y, z, Native.BlockSide.UP);
    

    Parameters

    • x: number
    • y: number
    • z: number
    • side: number

      block side

    Returns Vector

    relative coordinates

  • getThreadTime(): number
  • getVectorByBlockSide(side: number): Vector
  • getWorldTime(): number
  • isChunkLoaded(x: number, z: number): boolean
  • Parameters

    • x: number

      chunk coordinate

    • z: number

      chunk coordinate

    Returns boolean

    whether the chunk with specified coordinates is loaded or not

  • isChunkLoadedAt(x: number, y: number, z: number): boolean
  • Parameters

    • x: number

      block coordinate

    • y: number

      block coordinate

    • z: number

      block coordinate

    Returns boolean

    whether the chunk containing specified block coordinates is loaded or not

  • isWorldLoaded(): boolean
  • nativeGetBlockData(x: number, y: number, z: number): number
  • nativeGetBlockID(x: number, y: number, z: number): number
  • deprecated

    Consider using World.getBlockID instead

    Parameters

    • x: number
    • y: number
    • z: number

    Returns number

    tile id of the block located on the specified coordinates

  • nativeSetBlock(x: number, y: number, z: number, id: number, data: number): void
  • Sets block in the world using its tile id and data

    deprecated

    Consider using World.setBlock instead

    Parameters

    • x: number
    • y: number
    • z: number
    • id: number

      block tile id

    • data: number

      block data

    Returns void

  • playSound(x: number, y: number, z: number, name: string, volume: number, pitch?: number): void
  • Plays standart Minecraft sound on the specified coordinates

    Parameters

    • x: number
    • y: number
    • z: number
    • name: string

      sound name

    • volume: number

      sound volume from 0 to 1

    • Optional pitch: number

      sound pitch, from 0 to 1, 0.5 is default value

    Returns void

  • playSoundAtEntity(entity: number, name: string, volume: number, pitch?: number): void
  • Plays standart Minecraft sound from the specified entity

    Parameters

    • entity: number
    • name: string

      sound name

    • volume: number

      sound volume from 0 to 1

    • Optional pitch: number

      sound pitch, from 0 to 1, 0.5 is default value

    Returns void

  • registerBlockChangeCallback(ids: string | number | (string | number)[], callback: BlockChangedFunction): void
  • Enables "BlockChanged" event for specified block ids and registers callback function for the ids

    Parameters

    • ids: string | number | (string | number)[]

      string or numeric tile id, or an array of string and/or numeric tile ids

    • callback: BlockChangedFunction

      function that will be called when "BlockChanged" callback occurs involving one of the blocks. Warning! If both old and new blocks are in the ids list, callback function will be called twice.

    Returns void

  • removeTileEntity(x: number, y: number, z: number, region?: BlockSource): boolean
  • If the block on the specified coordinates is a TileEntity, destroys it, dropping its container

    Parameters

    • x: number
    • y: number
    • z: number
    • Optional region: BlockSource

    Returns boolean

    true if the TileEntity was destroyed successfully, false otherwise

  • setBiomeMap(x: number, z: number, id: number): void
  • Sets biome on the specified coordinates when generating biome map. Should be called only in GenerateBiomeMap callback

    Parameters

    • x: number

      block x coordinate

    • z: number

      block y coordinate

    • id: number

      biome id to be set on the specified coordinates

    Returns void

  • setBlock(x: number, y: number, z: number, id: number, data: number): void
  • Sets block in the world using its tile id and data

    Parameters

    • x: number
    • y: number
    • z: number
    • id: number

      block tile id

    • data: number

      block data

    Returns void

  • setBlockChangeCallbackEnabled(id: number, enabled: boolean): void
  • Enables "BlockChanged" event for the block id. Event occurs when either old block or new block is registered using this method

    Parameters

    • id: number

      numeric tile id

    • enabled: boolean

      if true, the block will be watched

    Returns void

  • setDayMode(day: boolean): void
  • Sets current time to day or night

    deprecated

    Consider using World.setWorldTime instead

    Parameters

    • day: boolean

      if true, sets time to 10000 (day), else to 13000 (night)

    Returns void

  • setFullBlock(x: number, y: number, z: number, fullTile: Tile): void
  • Sets block in the world using specified Tile object

    Parameters

    • x: number
    • y: number
    • z: number
    • fullTile: Tile

      object containing id and data of the tile

    Returns void

  • setGrassColor(x: number, z: number, color: number): void
  • Sets grass color on the specified coordinates, uses android integer color model

    Parameters

    • x: number
    • z: number
    • color: number

      grass color to be set for the specified coordinates

    Returns void

  • setGrassColorRGB(x: number, z: number, rgb: Color): void
  • Sets grass color on the specified coordinates, uses rgb color model

    Parameters

    • x: number
    • z: number
    • rgb: Color

    Returns void

  • setLoaded(isLoaded: boolean): boolean
  • Setups the module to work properly with the world. Usually called by Core Engine, so you generally shouldn't call it yourself

    Parameters

    • isLoaded: boolean

      whether the world is loaded or not

    Returns boolean

  • setNightMode(night: boolean): void
  • setWorldTime(time: number): number

Generated using TypeDoc