Block
Index
Interfaces
Type Aliases
Functions
- canBeExtraBlock
- canContainLiquid
- convertBlockToItemId
- convertItemToBlockId
- createBlock
- createBlockWithRotation
- createLiquidBlock
- createSpecialType
- getBlockAtlasTextureCoords
- getBlockDropViaItem
- getDestroyTime
- getDropFunction
- getExplosionResistance
- getFriction
- getLightLevel
- getLightOpacity
- getMapColor
- getMaterial
- getNumericId
- getPlaceFunc
- getRenderLayer
- getRenderType
- getTranslucency
- isNativeTile
- isSolid
- registerClickFunction
- registerClickFunctionForID
- registerDropFunction
- registerDropFunctionForID
- registerEntityInsideFunction
- registerEntityInsideFunctionForID
- registerEntityStepOnFunction
- registerEntityStepOnFunctionForID
- registerNeighbourChangeFunction
- registerNeighbourChangeFunctionForID
- registerPlaceFunction
- registerPlaceFunctionForID
- registerPopResourcesFunction
- registerPopResourcesFunctionForID
- setAnimateTickCallback
- setBlockMaterial
- setBlockShape
- setDestroyLevel
- setDestroyLevelForID
- setDestroyTime
- setPrototype
- setRandomTickCallback
- setRedstoneTile
- setShape
- setTempDestroyTime
- setupAsNonRedstoneTile
- setupAsRedstoneEmitter
- setupAsRedstoneReceiver
Interfaces
AnimateTickFunction
Parameters
x: number
y: number
z: number
id: number
block numeric identifier
data: number
block data
Returns void
BlockAtlasTextureCoords
u1
u2
v1
v2
BlockLegacyPrototype
Once upon a time, a new way of registering blocks, however, in current state, either does not work or is undesirable to use.
optionalgetCategory
Unused at all.
Type declaration
Parameters
item: null
Returns number
optionalgetDestroyLevel
Type declaration
Parameters
item: null
Returns number
optionalgetDrop
Type declaration
Parameters
coords: Vector
id: number
data: number
diggingLevel: number
enchant: any
Returns ItemInstanceArray[]
optionalgetEnchant
Unused at all.
Type declaration
Parameters
item: null
Returns number
optionalgetMaterial
Type declaration
Parameters
item: null
Returns number
optionalgetProperties
Unused at all.
Type declaration
Parameters
item: null
Returns object
optionalgetShape
Type declaration
Parameters
item: null
Returns number[]
optionalgetSpecialType
Type declaration
Parameters
item: null
Returns SpecialType
getVariations
Type declaration
Parameters
item: null
Returns BlockVariation[]
optionalinit
Type declaration
Returns void
optionalisEnchanted
Unused at all.
Type declaration
Parameters
item: null
Returns boolean
optionalisStackedByData
Unused at all.
Type declaration
Parameters
item: null
Returns boolean
optionalonItemUsed
optionalonPlaced
Incorrect function, it will considered as BlockLegacyPrototype.getDrop
Type declaration
Parameters
coords: Vector
item: ItemInstance
block: Tile
Returns void
type
BlockVariation
Object used to represent single block variation.
optionalinCreative
If true
, block variation will be added to creative inventory.
optionalname
Variation name, displayed as item name everywhere.
texture
Variation textures, array containing pairs of texture name and data.
Texture file should be located in items-opaque folder and it's name
should be in the format: "name_data"
, e.g. if the file name is
"ingot_copper_0"
, you should specify an array ["ingot_copper", 0]
.
ClickFunction
Parameters
coords: ItemUseCoordinates
item: ItemInstance
block: Tile
player: number
Returns void
DropFunction
Parameters
blockCoords: ItemUseCoordinates
blockID: number
blockData: number
diggingLevel: number
enchant: EnchantData
item: ItemInstance
region: BlockSource
Returns ItemInstanceArray[]
EntityInsideFunction
EntityStepOnFunction
LiquidDescriptor
Object to specify needed params for custom liquid block.
optionalbucket
Optional section, if added, this will create fully functional (including dispensers) bucket items.
Type declaration
optionalemptyId?: number
An item that can capture liquid (including when using a dispenser and obtaining it with your hand).
optionalemptySound?: string
optionalfillSound?: string
optionalid?: string
Optional, name ID for bucket item.
optionalisTech?: boolean
If
true
, bucket cannot be obtained from creative inventory.optionalname?: string
Name of the filled with liquid bucket to be displayed.
texture: { meta?: number; name: string }
optionalmeta?: number
name: string
flowing
Object to describe dynamic liquid block texture, and name ID additionally.
Type declaration
optionalid?: string
Optional, name ID for dynamic liquid block.
texture: [string, number]
Unlike static liquid blocks, for dynamic ones, texture must look like
"texture.liquid.png"
(with no index).
optionalinCreative
Whether to add liquid block to creative inventory.
optionalisRenewable
True if the liquid will be renewable, as water.
optionalmodelTextures
name
Name of the block to be displayed.
still
Object to describe static liquid block texture, and name ID additionally.
Type declaration
optionalid?: string
Optional, name ID for static liquid block.
texture: [string, number]
For static liquid block, textures must be of standard block texture format.
optionaltickDelay
Delay between liquid spreading steps in ticks.
optionaluiTextures
NeighbourChangeFunction
Parameters
coords: Vector
block: Tile
changedCoords: Vector
region: BlockSource
Returns void
PlaceFunction
Parameters
coords: ItemUseCoordinates
item: ItemInstance
block: Tile
player: number
region: BlockSource
Returns void | Vector
PopResourcesFunction
Parameters
blockCoords: Vector
block: Tile
region: BlockSource
explosionRadius: number
i: number
Returns void
RandomTickFunction
Parameters
x: number
y: number
z: number
id: number
block numeric identifier
data: number
block data
region: BlockSource
block source instance
Returns void
SpecialType
Special types are used to set properties to the block. Unlike items, blocks properties are defined using special types, due to old Inner Core's block IDs limitations.
optionalbase
Vanilla block ID to inherit some of the properties.
optionalcan_be_extra_block
Whether or not block may overlay different block, like water overlapping fillable blocks.
optionalcan_contain_liquid
Whether or not block may filled by water bucket or other custom fillable liquids.
optionalcolor_source
Makes block use biome color source when displayed on the vanilla maps.
optionaldestroytime
Specifies the time required to destroy the block, in ticks.
optionalexplosionres
Specifies how block resists to the explosions.
optionalfriction
Specifies how player walks on this block. The higher the friction is, the more difficult it is to change speed and direction.
optionallightlevel
If non-zero value is used, the block emits light of that value. Default is no lighting, use values from 1 to 15 to set light level.
optionallightopacity
Specifies how opaque the block is. Default is transparent, use values from 1 to 15 to make the block opaque.
optionalmapcolor
Block color when displayed on the vanilla maps.
optionalmaterial
Block material constant to be inherited.
optionalname
Unique string identifier of the SpecialType.
optionalrenderallfaces
If true
, all block faces are rendered, otherwise back faces are not
rendered, like for glass.
optionalrenderlayer
Specifies the layer that is used to render the block.
optionalrendertype
Sets render type of the block. Default is full block, use other values to change block's shape.
optionalsolid
If true
, the block is not transparent.
optionalsound
Specifies sounds of the block, one of Block.Sound.
optionaltranslucency
If non-zero value is used, the shadows will be rendered on the block. Default is zero, allows float values from 0 to 1.
Type Aliases
ColorSource
Sound
Functions
canBeExtraBlock
Parameters
id: number
Returns boolean
Whether the block of given ID can be an extra block (it's the block that can be set inside of another blocks, for ex. water and other liquids).
canContainLiquid
Parameters
id: number
Returns boolean
Whether the block of given ID can contain liquid inside.
convertBlockToItemId
Converts tile ID to the block ID.
Parameters
id: number
numeric tile ID
Returns number
Numeric block ID corresponding to the given tile ID.
convertItemToBlockId
Converts block ID to the tile ID.
Parameters
id: number
numeric tile ID
Returns number
Numeric tile ID corresponding to the given block ID.
createBlock
Creates new block using specified params.
Parameters
nameID: string
string ID of the block. You should register it via IDRegistry.genBlockID call first
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 | SpecialType
Block.SpecialType object, either java-object returned by Block.createSpecialType or js-object with the required properties, you can also pass special type name, if the type was previously registered
Returns void
createBlockWithRotation
Creates new block using specified params, creating four variations for each of the specified variations to be able to place it facing flayer with the front side and defines the appropriate behavior. Useful for different machines and mechanisms.
Parameters
nameID: string
string ID of the block. You should register it via IDRegistry.genBlockID call first
defineData: BlockVariation[]
array containing all variations of the block. Each variation corresponds to four block data values, data values are assigned according to variations order
optionalblockType: string | SpecialType
SpecialType object, either java-object returned by Block.createSpecialType or js-object with the required properties, you can also pass special type name, if the type was previously registered
Returns void
createLiquidBlock
Creates new liquid block using specified params.
Parameters
nameID: string
string ID of the block. You should register it via IDRegistry.genBlockID call first
defineData: LiquidDescriptor
object containing all needed params to describe your custom liquid block. There you can specify custom name IDs for static and dynamic liquid blocks separately, and if you do this, you have to register those name IDs via IDRegistry.genBlockID before using them
optionalblockType: string | SpecialType
SpecialType object, either java-object returned by Block.createSpecialType or js-object with the required properties, you can also pass special type name, if the type was previously registered
Returns void
createSpecialType
Creates a new special type using specified params and optionally registers it by name.
Parameters
description: SpecialType
special type properties
optionalname: string
string name to register the special type
Returns string
Special type name.
getBlockAtlasTextureCoords
Parameters
str: string
int: number
Returns BlockAtlasTextureCoords
getBlockDropViaItem
Gets drop for the specified block. Used mostly by Core Engine's ToolAPI, though, can be useful in the mods, too.
Parameters
block: Tile
block info
item: ItemInstance
item that was (or is going to be) used to break the block
coords: Vector
coordinates where the block was (or is going to be) broken
region: BlockSource
Returns ItemInstanceArray[]
Block drop, the array of arrays, each containing three values: ID, count and data respectively.
getDestroyTime
Parameters
numericId: number
numeric block ID
Returns number
Destroy time of the block, in ticks.
getDropFunction
Parameters
id: number
Returns Block.DropFunction
Drop function of the block with given numeric ID.
getExplosionResistance
Parameters
numericId: number
numeric block ID
Returns number
Explosion resistance of the block.
getFriction
Parameters
numericId: number
numeric block ID
Returns number
Friction of the block.
getLightLevel
Parameters
numericId: number
numeric block ID
Returns number
Light level, emitted by block, from 0 to 15.
getLightOpacity
Parameters
numericId: number
numeric block ID
Returns number
Light opacity of the block, from 0 to 15.
getMapColor
Parameters
id: number
numeric block ID
Returns number
Color specified block is displayed on the vanilla maps.
getMaterial
Parameters
id: number
Returns number
Given block's material numeric ID.
getNumericId
Parameters
id: string | number
string ID of the block
Returns number
Block numeric ID by it's string ID or just returns it's numeric ID if input was a numeric ID.
getPlaceFunc
Parameters
id: number
Returns Block.PlaceFunction
Place function of the block with given numeric ID, or undefined if it was not specified.
getRenderLayer
Parameters
numericId: number
numeric block ID
Returns number
Render layer of the block.
getRenderType
Parameters
numericId: number
numeric block ID
Returns number
Render type of the block.
getTranslucency
Parameters
numericId: number
numeric block ID
Returns number
Translucency of the block.
isNativeTile
Parameters
id: number
numeric block ID
Returns boolean
true
, if the specified block ID is a vanilla block.
isSolid
Parameters
numericId: number
numeric block ID
Returns boolean
true
, if block is solid,false
otherwise.
registerClickFunction
Defines custom behavior when the player clicks on the block with definite ID.
Parameters
id: string | number
block's numeric or string ID
func: ClickFunction
function that will be called when the player clicks the block with given ID
Returns void
registerClickFunctionForID
Defines custom behavior when the player clicks on the block with definite ID.
Parameters
numericId: number
block's numeric ID
func: ClickFunction
function that will be called when the player clicks the block with given ID
Returns void
registerDropFunction
Registers function used by Core Engine to determine block drop for the specified block ID.
Parameters
id: string | number
tile string or numeric ID
dropFunc: DropFunction
function to be called to determine what will be dropped when the block is broken
optionallevel: number
if level is specified and is not 0, digging level of the block is additionally set
Returns boolean
true
, if specified string or numeric ID exists and the function was registered correctly,false
otherwise.
registerDropFunctionForID
Registers function used by Core Engine to determine block drop for the specified block ID.
Parameters
numericId: number
tile numeric ID
dropFunc: DropFunction
function to be called to determine what will be dropped when the block is broken
optionallevel: number
if level is specified and is not 0, digging level of the block is additionally set
Returns boolean
true
, if specified string or numeric ID exists and the function was registered correctly,false
otherwise.
registerEntityInsideFunction
Registers function on entity being inside the block. Can be used to create portals.
Parameters
id: string | number
tile string or numeric ID
func: EntityInsideFunction
function to be called when entity is inside the block
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerEntityInsideFunctionForID
Registers function on entity being inside the block. Can be used to create portals.
Parameters
numericId: number
tile string or numeric ID
func: EntityInsideFunction
function to be called when entity is inside the block
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerEntityStepOnFunction
Registers function on entity step on the block.
Parameters
id: string | number
tile string or numeric ID
func: EntityStepOnFunction
function to be called when entity step on the block
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerEntityStepOnFunctionForID
Registers function on entity step on the block.
Parameters
numericId: number
tile numeric ID
func: EntityStepOnFunction
function to be called when entity step on the block
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerNeighbourChangeFunction
Registers function on neighbour blocks updates.
Parameters
id: string | number
tile string or numeric ID
func: NeighbourChangeFunction
function to be called when neighbour block updates
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerNeighbourChangeFunctionForID
Registers function on neighbour blocks updates.
Parameters
numericId: number
tile numeric ID
func: NeighbourChangeFunction
function to be called when neighbour block updates
Returns boolean
true
, if the function was registered correctly,false
otherwise.
registerPlaceFunction
Registers function to be called when the block is placed in the world.
Parameters
id: string | number
block numeric or string ID
func: PlaceFunction
function to be called when the block is placed in the world
Returns void
registerPlaceFunctionForID
Registers function to be called when the block is placed in the world.
Parameters
numericId: number
block numeric ID
func: PlaceFunction
function to be called when the block is placed in the world
Returns void
registerPopResourcesFunction
Registered function used by Core Engine to determine block drop for the specified block ID.
Parameters
id: string | number
tile string or numeric ID
func: PopResourcesFunction
function to be called when a block in the world is broken by environment (explosions, pistons, etc.)
Returns boolean
true
, if specified string or numeric ID exists and the function was registered correctly,false
otherwise.
registerPopResourcesFunctionForID
Registered function used by Core Engine to determine block drop for the specified block ID.
Parameters
numericId: number
tile numeric ID
func: PopResourcesFunction
function to be called when a block in the world is broken by environment (explosions, pistons, etc.)
Returns boolean
true
, if specified string or numeric ID exists and the function was registered correctly,false
otherwise.
setAnimateTickCallback
Makes block invoke callback randomly depending on game speed. Occurs more often then Block.setRandomTickCallback and only if the block is not far away from player.
Parameters
id: number
block ID to register
callback: AnimateTickFunction
function to be called
Returns void
setBlockMaterial
Registers material and digging level for the specified block.
Parameters
nameID: string | number
block numeric or string ID
material: string
material name
level: number
block's digging level
Returns boolean
true
if specified string or numeric ID exists,false
otherwise.
setBlockShape
Sets block box shape, like Block.setShape, but in voxel objects for each coordinate.
Parameters
id: number
block numeric ID
pos1: Vector
block lower corner position
pos2: Vector
block upper conner position
optionaldata: number
block optional data (or -1)
Returns void
setDestroyLevel
Registers a default destroy function for the specified block, considering it's digging level.
Parameters
id: string | number
tile string or numeric ID
level: number
digging level of the block
optionalresetData: boolean
if true, the block is dropped with data equals to 0
Returns void
setDestroyLevelForID
Registers a default destroy function for the specified block, considering it's digging level.
Parameters
numericId: number
tile numeric ID
level: number
digging level of the block
optionalresetData: boolean
if true, the block is dropped with data equals to 0
Returns void
setDestroyTime
Sets destroy time for the block with specified ID.
Parameters
nameID: string | number
string or numeric block ID
time: number
destroy time for the block, in ticks
Returns void
setPrototype
Parameters
nameID: string
Prototype: BlockLegacyPrototype
Returns void
setRandomTickCallback
Makes block invoke callback randomly depending on game speed.
Parameters
id: number
block ID to register for random ticks
callback: RandomTickFunction
function to be called on random block tick
Returns void
setRedstoneTile
Makes block accept redstone signal.
Parameters
nameID: string | number
block numeric or string ID
data: number
block data, currently not used
isRedstone: boolean
if true, the redstone changes at the block will notify the "RedstoneSignal" callback
Returns void
setShape
Sets block box shape via scalar coordinates, usually presented in voxels (1/16 of block).
Parameters
id: number
block numeric ID
x1: number
y1: number
z1: number
x2: number
y2: number
z2: number
optionaldata: number
block optional data (or -1)
Returns void
setTempDestroyTime
Temporarily sets destroy time for block, saving the old value for the further usage.
Parameters
numericId: number
numeric block ID
time: number
new destroy time in ticks
Returns void
setupAsNonRedstoneTile
Removes all the redstone functionality from the block.
Parameters
nameID: string | number
block numeric or string ID
Returns void
setupAsRedstoneEmitter
Makes block emit redstone signal.
Parameters
nameID: string | number
block numeric or string ID
connectToRedstone: boolean
if true, redstone wires will connect to the block
Returns void
setupAsRedstoneReceiver
Makes block receive redstone signals via "RedstoneSignal" callback.
Parameters
nameID: string | number
block numeric or string ID
connectToRedstone: boolean
if true, redstone wires will connect to the block
Returns void
Module used to create and manipulate blocks. The difference between terms "block" and "tile" is in it's usage: blocks are used in the inventory, tiles are placed in the world and have different IDs for some vanilla blocks. Use Block.convertBlockToItemId and Block.convertItemToBlockId to perform conversion between block and it item variation.