Skip to content

音效系统

服务端配置 + 网络下发 + 客户端统一混音与上下文切换。

架构总览

音效系统覆盖以下域:

  • 自动域:ambientareadungeoncombat
  • 事件域:quest_accept / quest_complete / quest_fail 与自定义 events
  • 手动域:scene 上下文切换、手动 play/stop
  • UI 域:客户端脚本 Sound.play / Sound.playAt / Sound.stop

Quick Start

1. 服务端配置一个事件音效

yaml
# /plugins/Behemiron/sound/OtherSounds/example.yml
events:
  QuestAccept:
    sound: ui/quest_accept
    bus: ui
    volume: 1
    pitch: 1

2. 服务端触发

kotlin
SoundServerAPI.playEvent(player, "QuestAccept")

或 Kether:

kether
sound event QuestAccept

3. 客户端 UI 脚本播放

js
Sound.play("ui/confirm")

关键规则

  1. 音效路径必须使用 sound/ 目录下的相对路径,如 ui/confirm
  2. 禁止写前缀:namespace:sound/sounds/
  3. 总线(bus)建议使用:environmentcombatquestdungeonuieffectsystemvanilla(大小写不敏感)。
  4. source 使用 Minecraft SoundSource 枚举值(如 MASTERMUSICAMBIENT)。

模块清单

子模块职责链接
配置与规则服务端目录、字段、默认值、合法写法配置与规则
UI 音效 API客户端脚本 Sound.* 接口UI 音效 API
服务端脚本触发Kether sound 指令Kether