Tooltips
This commit is contained in:
@@ -233,6 +233,7 @@ program**, so the server and each client can number blocks differently. Saves an
|
||||
| Field | Default | Maps to `BlockRegistry` | Meaning |
|
||||
| ---------------------- | ----------- | ----------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `id` | required | `id` | The block's id. |
|
||||
| `name` | from the id | `name` | What players see, like `"Copper Block"`. Its item gets it too. Without it the name is made from the id: `copper_tools:copper_block` is "Copper Block". |
|
||||
| `textures` | required | `textures` | One texture id, `{ top, bottom, side }` or `{ front, side }`. With another `model`, the model's texture variables, like `{ "crop": "..." }`. |
|
||||
| `model` | `engine:cube` | `model` | The [block model](#block-models). |
|
||||
| `variants` | none | `variants` | A different `model`, `textures` or `y` rotation for some states, see [block models](#block-models). |
|
||||
@@ -357,11 +358,12 @@ block is lit evenly with the block's own light.
|
||||
| Field | Default | Maps to `ItemRegistry` | Meaning |
|
||||
| ------------ | -------- | ------------------------ | -------------------------------------------------- |
|
||||
| `id` | required | registry key | The item's id. |
|
||||
| `name` | from the id | `name` | What players see, like `"Copper Pickaxe"`. Made from the id when not set. |
|
||||
| `texture` | required | `texture_id` | Texture id. |
|
||||
| `tool` | none | `tool_type` | Tool type used by blocks' `mining.tool`. |
|
||||
| `places` | none | `block_id` | Block placed when used on a block face. |
|
||||
| `max_stack` | `64` | new | Largest stack size. |
|
||||
| `lore` | none | `get_lore` | Static tooltip text. |
|
||||
| `lore` | none | `lore` | Tooltip text under the name. `\n` starts a new line. |
|
||||
| `components` | none | `on_create` / `get_lore` | Custom item components, handled by server scripts. |
|
||||
|
||||
Item stacks can carry `data`, a JSON value set by the server (like the watering can's water level). It's synced to
|
||||
@@ -623,7 +625,9 @@ Item components use
|
||||
`ctx.components.register_item(id, { on_create(item, params), get_lore(item, params), on_use(item,
|
||||
params, player) })`.
|
||||
`on_use` runs when a player right clicks while holding the item, both at nothing and at a block. At a block, the block's
|
||||
own interaction comes first, and an item with `on_use` is used instead of being placed.
|
||||
own interaction comes first, and an item with `on_use` is used instead of being placed. `get_lore` is extra tooltip text
|
||||
for one stack, like the watering can's "Water: 12/32": the server works it out whenever it sends the item to a player
|
||||
and shows it under the item's own `lore`. It isn't saved.
|
||||
|
||||
### Events
|
||||
|
||||
|
||||
Reference in New Issue
Block a user