Blame
|
1 | # Inheritance |
||||||
| 2 | ||||||||
| 3 | ||||||||
| 4 | > **Documentation baseline:** VoxelCore `main` at `452b569` · 14 September 2026. |
|||||||
| 5 | > **Repository:** [https://github.com/VoxelHorizons/VoxelCore](https://github.com/VoxelHorizons/VoxelCore) |
|||||||
| 6 | ||||||||
| 7 | ||||||||
| 8 | VoxelCore compiles single-parent inheritance before content is published. |
|||||||
| 9 | ||||||||
| 10 | ## Parent references |
|||||||
| 11 | ||||||||
| 12 | Within the same namespace, a local parent key can be used. Cross-pack references are valid only when the parent namespace is declared as a pack dependency. |
|||||||
| 13 | ||||||||
| 14 | ## Current merge semantics |
|||||||
| 15 | ||||||||
| 16 | | Value | Behaviour | |
|||||||
| 17 | |---|---| |
|||||||
| 18 | | omitted scalar | inherit parent value | |
|||||||
| 19 | | provided scalar | replace parent value | |
|||||||
| 20 | | explicit `false` | replaces inherited `true` | |
|||||||
| 21 | | list | explicitly supplied child list replaces parent list | |
|||||||
| 22 | | `properties` map | recursive deep merge | |
|||||||
| 23 | | render metadata | field-by-field merge | |
|||||||
| 24 | | structured `custom_model_data` | semantic-key merge when parent and child are both structured | |
|||||||
| 25 | | switch numeric ↔ structured CMD | child representation replaces parent representation | |
|||||||
| 26 | ||||||||
| 27 | Only one parent is supported per item. |
|||||||
| 28 | ||||||||
| 29 | ## Validation |
|||||||
| 30 | ||||||||
| 31 | Compilation rejects: |
|||||||
| 32 | ||||||||
| 33 | - missing parents; |
|||||||
| 34 | - self-cycles or longer inheritance cycles; |
|||||||
| 35 | - duplicate ContentIDs; |
|||||||
| 36 | - definitions that remain invalid after resolution, such as missing required material; |
|||||||
| 37 | - illegal cross-pack references without declared dependencies. |
|||||||
| 38 | ||||||||
| 39 | The resolver includes dependency-chain context in compilation errors so invalid authoring fails at load/reload time rather than surfacing as a gameplay error later. |
|||||||
| 40 | ||||||||
| 41 | ## Base definitions and list visibility |
|||||||
| 42 | ||||||||
| 43 | A definition can remain `bound: false` and serve only as an inheritance base. It still participates in compilation and the runtime registry, but current `/voxelcore admin item list` filtering hides it from the user-facing list. |
|||||||