Blocks interacting on the world api

This commit is contained in:
2026-10-15 12:49:44 -03:00
parent 7faa070d83
commit b43e8fe8b8
15 changed files with 493 additions and 28 deletions
+13 -2
View File
@@ -5,7 +5,7 @@ redstone, contraptions, trains, equipment, decoration and schematics. It aims to
possible, and to stay fast on both the server and the client when a world has thousands of moving parts.
Built so far: the importer and Create's imported blocks and items, R1, R2, R3 (`transformed` and `rotating`), R4, R5,
R8, S0, S7, S12, stonecutting from S9, the start of P1's kinetics (shafts and cogwheels turned by a hand crank), and
R8, S0, S4, S7, S12, stonecutting from S9, the start of P1's kinetics (shafts and cogwheels turned by a hand crank), and
Create's pressing recipes. Facts about Create come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts
about bworld from its source.
@@ -333,7 +333,7 @@ fluid stacks with amounts in millibuckets, a `"fluids"` capability, and fluid co
torch, repeater, comparator, lamp. Create reads and makes signals in about 40 blocks, and bworld has no redstone at all
today.
**S4. Machines acting on the world** (P3).
**S4. Machines acting on the world** (P3, built).
- `liquid_flow(x, y, z)` (wraps `common/physics.ts`), for water wheels and fans.
- Item entities in a box, which can be changed and removed, for the press, fans and belts picking items up.
@@ -341,6 +341,17 @@ today.
- Breaking a block over time with progress shown, and its drops, for drills and saws.
- A fake player using an item on a block, for the deployer (`DeployerFakePlayer`).
As built, all in `ctx.world` (see the modding docs for each): `liquid_flow`, `entities_in(from, to, type?)` with
`EntityRef.get_item`, `set_item`, `velocity` and `push`, `spawn_item` for an item lying still where it's put (the
press's extra results), and `player.push`, which is sent to their client since it moves them. `set_break_progress` shows
cracks to the players who have the chunk, sending only a change of stage, and `ctx.blocks.toughness` gives what breaking
time is measured against. `break_block` takes `harvest` (drops what the right tool would, like
`BlockHelper.destroyBlockAs` ignoring tool requirements) and `collect` (returns the drops without dropping them), and
returns the drops. `use_item_on(item, x, y, z, face)` runs a player's whole right click (the block's `on_interact`, the
item's `on_use`, placing) as one `[machine]` player that's never online, standing in front of the face, and returns what
it holds after and anything it was given. The deployer's left click (punching and breaking) isn't there yet, and neither
is a fan pushing players on their client every tick, which Create does on both sides.
**S5. Scripted entities** (P7). Mods can define an entity's behaviour in server scripts (tick, data, interaction) and
how it's drawn in client scripts. Needed for the contraption entity, seats, potato cannon projectiles, trains and
packages.