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

ICRender

Class used to define block models that depend on surrounding blocks. Some examples of such blocks are wires, pipes, block structure parts, etc.

Index

Classes

CollisionShape

CollisionShape:

Class representing custom collision shapes used for block.

constructor

  • Constructs a base model that will be raycasted in world.


    Returns CollisionShape

addEntry

clear

  • clear(): void
  • since: 2.2.1b96

    Returns void

getPtr

  • getPtr(): number
  • Returns number

Model

Model:

constructor

  • Constructs a base model that will be displayed in world.


    Parameters

    • optionalmodel: Model

      optional model to be added without additional conditions

    Returns Model

addEntry

clear

  • clear(): void
  • since: 2.2.1b96

    Returns void

getPtr

  • getPtr(): number
  • Returns number

abstractRANDOM_CONDITION
since: 2.0.2b23

RANDOM_CONDITION:

Condition depending on random value.

constructor

setAxisEnabled

  • Forces engine to treat blocks along some axis in same way if enabled parameter value is false.


    Parameters

    • axis: number

      0 fpr x, 1 for y, 2 for z axis

    • enabled: boolean

    Returns RANDOM_CONDITION

Interfaces

CollisionEntry

CollisionEntry:

Object representing collision shape entry with it's displaying condition.

addBox

  • addBox(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): CollisionEntry
  • Adds new collision box to collision entry.


    Parameters

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

    Returns CollisionEntry

    Reference to itself to be used in sequential calls.

setCondition

  • Sets condition, all the boxes of the entry work only if the condition is true.


    Parameters

    Returns CollisionEntry

    Reference to itself to be used in sequential calls.

Group

Group:

Groups (of blocks) are used to determine some render conditions; e.g., if a block exists on some relative coordinates, display some part of the model.

name

name: string

add

  • add(id: number, data: number): void
  • Adds a block to the group.


    Parameters

    • id: number

      block ID

    • data: number

      block data or -1 to use with all registered data values

    Returns void

getName

  • getName(): string
  • Returns string

    Group's name.

RenderEntry

RenderEntry:

Object representing render entry with it's displaying condition.

asCondition

  • asCondition(x: number, y: number, z: number, group: string | Group, mode: number): RenderEntry
  • asCondition(x: number, y: number, z: number, id: number, data: number, mode: number): RenderEntry

getParent

setCondition

  • Sets condition to be used for current entry.


    Parameters

    Returns RenderEntry

    Reference to itself to be used in sequential calls.

setMesh

  • Sets render mesh to be used for the entry.


    Parameters

    Returns RenderEntry

    Reference to itself to be used in sequential calls.

setModel

  • Sets block model used for the entry, specifying it's coordinates.


    Parameters

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

    Returns RenderEntry

    Reference to itself to be used in sequential calls.

Variables

constMODE_EXCLUDE

MODE_EXCLUDE: 1 = 1

Used to specify that the block should be absent to satisfy condition.

constMODE_INCLUDE

MODE_INCLUDE: 0 = 0

Used to specify that the block should be present to satisfy condition.

Functions

AND

BLOCK

  • BLOCK(x: number, y: number, z: number, group: Group, exclude: boolean): CONDITION
  • Constructs new ICRender.BLOCK condition.


    Parameters

    • x: number

      is relative x coordinate

    • y: number

      is relative y coordinate

    • z: number

      is relative z coordinate

    • group: Group

      blocks group to check the condition for

    • exclude: boolean

      if true, the blocks from the group make the condition evaluate as false, as true otherwise

    Returns CONDITION

BlockState

  • BlockState(x: number, y: number, z: number, state: number, value: number): CONDITION
  • BlockState(state: number, value: number): CONDITION
  • since: 2.3.1b116

    Constructs new ICRender.BlockState condition that uses block state data (it must match the value) to display.


    Parameters

    • x: number

      is relative x coordinate

    • y: number

      is relative y coordinate

    • z: number

      is relative z coordinate

    • state: number

      one of EBlockStates values or custom one of relative block

    • value: number

      value to match selected state

    Returns CONDITION

NOT

OR

RANDOM

  • since: 2.0.2b23

    Constructs new ICRender.RANDOM_CONDITION condition.


    Parameters

    • value: number

      value that a generated random integer number should be for the condition to evaluate as true

    • max: number

      maximum value for the generator

    • optionalseed: number

      seed to be used for random numbers generation

    Returns RANDOM_CONDITION

getGroup

  • Parameters

    • name: string

      group name

    Returns ICRender.Group

    Block group by it's name, if no group with specified name exist, this function creates a new one.

getUnnamedGroup