Namespace World

Module that allows to work with current Minecraft world. Most of the methods are client-side, use BlockSource instead.

Functions

  • 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

    • callback: GenerateChunkFunction

      callback function

    • OptionaluniqueHashStr: string

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

    Returns void

    2.0.1b11

  • Listens for chunk loading state changes.

    Parameters

    • listener: ChunkStateChangedFunction

      chunk state function watcher

    • states: number[]

      chunk states that should be received by watcher

    Returns void

    2.4.0b122

  • Listens for local chunk loading state changes.

    Parameters

    • listener: ChunkStateChangedFunction

      chunk state function watcher

    • states: number[]

      chunk states that should be received by watcher

    Returns void

    2.4.0b122

  • Parameters

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

    Returns boolean

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

    Client only method!

  • Parameters

    • id: number
    • data: number

    Returns boolean

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

  • Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • Optionalmode: number

      certain modes also working with actors

    Returns void

    2.0.2b27

  • 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
    • Optionaldrop: boolean

      whether to provide drop for the block or not

    Returns void

  • Parameters

    • id: number

    Returns boolean

    2.0.2b27

  • 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
    • Optionalextra: ItemExtraData

    Returns number

    Spawned drop entity ID.

  • 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

  • Parameters

    • x: number
    • z: number

    Returns number

    Biome ID on the specified coordinates.

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

    Returns number

    Biome's numeric ID.

    2.0.1b11

  • Parameters

    • x: number
    • z: number

    Returns string

    Biome name on the specified coordinates.

  • Parameters

    • biome: number

    Returns string

    Biome name by specified identifier.

  • Parameters

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

    Returns Tile

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

  • Parameters

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

    Returns number

    Data of the block located on the specified coordinates.

  • Parameters

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

    Returns number

    Tile ID of the block located on the specified coordinates.

  • Returns chunk state on specified location, like loaded, unloaded or interrupted.

    Parameters

    • x: number
    • z: number

    Returns number

  • Returns chunk state on specified coordinates, like loaded, unloaded or interrupted.

    Parameters

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

    Returns number

  • Parameters

    • x: number
    • z: number

    Returns number

    Grass color for specified coordinates, uses android integer color model.

  • Parameters

    • x: number
    • z: number

    Returns Color

    Grass color for specified coordinates, uses rgb color model.

  • Parameters

    • side: number

      number from 0 to 6 (exclusive) *

    Returns number

    Opposite side to argument.

  • Parameters

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

    Returns number

    Light level on the specified coordinates, from 0 to 15.

    Client only method!

  • Retrieves coordinates relative to the block.

    Parameters

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

      block side

    Returns Vector

    Relative coordinates.

    Return coordinates of the block above the specified:

    World.getRelativeCoords(x, y, z, EBlockSide.UP);
    
  • Returns number

    Currently world seed, which is used, for example, in generation callbacks.

  • Parameters

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

    Returns number

    Biome temperature on specified coordinates.

    Client only method!

  • Returns number

    Tick number since the player joined the world.

  • Parameters

    • side: number

      block side

    Returns Vector

    Normalized vector for this side.

  • Returns string

    Loaded world directory full path.

  • Returns number

    Current world's time in ticks.

    2.3.1b116-3 (client-side)

  • Parameters

    • x: number

      chunk coordinate

    • z: number

      chunk coordinate

    Returns boolean

    Whether the chunk with specified coordinates is loaded or not.

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

  • Returns boolean

    Whether the world is loaded or not.

  • Parameters

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

    Returns number

    Data of the block located on the specified coordinates.

    Consider using World.getBlockData instead.

  • Parameters

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

    Returns number

    Tile ID of the block located on the specified coordinates.

    Consider using World.getBlockID instead.

  • Sets block in the world using it's tile ID and data.

    Parameters

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

      block tile ID

    • data: number

      block data

    Returns void

    Consider using World.setBlock instead.

  • 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

    • Optionalpitch: number

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

    Returns void

  • Plays standart Minecraft sound from the specified entity.

    Parameters

    • entity: number
    • name: string

      sound name

    • volume: number

      sound volume from 0 to 1

    • Optionalpitch: number

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

    Returns 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

  • If the block on the specified coordinates is a TileEntity, destroys it, dropping it's container.

    Parameters

    Returns boolean

    true if the tile was destroyed successfully, false otherwise.

  • Overrides currently biome on specified coordinates. Consider using World.setBiomeMap in GenerateBiomeMap callback.

    Parameters

    • x: number
    • z: number

    Returns 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 z coordinate

    • id: number

      biome ID to be set on the specified coordinates

    Returns void

    2.0.1b11

  • Sets block in the world using it's tile ID and data.

    Parameters

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

      block tile ID

    • data: number

      block data

    Returns 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

  • Parameters

    • allowed: boolean

    Returns void

    2.0.2b27

    Client only method!

  • Parameters

    • type: number

    Returns void

    2.0.2b27

    Client only method!

  • Sets current time to day or night.

    Parameters

    • day: boolean

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

    Returns void

    Consider using World.setWorldTime instead.

  • 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

  • Sets grass color on the specified coordinates, uses android-like integer color model.

    Parameters

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

      grass color to be set for the specified coordinates

    Returns void

  • Sets grass color on the specified coordinates, uses rgb color model.

    Parameters

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

      grass color to be set for the specified coordinates

    Returns void

  • Internal

    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

  • Sets current time to day or night.

    Parameters

    • night: boolean

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

    Returns void

    Consider using World.setWorldTime instead.

  • Sets current weather in the world.

    Parameters

    Returns void

  • Sets current world time.

    Parameters

    • time: number

      time in ticks

    Returns number

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.