This commit is contained in:
2026-11-16 23:49:42 -03:00
parent 94b0e3789c
commit eedaa955f6
13 changed files with 148 additions and 2 deletions
+16
View File
@@ -73,6 +73,7 @@ the block and the component.
| `on_state_change(block, params, before)` | Its own states change without it being replaced, by `set_state` or a rule. See [Changes](#changes). | |
| `on_scheduled_tick(block, params)` | A tick it asked for comes. See [Scheduled Ticks](#scheduled-ticks). | |
| `on_entity_stand(block, params, entity)` | An entity standing on it moves, every tick it does. See [Entities on It](#entities-on-it). | |
| `on_entity_inside(block, params, entity)` | An entity whose box is in it moves, every tick it does. See [Entities on It](#entities-on-it). | |
| `fluid_handler(block, params, face?)` | Something reaches for its tanks from `face`. See [Fluid Handlers](../resources/fluids.md#fluid-handlers). | a `FluidHandler`, or `undefined` |
| `export_data(block, params)` | It goes into a schematic. See [Schematics](../misc/schematics.md#block-data). | its data for the schematic |
@@ -98,6 +99,21 @@ ctx.components.register_block("create:basin", {
});
```
`on_entity_inside` runs every tick an entity moves while its box is in the block, like NeoForge's `entityInside`, for
each block its box is in. Players move on their own clients, so for them it runs after each move their client sends, and
they come as an `EntityRef` of type `cubi:player`: `ctx.players.get(entity.id)` gives the
[`Player`](../entities/players.md). Being against a block's side isn't being in it. It runs whatever the block's shape,
so a block that only cares about part of itself checks the entity's `position`. Dangerous Business's death block kills
whatever walks or falls into it:
```ts
ctx.components.register_block("dangerous_business:death", {
on_entity_inside(_block, _params, entity) {
entity.kill("death_block");
},
});
```
### Changes
`on_neighbor_change` is the server's side of the [rule](#neighbors) with the same name, like NeoForge's