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

BlockRenderer

Module used to create blocks with any custom model.

Index

Classes

Model

Model:

Class representing model used by BlockRenderer.

constructor

  • new Model(): Model
  • new Model(mesh: RenderMesh): Model
  • new Model(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, descr: ModelTextureSet): Model
  • new Model(descr: ModelTextureSet): Model
  • new Model(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, texName: string, texId: number): Model
  • new Model(texName: string, texId: number): Model
  • new Model(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, id: number, data: number): Model
  • new Model(id: number, data: number): Model
  • Creates a new empty model.


    Returns Model

addBox

  • addBox(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, id: number, data: number): void
  • addBox(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, descr: ModelTextureSet): void
  • addBox(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, texName: string, texId: number): void
  • addBox(id: number, data?: number): void
  • Adds new box to the model using specified block's textures.


    Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • id: number
    • data: number

    Returns void

addMesh

Interfaces

RenderAPI

RenderAPI:

Object used to manipulate rendered block during Callback.CustomBlockTessellationFunction calls.

getAddr

  • getAddr(): number

  • Returns number

    Pointer to native object instance of the following object, to be used in custom native code, etc.

renderBlock

  • renderBlock(x: number, y: number, z: number, blockId: number, blockData: number): void
  • Renders full block at specified coordinates.


    Parameters

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

      ID of the block to be used as texture source

    • blockData: number

      data of the block to be used as texture source

    Returns void

renderBlockHere

  • renderBlockHere(blockId: number, blockData: number): void
  • Renders full block at current block coordinates.


    Parameters

    • blockId: number

      ID of the block to be used as texture source

    • blockData: number

      data of the block to be used as texture source

    Returns void

renderBoxId

  • renderBoxId(x: number, y: number, z: number, x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, id: number, data: number): void
  • Renders box at the specified coordinates of the specified size.


    Parameters

    • x: number
    • y: number
    • z: number
    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • id: number

      ID of the block to be used as texture source

    • data: number

      data of the block to be used as texture source

    Returns void

renderBoxIdHere

  • renderBoxIdHere(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, id: number, data: number): void
  • Renders box at current block coordinates of the specified size.


    Parameters

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

      ID of the block to be used as texture source

    • data: number

      data of the block to be used as texture source

    Returns void

renderBoxTexture

  • renderBoxTexture(x: number, y: number, z: number, x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, texName: string, texId: number): void
  • Renders box at the specified coordinates of the specified size.


    Parameters

    • x: number
    • y: number
    • z: number
    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • texName: string

      block texture name

    • texId: number

      block texture ID

    Returns void

renderBoxTextureHere

  • renderBoxTextureHere(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, id: number, data: number): void
  • Renders box at current block coordinates of the specified size.


    Parameters

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

      ID of the block to be used as texture source

    • data: number

      data of the block to be used as texture source

    Returns void

renderModel

  • renderModel(x: number, y: number, z: number, model: Model): void
  • Renders block model at the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number
    • model: Model

      block model to be rendered at the specified coordinates

    Returns void

renderModelHere

  • renderModelHere(model: Model): void
  • Renders block model at current block coordinates.


    Parameters

    • model: Model

      block model to be rendered at current block coordinates

    Returns void

Type Aliases

ModelTextureSet

ModelTextureSet: [string, number][]

Type used to describe a new model for BlockRenderer.

Functions

addRenderCallback

  • Adds "CustomBlockTessellation" callback function for specified block ID.


    Parameters

    Returns void

createModel

createTexturedBlock

  • Constructs new block model of specified simple block of the normal block size shape with specified textures.


    Parameters

    Returns BlockRenderer.Model

createTexturedBox

  • Constructs new block model of specified simple block shape with specified textures.


    Parameters

    • x1: number
    • y1: number
    • z1: number
    • x2: number
    • y2: number
    • z2: number
    • descr: ModelTextureSet

      texture set used for the box

    Returns BlockRenderer.Model

disableCustomRender

  • disableCustomRender(id: number, data: number): void
  • Disables custom rendering for the specified block.


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to map all the data values

    Returns void

enableCoordMapping

  • enableCoordMapping(id: number, data: number, icRender: Model): void
  • Enables block mapping for the specified block.


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to map all the data values

    • icRender: Model

      default model for the block

    Returns void

enableCustomRender

  • enableCustomRender(id: number, data: number): void
  • Enables custom rendering for the specified block.


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to map all the data values

    Returns void

forceRenderRebuild

  • forceRenderRebuild(x: number, y: number, z: number, mode: number): void
  • Forces block renders to be rebuilt immediately.


    Parameters

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

      if 0 is passed, only the specified block gets rebuilt, if 1 is passed, all the blocks along y axes are rebuilt

    Returns void

mapAtCoords

  • mapAtCoords(x: number, y: number, z: number, icRender: Model, preventRebuild?: boolean): void
  • Changes shape of the block on the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number
    • icRender: Model

      ICRender.Model object to be displayed at the coordinates

    • optionalpreventRebuild: boolean

      if false or not specified, rebuild is performed immediately

    Returns void

mapCollisionAndRaycastModelAtCoords

  • mapCollisionAndRaycastModelAtCoords(dimension: number, x: number, y: number, z: number, shape: CollisionShape): void
  • Changes both collision and raycast shape of the block on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

    Returns void

mapCollisionModelAtCoords

  • mapCollisionModelAtCoords(dimension: number, x: number, y: number, z: number, shape: CollisionShape): void
  • Changes collision shape of the block on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

    Returns void

mapRaycastModelAtCoords

  • mapRaycastModelAtCoords(dimension: number, x: number, y: number, z: number, shape: CollisionShape): void
  • Changes raycast shape of the block on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

    Returns void

setCustomCollisionAndRaycastShape

  • setCustomCollisionAndRaycastShape(id: number, data: number, shape: CollisionShape): void
  • Specifies custom collision and raycast shape for the block.

    @since

    2.1.0b59


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to map all the data values

    • shape: CollisionShape

      ICRender.CollisionShape object to be used as default collision and raycast shape for the specified block

    Returns void

setCustomCollisionShape

  • setCustomCollisionShape(id: number, data: number, shape: CollisionShape): void
  • Specifies custom collision shape for the block.

    @since

    2.1.0b59


    Parameters

    Returns void

setCustomRaycastShape

  • setCustomRaycastShape(id: number, data: number, shape: CollisionShape): void
  • Specifies custom raycast shape for the block.

    @since

    2.1.0b59


    Parameters

    Returns void

setStaticICRender

  • setStaticICRender(id: number, data: number, icRender: Model): void
  • Sets static ICRender model as block render shape.


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to map all the data values

    • icRender: Model

      ICRender.Model object to be used as static block shape

    Returns void

unmapAtCoords

  • unmapAtCoords(x: number, y: number, z: number, preventRebuild?: boolean): void
  • Resets shape of the block to default on the specified coordinates.


    Parameters

    • x: number
    • y: number
    • z: number
    • optionalpreventRebuild: boolean

      if false or not specified, rebuild is performed immediately

    Returns void

unmapCollisionAndRaycastModelAtCoords

  • unmapCollisionAndRaycastModelAtCoords(dimension: number, x: number, y: number, z: number): void
  • Resets both collision and raycast shape of the block to default on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

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

    Returns void

unmapCollisionModelAtCoords

  • unmapCollisionModelAtCoords(dimension: number, x: number, y: number, z: number): void
  • Resets collision shape of the block to default on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

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

    Returns void

unmapRaycastModelAtCoords

  • unmapRaycastModelAtCoords(dimension: number, x: number, y: number, z: number): void
  • Resets raycast shape of the block to default on given coords in given dimension.

    @since

    2.1.0b59


    Parameters

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

    Returns void