Send block data to clients
This commit is contained in:
@@ -4,9 +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.
|
||||
|
||||
Built so far: the importer and Create's imported blocks and items, model `parent` and `x` turns, S0, and stonecutting
|
||||
from S9. 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, R1, R5, S0, S7, and stonecutting from S9. Facts about
|
||||
Create come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts about bworld from its source.
|
||||
|
||||
## Sources
|
||||
|
||||
@@ -230,10 +229,11 @@ Everything here is general, and none of it mentions Create. Each line says which
|
||||
|
||||
### Rendering
|
||||
|
||||
**R1. Client-visible tile data** (P1). A component marks part of a block's tile data for clients, sent with the chunk
|
||||
and again when it changes. Like NeoForge's `getUpdateTag`, but per field, so a fast-changing field doesn't resend the
|
||||
rest. The display item (`set_block_item`, `ClientLevel.block_items`) moves onto it, so there's one way to sync block
|
||||
data.
|
||||
**R1. Client-visible tile data** (P1, built). `block.set_client_data(field, value)` keeps a field of a block's data that
|
||||
clients see too, apart from its server-only `data`. Players get every field with the chunk, then each field again when
|
||||
it's set to something else, like NeoForge's `getUpdateTag` but per field, so a fast-changing field doesn't resend the
|
||||
rest. It's saved, goes with the block, and client scripts read it with `ctx.world.get_client_data`. The display item is
|
||||
its `item` field now, so there's one way to sync block data. R2's visuals will be told when a field changes.
|
||||
|
||||
**R2. Block visuals** (P1). `ctx.render.register_visual(block_id, factory)` in client scripts. A visual is created when
|
||||
its chunk is meshed, updated when the block's client data or states change, and deleted with the block or chunk, like
|
||||
|
||||
Reference in New Issue
Block a user