Merge branch 'main' into debugging-client
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
Callbacks specified in block script.
|
||||
|
||||
> [!WARNING]
|
||||
> events such as on_block_tick, on_block_present, and on_block_removed
|
||||
> can cause performance issues if used carelessly or excessively.
|
||||
|
||||
```lua
|
||||
function on_placed(x, y, z, playerid)
|
||||
```
|
||||
@@ -53,6 +57,21 @@ function on_block_tick(x, y, z, tps: number)
|
||||
Called tps (20 / tick-interval) times per second for a block.
|
||||
Use 1/tps instead of `time.delta()`.
|
||||
|
||||
```lua
|
||||
function on_block_present(x, y, z)
|
||||
```
|
||||
|
||||
Called for a specific block when it appears in the world (generated/loaded/placed).
|
||||
The call occurs within a time period that may depend on the event queue load.
|
||||
Under light load, it occurs during the first tick interval of the block.
|
||||
on_block_tick is not called until the event is called.
|
||||
|
||||
```lua
|
||||
function on_block_removed(x, y, z)
|
||||
```
|
||||
|
||||
Called when chunk containing the block unloads.
|
||||
|
||||
```lua
|
||||
function on_player_tick(playerid: int, tps: int)
|
||||
```
|
||||
|
||||
@@ -201,6 +201,14 @@ Here, *color* can be specified in the following ways:
|
||||
| data:mul(*color* or Canvas) | multiplies a color by the specified color or canvas |
|
||||
| data:add(*color* or Canvas) | adds a color or another canvas to a color |
|
||||
| data:sub(*color* or Canvas) | subtracts a color or another canvas to a color |
|
||||
| data:encode(format: str) | encodes image to specified format and returns bytearray |
|
||||
|
||||
To decode a byte array into a Canvas, use the static method:
|
||||
```lua
|
||||
Canvas.decode(data: Bytearray, format: str) -> Canvas
|
||||
```
|
||||
|
||||
Currently, only png is supported.
|
||||
|
||||
## Inline frame (iframe)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user