Render geo models in items

This commit is contained in:
2026-11-22 12:24:14 -03:00
parent dee07eaa0c
commit e751d22c6e
10 changed files with 171 additions and 29 deletions
+2 -1
View File
@@ -330,7 +330,8 @@ get the id `<mod id>:<name>`. From the file's first geometry, bworld uses:
- the description's `texture_width` and `texture_height`,
- each bone's `name`, `parent`, `pivot` and `rotation`,
- each cube's `origin`, `size`, `uv`, `inflate`, `pivot` and `rotation`.
- each cube's `origin`, `size`, `uv`, `inflate`, `pivot` and `rotation`,
- `item_display_transforms`, for an [item drawn with it](../resources/models.md#entity-models-as-items).
Cubes can use box UV (`"uv": [u, v]`) or per face UV (`"uv": { "north": { "uv": [u, v], "uv_size": [w, h] }, ... }`),
where a face that's left out isn't drawn and a negative size flips it. Faces are drawn from both sides, like Bedrock's
+18 -18
View File
@@ -42,24 +42,24 @@ down to 0 is gone.
## Properties
| Field | Default | Meaning |
| ----------------- | ------------------- | -------------------------------------------------------------------------------------- |
| `id` | required | The item's id. |
| `texture` | required | The texture it's drawn with. Leave it out to [fill in a block's item](#block-items). |
| `name` | from the id | What players see. `copper_tools:copper_ingot` is "Copper Ingot" when not set. |
| `lore` | none | Tooltip text under the name. `\n` starts a new line. |
| `max_stack` | `64`, `1` for tools | How many fit in one slot. |
| `base_sell_value` | none | What one is worth when sold, a whole number of 0 or more. |
| `places` | none | A block it places when used on a block, like seeds. |
| `tool` | none | Makes it a [tool](tools.md). |
| `food` | none | Makes it [edible](food.md). |
| `data_textures` | none | Other textures, picked by the stack's `data`, see below. |
| `model` | none | A [model](../resources/models.md#item-models) it's drawn with instead of its texture. |
| `worn` | none | How it looks worn on a player, see [below](#worn-models). |
| `targets_fluids` | `false` | Players holding it aim at fluids, like buckets and fishing rods. Others aim through. |
| `fluid_container` | none | Makes it hold a fluid, like a bucket, see [Fluids](../resources/fluids.md#containers). |
| `layers` | none | Textures drawn over its own, each in a color, see [below](#layers). |
| `components` | none | [Item components](#item-components) and their parameters. |
| Field | Default | Meaning |
| ----------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | required | The item's id. |
| `texture` | required | The texture it's drawn with. Leave it out to [fill in a block's item](#block-items). |
| `name` | from the id | What players see. `copper_tools:copper_ingot` is "Copper Ingot" when not set. |
| `lore` | none | Tooltip text under the name. `\n` starts a new line. |
| `max_stack` | `64`, `1` for tools | How many fit in one slot. |
| `base_sell_value` | none | What one is worth when sold, a whole number of 0 or more. |
| `places` | none | A block it places when used on a block, like seeds. |
| `tool` | none | Makes it a [tool](tools.md). |
| `food` | none | Makes it [edible](food.md). |
| `data_textures` | none | Other textures, picked by the stack's `data`, see below. |
| `model` | none | A [model](../resources/models.md#item-models) it's drawn with instead of its texture, or an [entity model](../resources/models.md#entity-models-as-items). |
| `worn` | none | How it looks worn on a player, see [below](#worn-models). |
| `targets_fluids` | `false` | Players holding it aim at fluids, like buckets and fishing rods. Others aim through. |
| `fluid_container` | none | Makes it hold a fluid, like a bucket, see [Fluids](../resources/fluids.md#containers). |
| `layers` | none | Textures drawn over its own, each in a color, see [below](#layers). |
| `components` | none | [Item components](#item-components) and their parameters. |
### Textures From Data
+11
View File
@@ -236,6 +236,17 @@ the same places Minecraft's do, so a transform made for Minecraft, like in Block
here. A model gets its parent's transform for each place it doesn't set its own. Minecraft's other places, like third
person, aren't used.
### Entity Models as Items
An item's `model` can also be an [entity model](../entities/index.md#entity-models), a `models/<name>.geo.json` made in
Blockbench, drawn in the item's own `texture` laid out for the model's `texture_width` and `texture_height`. It stands
in the middle of the block the way Blockbench shows it, 16 pixels to a block with its bottom at 0, and its faces are
shaded like a block model's. Its pose is the one in the file, bones aren't animated.
Its display transforms are the geometry's `item_display_transforms`, which Blockbench's Display tab writes for the
"Bedrock Block" format. Only `rotation`, `translation` and `scale` of the places above are used: `rotation_pivot`,
`scale_pivot` and `fit_to_frame` aren't.
## Lighting
Faces flat against the block's edge get smooth lighting and ambient occlusion like a full block's. Anything inside the