Match weighted model choice and multipart random consumption

This commit is contained in:
Ludovic Marie
2026-10-06 21:31:55 +02:00
parent 1d0b537a0a
commit f286aa24e1
8 changed files with 468 additions and 4 deletions
+16 -2
View File
@@ -136,8 +136,7 @@ covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total,
`BlockStateModelDispatcher.CODEC` as the pinned loader. The Rust representation
preserves single versus weighted variants, all three quarter-turn axes, UV-lock
flags, positive weights and total-weight limits, ordered selectors, nested
AND/OR conditions and per-term negation. Random draw consumption and transformed
baking remain separate work.
AND/OR conditions and per-term negation. Transformed baking remains separate work.
```sh
python3 tools/test_blockstate_model_parity.py
@@ -161,6 +160,21 @@ matches 221,261 output lines against each authenticated client/server JAR.
python3 tools/test_blockstate_binding_parity.py
```
`CompiledChoices` prepares cumulative weights once per definition and shares
those choices across bound states. Selecting an ordinary single variant consumes
no random draw; a weighted singleton still does. Multipart collection draws a
seed even for an empty subset and resets the same stream before each chosen
part. The [native choice comparison](../benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json)
uses actual `WeightedVariants.collectParts` and `MultiPartModel.collectParts`
with inert observable leaves. All seven distinct bundled weight patterns,
synthetic large weights and random multipart graphs produce matching selections
and subsequent random values: 6,960 fixtures, 111,360 collections, both legacy
and xoroshiro streams. This does not yet bake or render the selected models.
```sh
python3 tools/test_model_choice_parity.py
```
The sprite animation module reproduces the pinned metadata codec's integer
conversion, strict primitive types, optional null fields and frame dimensions.
It preserves repeated frames, filters out-of-image frame indices, and treats
+3 -2
View File
@@ -22,8 +22,9 @@ also include parent/texture resolution over 5,648 roots and cuboid baking over
models and UV locking remain unfinished. Blockstate resource decoding now
matches all 1,288 bundled definitions and 1,351 synthetic cases; registry
binding now also matches native selection across registered and special
item-frame states. Weighted random selection, transformed baking and renderer
integration remain unfinished. The native renderer now draws an
item-frame states. Weighted selection and multipart random draw consumption
also match native traces. Transformed baking and renderer integration remain
unfinished. The native renderer now draws an
inspection gallery from the decoded/resolved/baked models, including binary
cutouts and stepped lantern animation; these are not yet gameplay blocks.
Animation metadata, frame sequences and tick-state selection now have native