Curios slots rendering !
This commit is contained in:
@@ -26,6 +26,7 @@ interface Player {
|
||||
|
||||
give_item(id: string, count?: number, data?: unknown): void; // what doesn't fit drops at their feet
|
||||
send_message(text: string): void;
|
||||
set_worn(key: string, items: ItemStack[]): void; // what's drawn on them, see Worn Items
|
||||
teleport(x: number, y: number, z: number): void;
|
||||
|
||||
readonly health: number; // out of max_health
|
||||
@@ -92,6 +93,15 @@ Like Minecraft, an attack right after the last one, or right after changing the
|
||||
damage, rising to full after `20 / attack_speed` ticks. A bar under the crosshair shows it filling up, and the server
|
||||
sends players their `attack_speed` whenever it changes so the bar matches.
|
||||
|
||||
## Worn Items
|
||||
|
||||
`set_worn(key, items)` says what a mod shows on a player, like the base game's curios slots do for what's in them. Each
|
||||
mod uses its own key, like `"bworld:curios"`, and setting a key replaces its list, `[]` clears it. Only items whose JSON
|
||||
has [`worn`](../items/index.md#worn-models) show.
|
||||
|
||||
Everyone is told what each player wears, the player too, and players joining later get it with the others. It isn't
|
||||
saved: set it again when the player joins, the way the curios slots do.
|
||||
|
||||
## Death
|
||||
|
||||
When a player dies, everything they carried falls out where they died, and their tools lose durability (see
|
||||
|
||||
@@ -50,6 +50,7 @@ down to 0 is gone.
|
||||
| `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. |
|
||||
| `worn` | none | How it looks worn on a player, see [below](#worn-models). |
|
||||
| `components` | none | [Item components](#item-components) and their parameters. |
|
||||
|
||||
### Textures From Data
|
||||
@@ -63,6 +64,42 @@ is out:
|
||||
|
||||
A stack whose `data.cast` is truthy uses `bworld:fishing_rod_cast`. When several keys are, the first listed wins.
|
||||
|
||||
### Worn Models
|
||||
|
||||
`worn` says how an item looks on a player who wears it, like Bedrock's attachables. A server script says what a player
|
||||
wears with [`set_worn`](../entities/players.md#worn-items), and every client draws it on them. There's no third person
|
||||
view, so players see what others wear, and what's on their own right arm in first person. Artifacts' power glove and
|
||||
feral claws (`mods/artifacts`) and the base game's giant chestplate are examples.
|
||||
|
||||
```json
|
||||
"worn": {
|
||||
"model": "artifacts:power_glove_wide",
|
||||
"texture": "artifacts:power_glove_wide",
|
||||
"slim_model": "artifacts:power_glove_slim",
|
||||
"slim_texture": "artifacts:power_glove_slim"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Meaning |
|
||||
| ---------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| `model` | An [entity model](../entities/index.md#entity-models) from a `models/*.geo.json`, made in Blockbench. |
|
||||
| `texture` | The texture it's drawn with, laid out for the model's `texture_width` and `texture_height`. |
|
||||
| `slim_model`, `slim_texture` | Optional, for players with slim (3 pixel wide) arms. The others when not set. |
|
||||
|
||||
A bone named like a part of the player, `head`, `body`, `right_arm`, `left_arm`, `right_leg` or `left_leg`, moves with
|
||||
that part, so a model made over Blockbench's player template lines up. check-mods warns about a model with none of them,
|
||||
since nothing of it would move. Bones under one of them go with it, and other bones stay with the body.
|
||||
|
||||
Things to know when making one:
|
||||
|
||||
- **Armor** can use a Minecraft armor texture (64x32, like `textures/entity/equipment/humanoid/` in a mod's assets) as
|
||||
it is: a box over each part, inflated by 1, with the UVs of Minecraft's armor model. The giant chestplate
|
||||
(`mods/bworld/models/giant_chestplate.geo.json`) is `body` at `[16, 16]` and both arms at `[40, 16]`.
|
||||
- **Blockbench's `mirror` isn't supported**, so a box's texture is never flipped. Minecraft mirrors the left arm's and
|
||||
leg's armor, which here show the right one's texture as it is.
|
||||
- **Porting a Java mod's model**, like Artifacts' `ArmsMeshDefinitions`: Java models measure y down from the top of the
|
||||
head, bedrock up from the feet. Keep x and z, and make each y `24 - y`, with a box's origin at its bottom.
|
||||
|
||||
## Item Components
|
||||
|
||||
Like [block components](../blocks/components.md), item components give items behavior. The server script registers them:
|
||||
|
||||
Reference in New Issue
Block a user