Hand crank and shafts

This commit is contained in:
2026-10-15 11:45:12 -03:00
parent cedc7725b5
commit a0596ed0ef
27 changed files with 1008 additions and 36 deletions
+20 -5
View File
@@ -5,8 +5,8 @@ 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, 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.
R8, S0, S7, S12, stonecutting from S9, and the start of P1's kinetics: shafts turned by a hand crank. Facts about Create
come from reading `ports/create1.21.1` and `ports/create1.19.3`, and facts about bworld from its source.
## Sources
@@ -123,7 +123,8 @@ shared tags to `c`, which is what bworld calls them. A mod's remap file is where
Block properties (shape, tool, toughness) aren't in any data file: Java mods set them in code. `mod` writes a block for
each blockstate with placeholder properties, and a per-mod table fills them in. For Create that table is
`mods/create/import/blocks.json`.
`mods/create/import/blocks.json`. Built for `blockstate` as `--blocks FILE`: each block's fields in it, like its
`components`, replace the ones the importer would write, and a block it names that isn't made is an error.
**What `model` does today.** It keeps `parent`, since the engine merges parents in when it loads (see
[Parents](docs/modding/resources/models.md#parents)), and remaps it like any id. Minecraft's template parents (`cube`,
@@ -175,8 +176,8 @@ Create 0.5.0.j's data gives 89 tags: 45 of Create's and 44 of Forge's shared one
skipped. Of its 531 stonecutting recipes, 423 are converted. The other 108 cut granite, diorite, deepslate, calcite,
tuff and dripstone, which bworld doesn't have yet. Re-importing once it does brings them in.
**For Create**, `mods/create/import/` keeps the remap file and the commands, and later the block table. Re-running the
import is one command, and hand-written files are never in the folders it writes.
**For Create**, `mods/create/import/` keeps the remap file, the block table and the commands. Re-running the import is
one command, and hand-written files are never in the folders it writes.
**Vanilla ids in recipes.** Create's recipes use 447 distinct Minecraft ids, like dyes, `minecraft:cobblestone` and
`minecraft:netherrack`. Each becomes the bworld id of the same name, or another with the remap file's `ids`. A recipe
@@ -465,6 +466,20 @@ visual makes a `rotating` instance with the axis, rpm and an offset that keeps c
when the block's coordinates on the two axes that aren't its axis add up to an even number, otherwise 11.25° for large
cogs and 0 for the rest. A speed change updates one instance, and nothing else happens per frame.
**As built** (`scripts/kinetics/`, the shaft and the hand crank). `create:kinetic` takes `axis` (the state with x, y or
z) or `facing` (the state with the 6 faces) and `shaft` (`both`, `front` or `back`), and its shared rules place blocks
like `RotatedPillarKineticBlock` and `DirectionalKineticBlock`, lining up with an axle beside them. Connections are only
axle to axle so far. Spreading is `RotationPropagator`'s, with queues: a block's speed is its `speed` client data, and
the block it gets it from and the generator it comes from (`source` and `network`) are tile data. Two things differ:
on_break runs while the block is still there, so the walk after a removal treats its place as empty, and generators that
stop with what turned them start again right after the walk instead of a tick later (`reActivateSource`). Create's
flicker score and its periodic `validateKinetics` aren't ported, since shafts don't tick. `create:hand_crank` turns
while it's clicked, for 10 ticks after each click, the other way while sneaking, and costs hunger by the config's
`crank_hunger`. Its visual turns the half shaft as a `rotating` instance and eases the handle in `on_frame`, like
`HandCrankVisual`. The crank doesn't pop off when its block is taken away yet. It needed three engine additions:
`looking` in `state_for_placement` (`getNearestLookingDirection`), `ctx.blocks` in shared scripts, and
`ctx.world.get_block_ref` for changing another block's data (`getBlockEntity`).
**Chunk borders.** Tile data keeps speeds across unloading. Create tracks unloaded members' stress separately
(`KineticNetwork`'s unloaded stress). Do the same, so a network across an unloaded chunk counts right.