1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
//! **What a block state does to a body that walks into it** (spec-0056) — the
//! one authority, for every crate in this workspace.
//!
//! One question: *given a vanilla block state, may a body occupy its cell, may a
//! body stand on it, and if so at what height?* Every walk in this repository
//! asks it — `delvec`'s route proofs, the grammar back end's contract gates, the
//! admission pipeline's light probe — and until spec-0056 each of them answered
//! it privately. Three copies, measured disagreeing in both directions: the
//! grammar walk read *air or a skull* and called a torch a wall; the light probe
//! kept a nine-id list that called open water walkable; `delvec` alone had a real
//! collision table and could not lend it to either.
//!
//! # Why this module is in `delvewright-dsl`
//!
//! The same argument that placed [`crate::metrics::step_allowed`], and it has two
//! halves.
//!
//! *Reachability.* Two readers ask this table the same question and share no
//! dependency edge with each other: the engine (`delvec::schem`'s walk,
//! `delvec::grammar`'s contract checker, the compiler's navigation model) and
//! the prefab generators, which are a workspace of their own that may not depend
//! on `delvec`. `delvewright-dsl` is the one crate both can depend on, and both
//! do — the generators through `prefab-invariants`, which re-exports this
//! module under the name their invariants already spell.
//!
//! *Object class.* A collision box is a fact about **a vanilla block state under
//! the pinned game version** (ADR-0009, Minecraft Java 1.21.11) — the same kind of
//! pinned-physics fact, in the same sixteenths, as the auto-step and jump-apex
//! budgets already in [`crate::metrics`]. [`collision_top_16`] is what a correct
//! rise measurement is made *of*: `metrics` says how far a body may climb, this
//! module says from what height to what height.
//!
//! # The rule, in one table
//!
//! [`Collision`] is the classification and [`collision_class`] computes it. Its
//! three answers are what a walk needs and all a walk gets:
//!
//! | class | [`Collision::passes_body`] | [`Collision::supports_body`] | [`Collision::floor_top_16`] |
//! |---|---|---|---|
//! | [`Collision::Air`] | yes | no | — |
//! | [`Collision::Thin`] (top < 8/16) | yes | no | — (the body rests on the block below) |
//! | [`Collision::PartialFloor`] (8..16) | no | yes | the measured top |
//! | [`Collision::FullCube`] | no | yes | 16 |
//! | [`Collision::TallBarrier`] (fence, wall) | no | **no** | — |
//! | [`Collision::FenceGate`] | **yes** | no | — |
//! | [`Collision::Fluid`] | no | no | — |
//!
//! Two rows are not the naive complement of each other, and that is the whole
//! reason there are two columns. A **fluid** cell is a cell whose water or lava
//! the *block* brings — a free `water`/`lava` block, and equally a `seagrass`
//! tuft or a `kelp` stem, whose vanilla block carries a water source in its own
//! cell ([`is_submerged_by_nature`]). A **tall barrier** is 1.5 blocks on a 1-block
//! cell: a body neither passes through it nor reaches its top face by jumping. A
//! **fence gate** is the mirror: adventure mode permits the right-click that
//! opens it, so a body gets through — and for a *closure* claim a gate was never
//! a seal anyway, so reading it as a hole is the sound direction. A **fluid** is
//! neither, from the other side: spec-0038 forbids a route crediting water, and
//! nothing stands on a surface.
//!
//! Sub-8/16 is [`THIN_HEIGHT_16`], and it is not a rounding: vanilla's auto-step
//! is 0.6 blocks ([`crate::metrics::MAX_AUTO_STEP_16`] = 9/16), so a carpet, a
//! shallow snow drift, a candle or a pressure plate is stepped **over** rather
//! than onto and never constitutes a floor level of its own.
//!
//! # What one boolean cannot carry, said out loud
//!
//! A walk's `passable` answers for a body *and* for a sightline, and for the
//! class this module changed most — empty collision — the two agree: glow lichen
//! neither collides nor occludes. They part for partial-height blocks, where a
//! slab stops a body and not an eye. This module answers the **body** question;
//! a caller asking about a sightline gets the full-cube reading, which refuses
//! claims it should sometimes grant. That is the refusing direction, and it is
//! recorded here rather than hidden (spec-0056 §3.3). Splitting the two needs a
//! second per-cell answer with its own conservative direction per claim sign, and
//! that surface is not proposed.
//!
//! # The direction of every error here is stated per entry
//!
//! Anything this module does not recognise is a [`Collision::FullCube`], which
//! **over-blocks**: it can only make a walk refuse a step vanilla admits, never
//! admit one vanilla refuses. So a block whose shape has not been read out of the
//! pinned game is left out on purpose rather than guessed at, and the places that
//! happens say so ([`is_no_collision_fixture`]).
/// A full block's collision height in sixteenths — the unit [`collision_top_16`]
/// reports in. Vanilla builds every partial collision box out of sixteenths, so
/// integer sixteenths represent every case exactly (no float ordering, ADR-0006).
pub const FULL_HEIGHT_16: u8 = 16;
/// Below this collision height a block is **stepped over, not onto**: the walker's
/// feet stay on whatever supports it. 8/16 = half a block, the slab step. Anything
/// thinner (carpet 1/16, a candle 6/16, a 1–4-layer snow drift ≤ 6/16) is under the
/// vanilla 0.6-block auto-step, so modelling it as a floor *level* of its own would
/// be noise; modelling it as a full cube is a lie.
pub const THIN_HEIGHT_16: u8 = 8;
/// The bare block id of a (possibly blockstate-carrying) block name: strips a
/// trailing `[state]` / `{nbt}` suffix, keeping the namespace
/// (`minecraft:oak_slab[type=top]` → `minecraft:oak_slab`).
///
/// Every classifier below matches on this, and the state-sensitive ones read the
/// property they need with [`state_value`]. Waterlogging, slab halves and
/// snow-layer counts are block *state*, and a model that throws the state away
/// cannot tell a half-step from a full cube.
/// The value of blockstate property `key` in an `id[k=v,…]` block name, or
/// `None` when the name carries no state or lacks that property.
/// The namespace-free bare id (`minecraft:oak_slab[type=top]` → `oak_slab`).
///
/// Public because the namespace is optional everywhere a human writes a block:
/// a prefab palette always carries `minecraft:`, an author's `fill-region` block
/// is a hand-written string, and both are legal. Every classifier here goes
/// through this so the two spellings cannot get different answers.
/// The air block variants that count as "no block" — passable, transparent, and
/// never a floor.
///
/// Namespace-insensitive, unlike the predicate this replaced: a bare `air` in a
/// hand-written `fill-region` is the same block as `minecraft:air`, and a
/// namespace-sensitive reading classified it by the full-cube default, i.e. as
/// floor a route proof would walk on.
/// Whether a cell's block is a **free fluid** — water or lava occupying the whole
/// cell with no host block. **The one answer to "is this block id a fluid"** in
/// this workspace.
///
/// What it covers, and why each case is the way it is:
/// - **Block state is irrelevant.** A flowing `minecraft:water[level=3]` answers
/// the same as a source. Both leave a body swimming rather than standing, which
/// is the only question a collision model asks; the *reach* of a flow is a
/// world question, not this predicate's.
/// - **So is the namespace**, and that is not cosmetic: a bare `water` passes DSL
/// block validation and is emitted verbatim, and a namespace-sensitive
/// comparison would read it as an ordinary solid and prove a floor made of it.
/// - **`minecraft:lava` counts.** Nothing stands on lava either, and a model that
/// answered only for water would prove a lava surface walkable.
/// - **A waterlogged block does NOT count.** `oak_stairs[waterlogged=true]` is a
/// cell occupied by its *host* block — solid, standable, and simultaneously a
/// flood source for its neighbours. Folding it in here would delete a floor the
/// game plainly has.
/// Whether a block **fills its own cell with water by nature** — a plant or a
/// column whose block has no `waterlogged` property to set because its cell is
/// unconditionally a water source.
///
/// This is not [`is_fluid`]'s question and it is not the waterlogging one
/// either, which is why it is a third predicate rather than an arm of one of
/// them. [`is_fluid`] asks whether the cell holds a *free* fluid with no host
/// block; waterlogging is a block *state* an author sets on an ordinary solid.
/// These ids are neither: each has a host block, the host has an empty collision
/// shape, and vanilla gives the cell a water source regardless of state
/// (`SeagrassBlock`, `TallSeagrassBlock`, `KelpBlock`, `KelpPlantBlock` and
/// `BubbleColumnBlock` all answer `Fluids.WATER` from `getFluidState`, Minecraft
/// Java 1.21.11). A body put into one of these cells is in water: it swims, and
/// it stands on nothing.
///
/// # The measurement that made this a predicate rather than a footnote
///
/// The shipped island and cave tilesets both scatter seagrass across the top
/// water block of a shore — `cave-generator` says so in its own words, *seagrass
/// is a water-filled block in vanilla, so it stands IN the sea's own cell rather
/// than above it* — and the collision table disagreed with the generator that
/// wrote the bytes. Three cells in the whole content library, and they were
/// enough to make two pieces' walk planes measure one course below their floors,
/// which put a pool's members into disagreement and refused it at build after
/// the seating command had called it seatable. A tuft of grass standing in the
/// sea is not a floor, and until this predicate existed nothing said so.
///
/// **Excluded, and not because they are dry.** `sea_pickle` and the coral fans
/// carry a `waterlogged` property, so their cell's fluid is a state an author
/// wrote and reads correctly through it; folding them in here would call a dry
/// coral fan on a museum shelf a body of water. Anything whose fluid state was
/// not read out of the pin is left in the collision default, which over-blocks
/// (module header) rather than admitting a step the game refuses.
///
/// Takes a full block name (state suffix allowed), like every predicate here.
/// Whether a block is a **1.5-block-tall barrier**: fences (`*_fence`, incl.
/// `nether_brick_fence`) and walls (`*_wall`). Vanilla gives these a collision box
/// 1.5 blocks tall on a 1-block cell, which breaks the full-cube assumption in
/// BOTH directions:
///
/// - **Not standable on top by a walking player**: a normal jump rises ~1.25
/// blocks ([`crate::metrics::MAX_JUMP_RISE_16`]), so a 1.5-tall top face is
/// unreachable by walking or jumping — a "legal +1 step onto a fence top" is a
/// proof of a route no player and no bot can walk.
/// - **Not passable through**: the barrier fills its cell for a walker, and its
/// top half also blocks the cell above.
///
/// Fence **gates** are excluded — they are the openable case, see
/// [`is_fence_gate`].
/// Whether a block is a fence gate (`*_fence_gate` — every vanilla fence gate is
/// a wooden, right-click-openable one).
///
/// Closed, it is a 1.5-tall barrier like a fence but **passable-with-use**:
/// opening it is a right-click USE interaction vanilla permits in adventure mode,
/// the same action a human player performs. So a body gets through, and a caller
/// that needs to know whether a *non-player* walker does asks this predicate by
/// name rather than reading it out of the passability answer.
/// Thin, walkable trap-trigger blocks (spec-0011) a player steps *onto* rather
/// than being blocked by: pressure plates and tripwire.
///
/// Named separately from the rest of the empty-collision class because a caller
/// needs the *trap* fact as well as the collision fact — nav must route a player
/// ONTO a critical-path trap trigger (the hazard `DW0342` reasons about) instead
/// of routing around a "solid" plate and calling every trap avoidable. Their
/// collision shape is empty, so [`collision_top_16`] answers 0 for them too and
/// the two facts cannot disagree.
/// Vanilla's **no-collision vegetation class**: blocks whose collision shape is
/// EMPTY — a walker passes straight through and stands on whatever is below
/// (they are visual/light-model content only).
///
/// Modelling one as a full cube is wrong in both directions. A `short_grass` tuft
/// on a valley terrace splits a deliberate 2-block riser into two climbable
/// 1-block steps, so `DW0854` refuses a landform vanilla cannot climb
/// (rejects-valid); and, worse, any walkability proof that stands a body ON a
/// tuft or flower cell is unsound (accepts-invalid).
///
/// The list is the **class**, not the three ids one generator happens to scatter.
/// Sources: Minecraft Java 1.21.11 block shapes — every id here has an empty
/// collision shape. Deliberately excluded because they DO collide (or attach in
/// ways this model does not represent): `azalea`/`flowering_azalea`,
/// `big_dripleaf`, `bamboo`, `cactus`, `chorus_*`, `pointed_dripstone`,
/// `scaffolding`, `sea_pickle`, `cocoa`, lily `pad` (a platform), all leaves, and
/// anything not certainly collision-free — the conservative full-cube default
/// keeps those sound.
///
/// **Five members of this list never reach [`Collision::Thin`]**, and the reason
/// is not their collision box: `seagrass`, `tall_seagrass`, `kelp`, `kelp_plant`
/// and `bubble_column` bring a water source with them, so
/// [`collision_class`] answers [`Collision::Fluid`] for them one arm earlier
/// ([`is_submerged_by_nature`]). They stay in this list because the statement it
/// makes about them — an empty collision shape — is true and is what a caller
/// asking about collision alone should get.
///
/// Takes a **bare** id ([`bare_id`]), not a full block name.
/// Vanilla's **no-collision fixture class**: the things a builder hangs on a wall
/// or lays on a floor, whose collision shape is EMPTY.
///
/// This is the class the owner's report named — *a torch counting as a solid
/// block is obviously an engine bug*. A wall torch occupies the air cell beside
/// the wall it is fixed to; a body walks through that cell in the game, and a
/// model that calls it a full cube severs a corridor for every proof downstream.
/// The same is true of a sign, a banner, a lever, a button, a rail and a
/// pressure plate.
///
/// Sources: Minecraft Java 1.21.11 block shapes — every id here is declared
/// `noCollission()`.
///
/// **Deliberately excluded, and the reason is not that they collide.** `fire`,
/// `soul_fire`, `cobweb`, `nether_portal` and `end_portal` have empty collision
/// boxes too, and are left in the full-cube default on purpose: a body passing
/// through one is not a body that may be *routed* through one, and this module's
/// answer is consumed by proofs that would credit the step. Reading them as walls
/// over-blocks, which is the direction this module's errors are allowed to run.
///
/// Also excluded because their shapes were not read out of the pin: lanterns,
/// chains, end rods, ladders. The full-cube default keeps them sound.
///
/// Takes a **bare** id ([`bare_id`]), not a full block name.
/// The height of a block's **collision box top face**, in sixteenths of a block
/// (0 = no collision at all, 16 = a full cube). Anything not listed is a full
/// cube — the conservative default.
///
/// Modelling a slab or a snow layer as a full 1×1×1 cube misplaces the surface a
/// walker stands on by up to a whole block, which makes the step rule prove
/// step-ups vanilla refuses (from a bottom slab up onto a full block is a
/// **1.5-block** rise, above the ~1.25-block jump apex) and refuse step-ups
/// vanilla allows (onto a bottom slab is a 0.5-block auto-step needing no jump
/// headroom at all).
///
/// Sources (Minecraft Java 1.21.11 block shapes):
/// - **Slabs**: `type=bottom` occupies the lower half → 8; `type=top` and
/// `type=double` reach the cell top → 16. `type` **defaults to `bottom`**, so a
/// bare `minecraft:oak_slab` is a half-step.
/// - **Snow layers** (`minecraft:snow`): collision height is `(layers - 1) * 2`
/// sixteenths (`SnowLayerBlock` indexes its shape table at `layers - 1`), so
/// `layers=1` has **no** collision box (you walk through it) and `layers=8` is
/// 14/16. The *outline* shape is `layers * 2`, which is what the block looks
/// like — the collision box is what a walker stands on. `layers` defaults to 1.
/// - **Carpets**: 1/16 (`pale_moss_carpet` only when `bottom=true`; its default
/// wall-vine form has no collision box at all).
/// - **Candles**: 6/16 for every count (`CandleBlock`'s four shapes are all
/// `…,0,…→…,6,…`), so a candle on a floor is stepped over, never onto.
/// - **Flower pots** (`flower_pot`, `potted_*`): 6/16.
/// - **`dirt_path` / `farmland`**: 15/16 (the one-pixel dip you step down into).
/// - **Empty**: [`is_no_collision_plant`] and [`is_no_collision_fixture`] → 0.
/// Whether a block is thin enough to be **walked over rather than onto**
/// ([`THIN_HEIGHT_16`]): its cell is passable and never a floor level of its own,
/// so a walker standing there rests on the block below it. Vanilla agrees — none
/// of these blocks obstructs a 1.8-block-tall walker, and every one of them is
/// under the 0.6-block auto-step.
/// Whether a block is a **partial-height floor**: it fills its cell for passage
/// purposes but its walkable top face sits below the cell top (a bottom slab, a
/// deep snow drift). Its height is [`collision_top_16`].
/// **What a block state does to a body.** The classification every walk in this
/// workspace reads; see the module header for the table it stands for.
///
/// Deliberately an enum rather than a pair of booleans: the six classes are not
/// the four corners of two independent questions, and naming them is what lets a
/// caller that needs more than passability — a gate is openable, a fluid drowns —
/// ask for the distinction instead of re-deriving it from a block name.
/// Classify a vanilla block state — **the one rule**.
///
/// The order of the arms is the rule: a fluid is a fluid whatever else it looks
/// like; a thin decoration is stepped over before anything asks whether it is a
/// gate; and only then do the two 1.5-tall classes separate from the ordinary
/// floor.
///
/// **A cell whose water the block brings with it is a fluid cell** — the
/// [`is_submerged_by_nature`] arm sits beside [`is_fluid`] and above the
/// thin-decoration arm, because a seagrass tuft is both a no-collision plant and
/// a body of water, and the collision model's answer is the water's. Reading it
/// as a thin decoration made the sea's own cell report as a place a body's feet
/// go.
/// **Can a body's own volume occupy a cell holding this block?** —
/// [`collision_class`] then [`Collision::passes_body`].
/// **Can a body stand on a cell holding this block?** —
/// [`collision_class`] then [`Collision::supports_body`].
/// The walkable top face of this block in sixteenths, or `None` when a body
/// cannot stand on it at all — [`collision_class`] then
/// [`Collision::floor_top_16`].