Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace World

Module that allows to work with current Minecraft world

deprecated

Most of the methods are out of date in multiplayer, use BlockSource instead

Index

Functions

addGenerationCallback

  • 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 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

addTileEntity

canSeeSky

  • 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 othrwise

canTileBeReplaced

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

    • id: number
    • data: number

    Returns boolean

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

destroyBlock

  • 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 producesd

    Parameters

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

      whenther to provide drop for the block or not

    Returns void

drop

  • drop(x: number, y: number, z: number, id: number, count: number, data: number, extra?: ItemExtraData): number
  • Drops item or block with specified id, cound, 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

  • explode(x: number, y: number, z: number, power: number, fire: boolean): void
  • Creates an explosion on the sepcified 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

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

    • x: number
    • z: number

    Returns number

    biome id on the specified coordinates

getBiomeMap

  • 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

  • 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

  • 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

  • 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

  • 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

getContainer

getGrassColor

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

    • x: number
    • z: number

    Returns number

    grass color for specified coordinates, uses android integer color model

getGrassColorRGB

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

    • x: number
    • z: number

    Returns Color

    grass color for specified coordinates, uses rgb color model

getLightLevel

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

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

    Returns number

    light level on the specified coordinates, from 0 to 15

getRelativeCoords

  • 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

  • getThreadTime(): number

getTileEntity

  • getTileEntity(x: number, y: number, z: number): TileEntity

getWeather

getWorldTime

  • getWorldTime(): number

isChunkLoaded

  • isChunkLoaded(x: number, z: number): boolean
  • Parameters

    • x: number

      chunk coordinate

    • z: number

      chunk coordinate

    Returns boolean

    whether the chunk with specified coodinates is loaded or not

isChunkLoadedAt

  • 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

  • isWorldLoaded(): boolean

nativeGetBlockData

  • nativeGetBlockData(x: number, y: number, z: number): number

nativeGetBlockID

  • 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

  • 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

  • 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

    • pitch: number

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

    Returns void

playSoundAtEntity

  • 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

    • pitch: number

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

    Returns void

registerBlockChangeCallback

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

    Parameters

    • ids: number | string | (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 funciton will be called twice.

    Returns void

removeTileEntity

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

    Parameters

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

    Returns boolean

    true if the TileEntity was destroyed successfully, false otherwise

setBiomeMap

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • setNightMode(night: boolean): void

setWeather

  • setWeather(weather: Weather): void

setWorldTime

  • setWorldTime(time: number): number
  • Sets current world time

    Parameters

    • time: number

      time in ticks

    Returns number

Generated using TypeDoc