Entity and block sounds !
This commit is contained in:
@@ -68,6 +68,7 @@ there will be holes in the world behind them.
|
||||
| `item` | `true` | Also register an item that places it, with the same id. To give that item more, see [Block Items](../items/index.md#block-items). |
|
||||
| `interactive` | `false` | Right clicking it does something, like opening a screen, so clients don't guess that it places a block. |
|
||||
| `scrollable` | `false` | The mouse wheel turned while looking at it goes to its components' `on_scroll` instead of the hotbar, see [Scrolling](components.md#scrolling). |
|
||||
| `sounds` | silent | What its sounds' ids start with, see [Sounds](../resources/sounds.md#blocks-and-entities). |
|
||||
| `replaceable` | `false` | Placing a block into it replaces it, like water. Fluids default to `true`. |
|
||||
| `place_in` | see meaning | Block ids or [tags](../resources/tags.md) it can be placed into, replacing them, like `["bworld:water"]` for rice. Air and `replaceable` blocks when not set. |
|
||||
| `place_on` | anywhere | Block ids or [tags](../resources/tags.md) it can stand on, like `["bworld:hoed_dirt"]` for crops or `["#bworld:logs"]`. See [below](#placement). |
|
||||
|
||||
@@ -38,6 +38,7 @@ and players. Mods define new kinds in their `entities/` folder, and draw them wi
|
||||
| `physical_shielding` | `0` | Protection from physical damage. Not used yet. |
|
||||
| `arcane_shielding` | `0` | Protection from arcane damage. Not used yet. |
|
||||
| `loot_table` | none | A [loot table](../resources/loot_tables.md) it drops from when it dies. |
|
||||
| `sounds` | silent | What its sounds' ids start with, see [Sounds](../resources/sounds.md#blocks-and-entities). |
|
||||
|
||||
`/summon <entity>` spawns one where you stand.
|
||||
|
||||
|
||||
@@ -41,6 +41,34 @@ A sound without a category only follows the player's master volume.
|
||||
|
||||
`deno task check-mods` reports a file that isn't there, and warns about an `.ogg` no sound plays.
|
||||
|
||||
## Blocks and Entities
|
||||
|
||||
A block's or entity's json can name what its sounds' ids start with, and the game plays them without any code:
|
||||
|
||||
```json
|
||||
"sounds": "copper_tools:copper"
|
||||
```
|
||||
|
||||
| For | Sound | When |
|
||||
| --------- | ---------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| a block | `/break` | It's broken, by a player or a script's `break_block`. Not when a script replaces it with `set_block`. |
|
||||
| a block | `/place` | A player or a machine's `use_item_on` places it. |
|
||||
| a block | `/hit` | Every 4 ticks while a player breaks it, at a quarter of the volume, only on their client. |
|
||||
| a block | `/step` | Something walks on it with no step sound of its own, every 1.6 blocks, at 0.15 of the volume. |
|
||||
| an entity | `/hurt` | It's hurt. |
|
||||
| an entity | `/death` | It dies. |
|
||||
| an entity | `/step` | It walks on a block, every 1.6 blocks, in place of the block's step. |
|
||||
| an entity | `/ambient` | Every 4 to 12 seconds while it's alive, timed by each player's client. |
|
||||
|
||||
So `"sounds": "copper_tools:copper"` on a block plays `copper_tools:copper/break` when it breaks, and so on. Any of them
|
||||
can be left out of `sounds.json`, and isn't played. A whole family of blocks usually shares one, like every copper
|
||||
block, and `check-mods` reports a block or entity whose `sounds` has none of its own, which is usually a typo.
|
||||
|
||||
The player breaking or placing a block hears it right away from their own client, and everyone else from the server.
|
||||
Players step with the blocks they walk on, except the one playing while they sneak or fly. Anything about a mob that
|
||||
depends on what it's doing is its scripts' to play, see [From the Server](#from-the-server) and
|
||||
[Lasting Sounds](#lasting-sounds).
|
||||
|
||||
## Playing Sounds
|
||||
|
||||
Sounds are played where what makes them happens: a server phase for what happens in the world, a shared rule for what a
|
||||
|
||||
Reference in New Issue
Block a user