-
Notifications
You must be signed in to change notification settings - Fork 34
Lua API: Blocks
Quentin Bazin edited this page Mar 7, 2020
·
4 revisions
Blocks can have the following attributes:
Attribute | Type | Description |
---|---|---|
id* | string | ID of the block without the "mod:" prefix |
label* | string | Label of the block |
on_block_placed | function | Called when the block is placed |
on_block_activated | function | Called when a player right-click the block |
on_tick | function | Called every tick |
harvest_requirements | u8 | Set which tools are more effective |
hardness | float | Hardness of the block, affects mining speed |
is_opaque | bool | Whether or not the block let light pass |
is_light_source | bool | Whether or not the block is a light source |
is_rotatable | bool | Whether or not the block is rotatable |
bounding_box | float[6] | Bounding box of the block {x,y,z,w,d,h} |
draw_type | string | Draw type of the block (see Draw types) |
item_drop | ItemStack | Item stack that is dropped when the block is broken |
color_multiplier | u8[4] | Only grayscale colors are affected by this attribute |
NB: Attributes with a *
means they're mandatory
ItemStack
is a table composed of:
-
id
(string
): item id with the "mod:" prefix -
amount
(u16
): amount in the stack
The currently allowed draw type values are:
solid
xshape
leaves
liquid
glass
Parameters:
-
pos
(vec3
): position of the block -
world
(World
): instance ofServerWorld
Parameters:
-
pos
(vec3
): position of the block -
player
(Player
): current player -
world
(World
): instance of theServerWorld
-
client
(Client
): client that activated the block -
screen_width
(u16
): width of the screen -
screen_height
(u16
): height of the screen -
gui_scale
(u8
): current scaling setting
Parameters:
-
pos
(vec3
): position of the block -
player
(Player
): current player -
chunk
(Chunk
): current chunk -
world
(World
): instance of theServerWorld