BlockRegistry
Index
Functions
- addBlockDropOnExplosion
- convertBlockTypeToSpecialType
- createBlock
- createBlockType
- createBlockWithRotation
- createSlabs
- createStairs
- extendBlockType
- getBlockDrop
- getBlockRotation
- getBlockType
- getInstanceOf
- getPlacePosition
- registerBlock
- registerBlockFuncs
- registerDrop
- registerOnExplosionFunction
- setBaseBlock
- setBlockColorSource
- setBlockMaterial
- setDestroyLevel
- setDestroyTime
- setExplosionResistance
- setFriction
- setLightLevel
- setLightOpacity
- setMapColor
- setRenderAllFaces
- setRenderLayer
- setRenderType
- setRotationFunction
- setSolid
- setSoundType
- setTranslucency
Functions
addBlockDropOnExplosion
Registers block drop on explosion with 25% chance.
Parameters
blockID: string | number
Returns void
convertBlockTypeToSpecialType
Converts block type to special type.
Parameters
properites: BlockType
BlockType object
Returns Block.SpecialType
block special type
createBlock
Creates new block using specified params.
Parameters
stringID: string
string id of the block.
defineData: BlockVariation[]
array containing all variations of the block. Each variation corresponds to block data value, data values are assigned according to variations order.
optionalblockType: string | BlockType
BlockType object or block type name, if the type was previously registered.
Returns void
createBlockType
Registers block type in BlockEngine and as Block.SpecialType.
Parameters
name: string
block type name
type: BlockType
BlockType object
optionalisNative: boolean
if true doesn't create special type
Returns void
createBlockWithRotation
Creates new block with horizontal or all sides rotation.
Parameters
stringID: string
string id of the block
defineData: BlockVariation[]
array containing all variations of the block. Supports 2 variations, each occupying 6 data values for rotation.
optionalblockType: string | BlockType
BlockType object or block type name, if the type was previously registered.
optionalhasVerticalFacings: boolean
true if the block has vertical facings, false otherwise.
Returns void
createSlabs
Creates slabs and its double slabs using specified params
Parameters
slabID: string
string id of the
doubleSlabID: string
string id of the double slab
defineData: BlockVariation[]
array containing all variations of the block. Each variation corresponds to block data value, data values are assigned according to variations order.
optionalblockType: string | BlockType
BlockType object or block type name, if the type was previously registered.
Returns void
createStairs
Creates stairs using specified params
Parameters
stringID: string
string id of the block
defineData: BlockVariation[]
array containing one variation of the block (for similarity with other methods).
optionalblockType: string | BlockType
BlockType object or block type name, if the type was previously registered.
Returns void
extendBlockType
Inherits default values from type specified in "extends" property.
Parameters
type: BlockType
BlockType object
Returns void
getBlockDrop
- That feature is obsolete
Parameters
x: number
y: number
z: number
block: Tile
level: number
item: ItemInstance
optionalregion: BlockSource
Returns ItemInstanceArray[]
getBlockRotation
Parameters
player: number
player uid
optionalhasVertical: boolean
if true can return vertical sides as well
Returns number
block side opposite to player rotation.
getBlockType
Parameters
name: string
block type name
Returns Nullable<BlockType>
BlockType object by name
getInstanceOf
Parameters
blockID: string | number
block numeric or string id
Returns Nullable<BlockBase>
instance of block class if it exists
getPlacePosition
Parameters
coords: ItemUseCoordinates
click coords
block: Tile
touched block
region: BlockSource
BlockSource
Returns Vector
block place position for click coords in world.
registerBlock
registerBlockFuncs
Registers all block functions.
Parameters
blockID: string | number
block numeric or string id
blockFuncs: BlockBehavior
object containing block functions
Returns void
registerDrop
Registers drop function for block.
Parameters
blockID: string | number
block numeric or string id
dropFunc: DropFunction
drop function
optionallevel: number
mining level
Returns void
registerOnExplosionFunction
Registers function called when block is destroyed by explosion.
Parameters
blockID: string | number
block numeric or string id
func: PopResourcesFunction
function on explosion
Returns void
setBaseBlock
Sets the block type of another block, which allows to inherit some of its properties.
Parameters
blockID: string | number
block numeric or string id
baseBlock: number
id of the block to inherit type
Returns void
setBlockColorSource
Makes block use biome color when displayed on the vanilla maps.
Parameters
blockID: string | number
block numeric or string id
color: ColorSource
block color source
Returns void
setBlockMaterial
Registers block material and digging level. If you are registering block with 'stone' material ensure that its block type has baseBlock id 1 to be correctly destroyed by pickaxes.
Parameters
blockID: string | number
block numeric or string id
material: string
material name
optionallevel: number
block's digging level
Returns void
setDestroyLevel
Sets mining level for block.
Parameters
blockID: string | number
block numeric or string id
level: number
mining level
Returns void
setDestroyTime
Sets destroy time for the block with specified id.
Parameters
blockID: string | number
block numeric or string id
time: number
block destroy time
Returns void
setExplosionResistance
Specifies how block resists to the explosions.
Parameters
blockID: string | number
block numeric or string id
resistance: number
integer value, default is 3
Returns void
setFriction
Sets block friction. It specifies how player walks on the block. The higher the friction is, the more difficult it is to change speed and direction.
Parameters
blockID: string | number
block numeric or string id
friction: number
float value, default is 0.6
Returns void
setLightLevel
Sets level of the light emitted by the block.
Parameters
blockID: string | number
block numeric or string id
lightLevel: number
value from 0 (no light) to 15
Returns void
setLightOpacity
Specifies how opaque block is.
Parameters
blockID: string | number
block numeric or string id
lightOpacity: number
Value from 0 to 15 which will be substracted from the light level when the light passes through the block
Returns void
setMapColor
Sets block color when displayed on the vanilla maps.
Parameters
blockID: string | number
block numeric or string id
color: number
map color of the block
Returns void
setRenderAllFaces
Sets rendering of the block faces.
Parameters
blockID: string | number
block numeric or string id
renderAllFaces: boolean
If true, all block faces are rendered, otherwise back faces are not rendered (for optimization purposes). Default is false
Returns void
setRenderLayer
Specifies the layer that is used to render the block.
Parameters
blockID: string | number
block numeric or string id
renderLayer: number
default is 4
Returns void
setRenderType
Sets render type of the block.
Parameters
blockID: string | number
block numeric or string id
renderType: number
default is 0 (full block), use other values to change block's model
Returns void
setRotationFunction
Registers place function for block with rotation.
Parameters
id: string | number
block numeric or string id
optionalhasVertical: boolean
true if the block has vertical facings, false otherwise.
optionalplaceSound: string
Returns void
setSolid
Sets block to be transparent or opaque.
Parameters
blockID: string | number
block numeric or string id
isSolid: boolean
if true, sets block to be opaque.
Returns void
setSoundType
Sets sound type of the block.
Parameters
blockID: string | number
block numeric or string id
sound: Sound
block sound type
Returns void
setTranslucency
Specifies rendering of shadows on the block.
Parameters
blockID: string | number
block numeric or string id
translucency: number
float value from 0 (no shadows) to 1
Returns void
Module for advanced block definition.