Blame
|
1 | # Rendering and Models |
||||||
| 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 | Rendering metadata is **presentation state**, not item identity. A ContentID should remain stable even when its model, Custom Model Data allocation or client representation changes. |
|||||||
| 9 | ||||||||
| 10 | ## Common render metadata |
|||||||
| 11 | ||||||||
| 12 | ```yaml |
|||||||
| 13 | render: |
|||||||
| 14 | model: mypack:item/ruby |
|||||||
| 15 | unbreakable: true |
|||||||
| 16 | durability: 4 |
|||||||
| 17 | attributes: |
|||||||
| 18 | hide_attributes: true |
|||||||
| 19 | custom_model_data: 1001 |
|||||||
| 20 | ``` |
|||||||
| 21 | ||||||||
| 22 | ### Durability and CMD are independent |
|||||||
| 23 | ||||||||
| 24 | `render.durability` is not an alias for Custom Model Data. For 1.12/1.13 legacy pack generation, explicit durability drives damage predicates. Runtime Custom Model Data has no representation on those versions and is ignored there rather than being repurposed. |
|||||||
| 25 | ||||||||
| 26 | ### Item flags |
|||||||
| 27 | ||||||||
| 28 | `render.attributes` currently maps author-facing keys to Bukkit `ItemFlag` values; it is **not** the future combat `AttributeModifier` system. Names are normalised to enum-style constants and unsupported flags on an older runtime are ignored. Compatibility aliases remain for historically different Bukkit names such as enchantment/destroyable/placeable hiding. |
|||||||
| 29 | ||||||||
| 30 | ## Structured Custom Model Data |
|||||||
| 31 | ||||||||
| 32 | Minecraft 1.21.4 and 26.2 use the modern item adapter and can represent structured Custom Model Data: |
|||||||
| 33 | ||||||||
| 34 | ```yaml |
|||||||
| 35 | render: |
|||||||
| 36 | model: mypack:item/ruby |
|||||||
| 37 | custom_model_data: |
|||||||
| 38 | variant: red |
|||||||
| 39 | powered: true |
|||||||
| 40 | intensity: 0.75 |
|||||||
| 41 | tint: '#ff0000' |
|||||||
| 42 | ``` |
|||||||
| 43 | ||||||||
| 44 | Value type inference: |
|||||||
| 45 | ||||||||
| 46 | | YAML value | Allocated component kind | |
|||||||
| 47 | |---|---| |
|||||||
| 48 | | number | float | |
|||||||
| 49 | | boolean | flag | |
|||||||
| 50 | | ordinary string | string | |
|||||||
| 51 | | `#RRGGBB` | color | |
|||||||
| 52 | ||||||||
| 53 | VoxelCore stores stable semantic-key → typed-index allocation in `render-allocations.yml`; authors do not manually manage list indices. |
|||||||
| 54 | ||||||||
| 55 | ## Modern render rules |
|||||||
| 56 | ||||||||
| 57 | `render.rule` defines the generated modern item-model decision graph. Supported node types are `select`, `condition`, `range` and `model`. |
|||||||
| 58 | ||||||||
| 59 | ```yaml |
|||||||
| 60 | render: |
|||||||
| 61 | model: mypack:item/ruby |
|||||||
| 62 | custom_model_data: |
|||||||
| 63 | variant: red |
|||||||
| 64 | powered: true |
|||||||
| 65 | intensity: 0.75 |
|||||||
| 66 | tint: '#ff0000' |
|||||||
| 67 | rule: |
|||||||
| 68 | select: |
|||||||
| 69 | key: variant |
|||||||
| 70 | cases: |
|||||||
| 71 | red: |
|||||||
| 72 | condition: |
|||||||
| 73 | key: powered |
|||||||
| 74 | true: |
|||||||
| 75 | range: |
|||||||
| 76 | key: intensity |
|||||||
| 77 | entries: |
|||||||
| 78 | 0.75: |
|||||||
| 79 | model: |
|||||||
| 80 | id: mypack:item/ruby_powered |
|||||||
| 81 | tint: tint |
|||||||
| 82 | fallback: mypack:item/ruby |
|||||||
| 83 | false: mypack:item/ruby |
|||||||
| 84 | fallback: mypack:item/ruby |
|||||||
| 85 | ``` |
|||||||
| 86 | ||||||||
| 87 | Pre-1.21.4 pack targets reject `render.rule` instead of silently discarding it. |
|||||||
| 88 | ||||||||
| 89 | ## Asset resolution |
|||||||
| 90 | ||||||||
| 91 | `mypack:item/ruby` resolves to `assets/mypack/models/item/ruby.json`. A texture reference with the same logical path resolves beneath `assets/mypack/textures/item/ruby.png`. Cross-pack model references are dependency checked. |
|||||||