Cache ticking blocks
This commit is contained in:
@@ -4,8 +4,8 @@ A plan for porting all of Create to bworld as a mod, `mods/create`: its kinetics
|
||||
redstone, contraptions, trains, equipment, decoration and schematics. It aims to do this with as little hand work as
|
||||
possible, and to stay fast on both the server and the client when a world has thousands of moving parts.
|
||||
|
||||
Nothing here is built yet. Facts about Create come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts
|
||||
about bworld from its source.
|
||||
Built so far: the importer and Create's imported blocks and items, model `parent` and `x` turns, and S0. Facts about
|
||||
Create come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts about bworld from its source.
|
||||
|
||||
## Sources
|
||||
|
||||
@@ -275,11 +275,11 @@ categories (a press pressing over its recipe, like `compat/jei`), goggles and po
|
||||
|
||||
### Server and Gameplay
|
||||
|
||||
**S0. Ticking only what ticks** (P1). `GameServer.tick` walks every tile in the world to find the ones that tick
|
||||
([game_server.ts:376](server/game/game_server.ts#L376)). With thousands of Create blocks with tile data, that's the
|
||||
first thing to fix. Keep a set of ticking tiles per chunk, updated when tiles are added or removed, and let a component
|
||||
turn ticking off and on for one block (`block.set_ticking(false)`, like returning no ticker in NeoForge). A shaft has
|
||||
tile data and never ticks. A press only ticks while pressing.
|
||||
**S0. Ticking only what ticks** (P1, built). `ServerWorld` keeps the tiles that tick per chunk, so `GameServer.tick`
|
||||
only looks at the chunks near players instead of every tile in the world. A component turns ticking off and on for one
|
||||
block with `block.set_ticking(false)`, or `ctx.world.set_block_ticking(x, y, z, true)` from elsewhere, like returning no
|
||||
ticker in NeoForge, and it stays off through saving. A shaft has tile data and never ticks. A press only ticks while
|
||||
pressing.
|
||||
|
||||
**S1. Block capabilities** (P3). `ctx.capabilities.register_block("items", block_id, (block, side) => handler)` and
|
||||
`ctx.world.capability("items", x, y, z, side)`, like NeoForge's `BlockCapability`. Handlers insert, extract, report
|
||||
|
||||
Reference in New Issue
Block a user