Class BlockSource

New class to work with world instead of some methods from World module.

Constructors

Methods

  • Parameters

    • x: number
    • y: number
    • z: number
    • state: BlockState
    • delay: number
    • Optionaltodo: number

    Returns void

    2.2.1b102

  • Parameters

    • x: number
    • y: number
    • z: number
    • delay: number
    • Optionaltodo: number

    Returns void

    2.2.1b102

  • Destroys block on coords by entity using specified item or without it.

    Parameters

    • x: number
    • y: number
    • z: number
    • allowDrop: boolean

      whether to provide drop for the block or not

    • OptionalentityUid: number

      entity ID or -1 ID if entity is not specified

    • Optionalitem: ItemInstance

      tool which broke block

    Returns void

    2.2.0b83

  • Destroys block on coords by entity using specified item.

    Parameters

    • x: number
    • y: number
    • z: number
    • allowDrop: boolean

      whether to provide drop for the block or not

    • item: ItemInstance

      tool which broke block

    Returns void

    2.2.0b83

  • Parameters

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

    Returns boolean

    Whether the sky can be seen from coords.

  • Parameters

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

      certain modes also working with actors

    • output: number[]

    Returns number

  • Destroys block on coords 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

  • Creates an explosion on coords.

    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

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

      entity type, since 2.3.1b115 could be used to fetch all entities via 0 or 256

    • Optionalblacklist: boolean

    Returns number[]

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

  • Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • namespace: string

      entity namespace, e.g. "minecraft"

    • type: string

      entity type, e.g. "chicken"

    Returns number[]

    Iterator of entity IDs in given box, that are equal to the given type.

    2.3.1b115

  • Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • type: string

      namespaced entity type, e.g. "minecraft:chicken"; if there is no namespace, default "minecraft" will be used instead, e.g. "chicken"

    Returns number[]

    Iterator of entity IDs in given box, that are equal to the given type.

    2.3.1b115

  • Parameters

    • x: number

      X coord of the block

    • z: number

      Z coord of the block

    Returns number

    Biome ID.

  • Parameters

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

    Returns number

    Downfall of the biome on coords.

    2.2.1b96

  • Parameters

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

    Returns number

    Temperature of the biome on coords.

  • Parameters

    • x: number

      X coord of the block

    • y: number

      Y coord of the block

    • z: number

      Z coord of the block

    Returns Tile | BlockState

    Object of the block on given coords or Tile object in Legacy pack.

    2.1.0b59

  • Parameters

    • x: number

      X coord of the block

    • y: number

      Y coord of the block

    • z: number

      Z coord of the block

    Returns number

    Block's data at coords.

  • Parameters

    • x: number

      X coord of the block

    • y: number

      Y coord of the block

    • z: number

      Z coord of the block

    Returns number

    Block's ID at coords.

  • Parameters

    • x: number

      X coord of the block

    • y: number

      Y coord of the block

    • z: number

      Z coord of the block

    Returns number

    Block's ID at coords.

    2.2.1b96

  • Parameters

    • chunkX: number

      X coord of the chunk

    • chunkZ: number

      Z coord of the chunk

    Returns number

    Loading state of the chunk by chunk coords.

  • Parameters

    • x: number

      X coord of the position

    • z: number

      Z coord of the position

    Returns number

    Loading state of the chunk by coords.

  • Returns boolean

    2.2.1b102

  • Returns number

    Dimension ID to which the following object belongs.

  • Parameters

    • x: number
    • z: number

    Returns number

    Grass color on chunk coords.

  • Parameters

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

    Returns number

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

    2.1.0b69

  • Parameters

    • chunkX: number

      X coord of the chunk

    • chunkZ: number

      Z coord of the chunk

    Returns boolean

    true if chunk is loaded, false otherwise.

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

  • Parameters

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

      entity type, since 2.3.1b115 could be used to fetch all entities via 0 or 256

    • Optionalblacklist: boolean

    Returns number[]

    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.

  • Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • namespace: string

      entity namespace, e.g. "minecraft"

    • type: string

      entity type, e.g. "chicken"

    Returns number[]

    List of entity IDs in given box, that are equal to the given type.

    2.3.1b115

  • Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • type: string

      namespaced entity type, e.g. "minecraft:chicken"; if there is no namespace, default "minecraft" will be used instead, e.g. "chicken"

    Returns number[]

    List of entity IDs in given box, that are equal to the given type.

    2.3.1b115

  • Sets biome ID by coords.

    Parameters

    • chunkX: number
    • chunkZ: number
    • biomeID: number

      ID of the biome to set

    Returns void

  • Sets block on coords.

    Parameters

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

      ID of the block to set

    • data: number

      data of the block to set

    Returns void

  • Sets block on coords.

    Parameters

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

      ID of the block to set

    Returns void

    2.2.1b95

  • Sets block by given BlockState on coords.

    Parameters

    Returns void

  • Parameters

    • allowed: boolean

    Returns void

  • Whether or not particles must be emitted when destroying blocks with this source.

    Parameters

    • enabled: boolean

    Returns void

    true
    

    2.2.1b102

  • Sets extra block (for example, water inside another blocks), on given coords by given ID and data.

    Parameters

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

    Returns void

    2.2.1b95

  • Sets extra block (for example, water inside another blocks), on given coords by given BlockState.

    Parameters

    Returns void

    2.2.1b95

  • Parameters

    • level: number

    Returns void

    2.4.0b119

  • Parameters

    • level: number

    Returns void

    2.4.0b119

  • Creates dropped item and returns entity ID.

    Parameters

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

      ID of the item to drop

    • count: number

      count of the item to drop

    • data: number

      data of the item to drop

    • Optionalextra: ItemExtraData

      extra of the item to drop

    Returns number

    Drop entity ID.

  • Spawns entity of given numeric or namespaced type on coords.

    Parameters

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

      numeric entity type, e.g. EEntityType.CHICKEN or namespaced type with possible ommitions, e.g. "minecraft:chicken:", "minecraft:chicken", "chicken" does same

    Returns number

    Callback.addCallback("ItemUse", (coords: ItemUseCoordinates, item: ItemInstance, block: Tile, isExternal: boolean, player: number) =>
    BlockSource.getDefaultForActor(player)?.spawnEntity(coords.relative.x, coords.relative.y, coords.relative.z, EEntityType.CHICKEN));
  • Spawns entity of given namespace by string type on coords with optional spawn events data.

    Parameters

    • x: number
    • y: number
    • z: number
    • namespace: string
    • type: string
    • OptionalinitData: string

    Returns number

    Callback.addCallback("ItemUse", (coords: ItemUseCoordinates, item: ItemInstance, block: Tile, isExternal: boolean, player: number) =>
    BlockSource.getDefaultForActor(player)?.spawnEntity(coords.relative.x, coords.relative.y, coords.relative.z, "minecraft", "chicken", ""));
  • Spawns experience orbs on coords.

    Parameters

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

      experience amount

    Returns void

  • Parameters

    • entityUid: number

    Returns BlockSource

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

  • Parameters

    • dimension: number

    Returns BlockSource

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

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