Better block models !
This commit is contained in:
@@ -77,6 +77,40 @@ every face, since `top` and `bottom` default to `#side`.
|
||||
|
||||
Faces are only drawn from the front, so a flat plane that should be seen from both sides needs a face each way.
|
||||
|
||||
## Shapes
|
||||
|
||||
A block's shape is the boxes it's made of, like Minecraft's `VoxelShape`. It's what players point at, so they can look
|
||||
past the empty half of a slab, what the cracks are drawn on while it's being broken, and, unless the block sets
|
||||
`"collision": false`, what entities bump into and stand on. A block that's only half there can't be placed where a
|
||||
player is standing in its other half, either.
|
||||
|
||||
By default it comes from the model: one box per element, turned with the block's `y`. An element turned by its own
|
||||
`rotation` gets the box around it. Elements that are flat planes aren't boxes, so a model made only of planes, like
|
||||
`engine:cross` and `engine:crop`, gets one box around all of them, which is what players point at to break the plant.
|
||||
|
||||
A block can set its own with `shape`, a list of boxes in pixels like `from` and `to` put together, as Minecraft's
|
||||
`Block.box` does. That's for a shape simpler than the model, or one that's different from what's drawn, like a flower
|
||||
pot's plant you can't click on. `shape` is turned with the block's `y` too, and [variants](../blocks/states.md) can set
|
||||
their own, like a crop that's taller the older it is:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "copper_tools:rice",
|
||||
"model": "engine:crop",
|
||||
"textures": { "crop": "copper_tools:rice_3" },
|
||||
"collision": false,
|
||||
"states": [{ "name": "age", "bits": 2, "default": 0 }],
|
||||
"shape": [[0, 0, 0, 16, 16, 16]],
|
||||
"variants": {
|
||||
"age=0": { "textures": { "crop": "copper_tools:rice_0" }, "shape": [[0, 0, 0, 16, 4, 16]] },
|
||||
"age=1": { "textures": { "crop": "copper_tools:rice_1" }, "shape": [[0, 0, 0, 16, 8, 16]] },
|
||||
"age=2": { "textures": { "crop": "copper_tools:rice_2" }, "shape": [[0, 0, 0, 16, 12, 16]] }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Boxes stay inside the block, from 0 to 16, so a shape can't be taller than a block like Minecraft's fences.
|
||||
|
||||
## Lighting
|
||||
|
||||
Faces flat against the block's edge get smooth lighting and ambient occlusion like a full block's. Anything inside the
|
||||
|
||||
Reference in New Issue
Block a user