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

WorldRegion

Class to work with world based on BlockSource

Index

Constructors

constructor

Properties

readonlyblockSource

blockSource: BlockSource

privatereadonlyisDeprecated

isDeprecated: any

Methods

addTileEntity

  • addTileEntity(coords: Vector): TileEntity
  • addTileEntity(x: number, y: number, z: number): TileEntity
  • If the block on the specified coordinates is a TileEntity block and is not initialized, initializes it and returns created TileEntity object.


    Parameters

    • coords: Vector

    Returns TileEntity

    TileEntity if one was created, null otherwise.

breakBlock

  • breakBlock(coords: Vector, allowDrop: boolean, entity: number, item: ItemInstance): void
  • breakBlock(x: number, y: number, z: number, allowDrop: boolean, entity: number, item: ItemInstance): void
  • Destroys block on coords by entity using specified item. Partially reverse compatible with Legacy version (doesn't support item argument).


    Parameters

    • coords: Vector

      coords of the block

    • allowDrop: boolean

      whether to provide drop for the block or not

    • entity: number

      Entity id or -1 id if entity is not specified

    • item: ItemInstance

      Tool which broke block

    Returns void

breakBlockForResult

  • breakBlockForResult(coords: Vector, entity: number, item: ItemInstance): { experience: number; items: ItemInstance[] }
  • breakBlockForResult(x: number, y: number, z: number, entity: number, item: ItemInstance): { experience: number; items: ItemInstance[] }
  • Same as breakBlock, but returns object containing drop and experince. Partially reverse compatible with Legacy version (doesn't return experience).


    Parameters

    • coords: Vector

      coords of the block

    • entity: number

      Entity id or -1 id if entity is not specified

    • item: ItemInstance

      Tool which broke block

    Returns { experience: number; items: ItemInstance[] }

    • experience: number
    • items: ItemInstance[]

canSeeSky

  • canSeeSky(coords: Vector): boolean
  • canSeeSky(x: number, y: number, z: number): boolean

  • Parameters

    • coords: Vector

    Returns boolean

    whether the sky can be seen from coords

destroyBlock

  • destroyBlock(coords: Vector, drop?: boolean, player?: number): void
  • destroyBlock(x: number, y: number, z: number, drop?: boolean, player?: number): void
  • Destroys block on coords producing appropriate drop and particles.


    Parameters

    • coords: Vector

      coords of the block

    • optionaldrop: boolean

      whether to provide drop for the block or not

    • optionalplayer: number

      player entity if the block was destroyed by player

    Returns void

dropAtBlock

  • dropAtBlock(coords: Vector, item: ItemInstance): number
  • dropAtBlock(coords: Vector, id: number, count: number, data: number, extra?: ItemExtraData): number
  • dropAtBlock(x: number, y: number, z: number, item: ItemInstance): number
  • dropAtBlock(x: number, y: number, z: number, id: number, count: number, data: number, extra?: ItemExtraData): number
  • Creates dropped item at the block center and returns entity id


    Parameters

    • coords: Vector

      coords of the block where item will be dropped

    • item: ItemInstance

      item to drop

    Returns number

    drop entity id

dropItem

  • dropItem(coords: Vector, item: ItemInstance): number
  • dropItem(coords: Vector, id: number, count?: number, data?: number, extra?: ItemExtraData): number
  • dropItem(x: number, y: number, z: number, item: ItemInstance): number
  • dropItem(x: number, y: number, z: number, id: number, count?: number, data?: number, extra?: ItemExtraData): number
  • Creates dropped item and returns entity id


    Parameters

    • coords: Vector

      coords of the place where item will be dropped

    • item: ItemInstance

      item to drop

    Returns number

    drop entity id

explode

  • explode(coords: Vector, power: number, fire?: boolean): void
  • explode(x: number, y: any, z: any, power: number, fire?: boolean): void
  • Causes an explosion on coords.


    Parameters

    • coords: Vector
    • power: number

      defines radius of the explosion and what blocks it can destroy

    • optionalfire: 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 at X and Z coord.

getBiomeTemperatureAt

  • getBiomeTemperatureAt(coords: Vector): number
  • getBiomeTemperatureAt(x: number, y: number, z: number): number

  • Parameters

    • coords: Vector

    Returns number

    temperature of the biome on coords.

getBlock

  • getBlock(coords: Vector): BlockState
  • getBlock(x: number, y: number, z: number): BlockState

  • Parameters

    • coords: Vector

    Returns BlockState

    BlockState object of the block at coords

getBlockData

  • getBlockData(coords: Vector): number
  • getBlockData(x: number, y: number, z: number): number

  • Parameters

    • coords: Vector

    Returns number

    block's data at coords.

getBlockId

  • getBlockId(coords: Vector): number
  • getBlockId(x: number, y: number, z: number): number

  • Parameters

    • coords: Vector

    Returns number

    block's id at coords.

getChunkState

  • getChunkState(chunkX: number, chunkZ: number): number

  • Parameters

    • chunkX: number

      X coord of the chunk

    • chunkZ: number

      Z coord of the chunk

    Returns number

    the loading state of the chunk by chunk coords.

getChunkStateAt

  • getChunkStateAt(x: number, z: number): number

  • Parameters

    • x: number

      X coord of the position

    • z: number

      Z coord of the position

    Returns number

    the loading state of the chunk by coords.

getContainer

  • getContainer(coords: Vector): any
  • getContainer(x: number, y: number, z: number): any

  • Parameters

    • coords: Vector

    Returns any

    if the block on the specified coordinates is a TileEntity, returns its container, if the block is a NativeTileEntity, returns its instance, if none of above, returns null.

getDimension

  • getDimension(): number

  • Returns number

    the dimension id to which the following object belongs.

getExtraBlock

  • getExtraBlock(coords: Vector): BlockState
  • getExtraBlock(x: number, y: number, z: number): BlockState
  • Doesn't support Legacy version.


    Parameters

    • coords: Vector

    Returns BlockState

    [[BlockState]] object of the extra block on given coords

getGrassColor

  • getGrassColor(coords: Vector): number
  • getGrassColor(x: number, y: number, z: number): number

  • Parameters

    • coords: Vector

    Returns number

    grass color on coords

getLightLevel

  • getLightLevel(coords: Vector): number
  • getLightLevel(x: number, y: number, z: number): number

  • Parameters

    • coords: Vector

    Returns number

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

getNativeTileEntity

  • getNativeTileEntity(coords: Vector): NativeTileEntity
  • getNativeTileEntity(x: number, y: number, z: number): NativeTileEntity

  • Parameters

    • coords: Vector

    Returns NativeTileEntity

    interface to the vanilla TileEntity (chest, furnace, etc.) on the coords.

getTileEntity

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

  • Parameters

    • coords: Vector

    Returns TileEntity

    TileEntity located on the specified coordinates if it is initialized.

isChunkLoaded

  • isChunkLoaded(chunkX: number, chunkZ: number): boolean

  • Parameters

    • chunkX: number

      X coord of the chunk

    • chunkZ: number

      Z coord of the chunk

    Returns boolean

    true if chunk is loaded, false otherwise.

isChunkLoadedAt

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

  • Parameters

    • x: number

      X coord of the position

    • z: number

      Z coord of the position

    Returns boolean

    true if chunk on the position is loaded, false otherwise.

listEntitiesInAABB

  • listEntitiesInAABB(pos1: Vector, pos2: Vector, type?: number, blacklist?: boolean): number[]
  • listEntitiesInAABB(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, type?: number, blacklist?: boolean): number[]

  • Parameters

    • pos1: Vector
    • pos2: Vector
    • optionaltype: number
    • optionalblacklist: boolean

    Returns number[]

    the list of entity IDs in given box, that are equal to the given type, if blacklist value is false, and all except the entities of the given type, if blacklist value is true.

playSound

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


    Parameters

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

      sound name

    • optionalvolume: number

      sound volume from 0 to 1. Default is 1.

    • optionalpitch: number

      sound pitch, from 0 to 1. Default is 1.

    Returns void

playSoundAtEntity

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


    Parameters

    • ent: number

      entity id

    • name: string

      sound name

    • optionalvolume: number

      sound volume from 0 to 1. Default is 1.

    • optionalpitch: number

      sound pitch, from 0 to 1. Default is 1.

    Returns void

removeTileEntity

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


    Parameters

    • coords: Vector

    Returns boolean

    true if the TileEntity was destroyed successfully, false otherwise.

sendPacketInRadius

  • sendPacketInRadius(coords: Vector, radius: number, packetName: string, data: object): void
  • Sends network packet for players within a radius from specified coords.


    Parameters

    • coords: Vector

      coordinates from which players will be searched

    • radius: number

      radius within which players will receive packet

    • packetName: string

      name of the packet to send

    • data: object

      packet data object

    Returns void

setBiome

  • setBiome(x: number, z: number, biomeID: number): void
  • Sets biome id by coords.


    Parameters

    • x: number
    • z: number
    • biomeID: number

      id of the biome to set

    Returns void

setBlock

  • setBlock(coords: Vector, state: any): void
  • setBlock(coords: Vector, id: number, data?: number): void
  • setBlock(x: number, y: number, z: number, state: any): void
  • setBlock(x: number, y: number, z: number, id: number, data?: number): void
  • Sets block on coords.


    Parameters

    • coords: Vector
    • state: any

    Returns void

setExtraBlock

  • setExtraBlock(coords: Vector, state: BlockState): void
  • setExtraBlock(coords: Vector, id: number, data?: number): void
  • setExtraBlock(x: number, y: number, z: number, id: number, data?: number): void
  • setExtraBlock(x: number, y: number, z: number, state: BlockState): void
  • Sets extra block (for example, water inside another blocks) on given coords by given id and data. Doesn't support Legacy version.


    Parameters

    • coords: Vector
    • state: BlockState

    Returns void

spawnEntity

  • spawnEntity(x: number, y: number, z: number, type: string | number): number
  • spawnEntity(x: number, y: number, z: number, namespace: string, type: string, spawnEvent: string): number
  • Spawns entity of given type on coords.


    Parameters

    • x: number
    • y: number
    • z: number
    • type: string | number

      entity numeric or string type

    Returns number

spawnExpOrbs

  • spawnExpOrbs(coords: Vector, amount: number): void
  • spawnExpOrbs(x: any, y: number, z: number, amount: number): void
  • Spawns experience orbs on coords.


    Parameters

    • coords: Vector
    • amount: number

      experience amount

    Returns void

staticgetCurrentWorldGenRegion


  • Returns Nullable<WorldRegion>

    WorldRegion for world generation callback.

staticgetForActor


  • Parameters

    • entityUid: number

    Returns Nullable<WorldRegion>

    interface to the dimension where the given entity is (null if given entity does not exist or the dimension is not loaded and interface was not created).

staticgetForDimension

  • getForDimension(dimension: number): Nullable<WorldRegion>

  • Parameters

    • dimension: number

    Returns Nullable<WorldRegion>

    interface to given dimension (null if given dimension is not loaded and this interface was not created yet).