BlockResource
Hierarchy
- BlockBase
- BlockResource
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
id: string
resourceName: string
miningLevel: number
Returns BlockResource
Properties
blockMaterial
Block material
blockType
Block properties
category
Item category
readonlyid
Block numeric id
isDefined
Flag that defines whether block for this instance was defined or not.
miningLevel
Block mining level
shapes
readonlystringID
Block string id
variations
Array of block variations
Methods
addVariation
Adds variation for the block.
Parameters
name: string
item name
texture: [string, number][]
block texture
optionalinCreative: boolean
true if should be added to creative inventory
Returns void
createBlock
Registers block in game.
Returns void
getDrop
Method used to get drop from the block
Parameters
coords: Vector
block coords
block: Tile
block id and data
level: number
tool mining level
enchant: EnchantData
tool enchant data
item: ItemStack
item instance
region: BlockSource
BlockSource object
Returns ItemInstanceArray[]
drop items array
onBreak
Method called when the block is destroyed by explosion or environment.
Parameters
coords: Vector
block coords
block: Tile
block id and data
region: BlockSource
BlockSource object
Returns void
registerTileEntity
Registers TileEntity prototype for this block.
Parameters
prototype: TileEntityPrototype
TileEntity prototype
Returns void
setBaseBlock
Sets the block type of another block, which allows to inherit some of its properties.
Parameters
baseBlock: number
id of the block to inherit type
Returns void
setBlockColorSource
Makes block use biome color when displayed on the vanilla maps.
Parameters
colorSource: ColorSource
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
material: string
material name
optionallevel: number
block digging level
Returns void
setCategory
Sets item category.
Parameters
category: number
item category, should be integer from 1 to 4.
Returns void
setDestroyTime
Sets destroy time for the block.
Parameters
destroyTime: number
block destroy time
Returns void
setExplosionResistance
Specifies how block resists to the explosions.
Parameters
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
friction: number
float value, default is 0.6
Returns void
setLightLevel
Sets level of the light emitted by the block.
Parameters
lightLevel: number
value from 0 (no light) to 15
Returns void
setLightOpacity
Specifies how opaque block is.
Parameters
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
color: number
map color of the block
Returns void
setRarity
Sets item rarity.
Parameters
rarity: number
one of
EnumRarity
values
Returns void
setRenderAllFaces
Sets rendering of the block faces.
Parameters
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
renderLayer: number
default is 4
Returns void
setRenderType
Sets render type of the block.
Parameters
renderType: number
default is 0 (full block), use other values to change block's model
Returns void
setShape
Sets block box shape.
Parameters
x1: number
y1: number
z1: number
x2: number
y2: number
z2: number
optionaldata: number
sets shape for one block variation if specified and for all variations otherwise
Returns void
setSolid
Sets block to be transparent or opaque.
Parameters
isSolid: boolean
if true, sets block to be opaque.
Returns void
setSoundType
Sets sound type of the block.
Parameters
sound: Sound
block sound type
Returns void
setTranslucency
Specifies rendering of shadows on the block.
Parameters
translucency: number
float value from 0 (no shadows) to 1
Returns void
Base class for block