This commit is contained in:
2026-10-03 16:28:09 -03:00
parent 24fe7cdede
commit 91655c28c5
53 changed files with 1752 additions and 114 deletions
+42 -2
View File
@@ -15,7 +15,7 @@ Blocks that aren't full cubes should use the `cutout` or `translucent` [render l
`solid` blocks hide their neighbors' faces. They usually want `"collision": false` too.
In inventories, a block with a full cube model is drawn as a cube. Any other block is drawn flat, as its first texture,
like Minecraft's plants.
like Minecraft's plants, unless it sets an [`item_model`](#item-models).
## Texture Variables
@@ -109,7 +109,47 @@ their own, like a crop that's taller the older it is:
}
```
Boxes stay inside the block, from 0 to 16, so a shape can't be taller than a block like Minecraft's fences.
Boxes stay inside the block, from 0 to 16.
### Collision Shapes
What entities bump into is the shape, unless the block sets `collision_shape`, like Minecraft's `getCollisionShape`.
It's in pixels like `shape`, and is the only shape that can go higher than the block: up to 24 pixels, so a fence is too
tall to jump over while players still point at a block-high post. Variants and [parts](#parts) can set their own.
## Parts
A block can be made of pieces instead of one model, like Minecraft's multipart blockstates. Each of `parts` is a model
that's drawn when its `when` matches the block's [states](../blocks/states.md) (always, without one), turned by its `y`.
Its `shape` and `collision_shape` are added to the block's when it's drawn. A fence is a post, and a bar for each side
it joins, `blocks/oak_fence.json`:
```json
"states": [
{ "name": "north", "bits": 1, "default": 0 },
{ "name": "east", "bits": 1, "default": 0 },
{ "name": "south", "bits": 1, "default": 0 },
{ "name": "west", "bits": 1, "default": 0 }
],
"parts": [
{ "model": "bworld:fence_post", "shape": [[6, 0, 6, 10, 16, 10]], "collision_shape": [[6, 0, 6, 10, 24, 10]] },
{ "when": "north=1", "model": "bworld:fence_side", "shape": [[7, 0, 0, 9, 16, 9]], "collision_shape": [[7, 0, 0, 9, 24, 9]] },
{ "when": "east=1", "model": "bworld:fence_side", "y": 90, "shape": [[7, 0, 0, 9, 16, 9]], "collision_shape": [[7, 0, 0, 9, 24, 9]] },
...
]
```
The side model is the bars on the north side, and `y` turns it to the others. Parts use the block's `textures` unless
they set their own, so one pair of models serves every kind of wood. Parts replace `model` and `variants`' models.
What sets the states is up to the block's [components](../blocks/components.md): the fences' `bworld:fence` sets them
from what's beside it, every time something next to it changes.
## Item Models
`item_model` draws a block's item with another model, filled in with the block's textures, like Minecraft's
`fence_inventory`. Fences use `bworld:fence_inventory`, two posts and the bars between them, since a single post
wouldn't look like a fence. It's drawn in slots, in hands and on the ground.
## Lighting