MineJSv0.7.0

Block

Source: block.ts:57

Represent a block


Constructors

new Block( type: string, definitions: Record<'type' | 'block_set_type' | string, any>, properties: Record<string, string[]>, states: Record<string, any> | BlockState[], ): Block

Parameters

  • type (string)
  • definitions (Record<"type" | "block_set_type" | string, any>)
  • properties (Record<string, string[]>)
  • states (Record<string, any> | BlockState[])

Returns

Block


Properties

definitions: Record<'type' | 'block_set_type' | string, any>

properties: Record<string, string[]>

states: BlockState[]

A block will have multiple states (example: a stair will have difference facing).

type: string

Methods

getBounciness(): number

Get the block bounciness.

By default, block friction is 0, except for slime block.

Returns

  • number

getClimbable(): boolean

Check if the block is climable.

By default, block friction is false, except for ladder and vine.

Returns

  • boolean

getFriction(): number

Get the block friction.

By default, block friction is 0.6, except for ice block family.

Returns

  • number

getJumpFactor(): number

Get the block jump factor.

Returns

  • number

getSpeedFactor(): number

Get the block speed factor.

By default, block friction is 1, except for soul sand block.

Returns

  • number

getType(): string

Get the block type.

A block type will contain multiple blocks, like type wall_sign will have oak_wall_sign, spruce_wall_sign, acacia_wall_sign, etc...

Returns

  • string