在 Minecraft 中播放你自己的音乐,并确保所有玩家都保持在歌曲的同一秒。使用声音事件、资源包中的 ogg 文件、指向 ogg/mp3/wav 文件的直接链接或任意链接:YouTube、SoundCloud、视频等。
命令:
/soundtrack <play/stop/list>
/soundtrack play <id> resource <sound> [volume] [fadeinTicks] [fadeoutTicks] [loop] [fadeloop] [pitch] [category]
/soundtrack play <id> url <link> [volume] ...
/soundtrack stop <id/all> [fadeoutTicks]
选择 resource,标签补全会显示你的 soundtracks 文件夹中的文件以及模组和原版的声音。选择 url 并粘贴链接。不需要引号。
Soundtracks 文件夹
将你的 .ogg 文件放入资源包内的 assets/<namespace>/soundtracks/ 中,无需 sounds.json。按 F3+T,它们会在标签补全中显示为 namespace:soundtracks/song.ogg。
链接
粘贴指向 ogg、mp3 或 wav 文件的直接链接即可播放。每个玩家只需下载一次,并将其缓存。
也可以链接到 YouTube 或 SoundCloud 等页面以及视频(mp4、webm...)。首次使用时,模组会从官方页面静默下载其所需的免费工具(yt-dlp、deno 和 ffmpeg),无需手动安装。
玩家可以在 config/soundtrackplayer.json 中关闭链接功能。
始终同步
如果某人迟到加入、离开后重新加入,或重载资源包,歌曲会从与其他人相同的秒数开始播放。循环也是如此。F3+T 和暂停菜单不再切断音乐。
淡入、循环和类别
- fadein / fadeout: 以刻(ticks)为单位(20 = 1 秒)
- 带淡出的停止: stop 中的 fadeout 会覆盖歌曲开始时使用的 fadeout。留空则使用原始设置
- fadeloop: true 会在每次循环时淡入淡出,false 仅在第一次启动和停止时淡入淡出
- pitch: 0.5 到 2.0,同时改变速度
- category: 默认为 SOUNDTRACKS,也可以是任何原版类别如 MUSIC、AMBIENT 或 RECORDS,以跟随相应的音量滑块
使用相同的 id 和声音再次运行命令会实时更改音量、音调或淡入淡出效果,歌曲会继续从当前位置播放。你自定义的 soundtracks 在离开和进入世界后也会继续播放。
Soundtracks 滑块
“音乐与声音”设置中新增了一个“Soundtracks”滑块,用于控制 SOUNDTRACKS 类别下所有音效的音量。已翻译成 20 种语言。
服务器
- Paper/Spigot: 使用 SoundtrackplayerPLUGIN 插件:
/soundtrackplugin play <@a/player> <id> <url/resource> <link/sound> ...和/soundtrackplugin stop <@a/player> <id/all> [fadeoutTicks]。它会保存所有状态,因此后来加入的玩家会在同一时间听到相同的内容。标签补全会显示当前正在播放的 id 以及你的玩家拥有的自定义声音。 - 单人游戏、Fabric、NeoForge 和 Forge 服务器: 使用你自己模组中的 API。
API
服务端(支持所有加载器,包括单人游戏):
Soundtrack boss = Soundtrack.builder("boss", "soundtrackplayer:soundtracks/boss.ogg")
.volume(0.8f).fadeIn(40).fadeOut(60).loop(true).build();
SoundtrackPlayerAPI.playForAll(server, boss);
SoundtrackPlayerAPI.play(player, boss);
SoundtrackPlayerAPI.stopForAll(server, "boss", 100);
客户端:使用 SoundtrackClientAPI 播放本地音轨、停止它们、读取或更改 Soundtracks 音量,并监听音轨的开始和停止。
插件:SoundtrackPlayerAPI.get() 提供与 Paper 插件相同的方法,以及当拥有该模组的玩家加入时触发的 SoundtrackClientReadyEvent。
源代码和文档:
适用于 Fabric 1.20.1 - 26.2、NeoForge 1.20.1 - 26.2 和 Forge 1.20.1 / 1.20.4。
Play your own music in Minecraft and keep everyone on the same second of the song. Use sound events, ogg files from a resource pack, a direct link to an ogg, mp3 or wav file, or any link: YouTube, SoundCloud, videos...
Commands:
/soundtrack <play/stop/list>
/soundtrack play <id> resource <sound> [volume] [fadeinTicks] [fadeoutTicks] [loop] [fadeloop] [pitch] [category]
/soundtrack play <id> url [volume] ...
/soundtrack stop <id/all> [fadeoutTicks]
Pick resource and the tab completion shows your soundtracks folder files, modded and vanilla sounds. Pick url and paste the link. No quotes needed.
Soundtracks folder
Put your .ogg files in assets/<namespace>/soundtracks/ inside a resource pack, no sounds.json needed. Press F3+T and they show up in the tab completion as namespace:soundtracks/song.ogg.
Links
Paste a direct link to an ogg, mp3 or wav file and it plays. Each player downloads it once and keeps it cached.
Links to pages like YouTube or SoundCloud and to videos (mp4, webm...) work too. The first time you use one, the mod quietly downloads the free tools it needs (yt-dlp, deno and ffmpeg) from their official pages, nothing to install by hand.
Players can turn links off in config/soundtrackplayer.json.
Always in sync
If someone joins late, leaves and comes back, or reloads their resource packs, the song picks up at the same second as everyone else. Loops too. F3+T and the pause menu don't cut the music anymore.
Fades, loops and categories
- fadein / fadeout: in ticks (20 = 1 second)
- stop with a fade: the fadeout in stop overrides the one the song was started with. Leave it empty and it uses the original one
- fadeloop: true fades every lap of a loop in and out, false only fades the first start and the stop
- pitch: 0.5 to 2.0, it changes the speed too
- category: SOUNDTRACKS by default, or any vanilla one like MUSIC, AMBIENT or RECORDS so it follows that slider
Running the same command again with the same id and sound changes the volume, pitch or fades live, the song keeps going from where it was. Your own soundtracks also keep playing after leaving and joining a world.
Soundtracks slider
There's a new "Soundtracks" slider in Music & Sounds to control the volume of every soundtrack in the SOUNDTRACKS category. It's translated to 20 languages.
Servers
- Paper/Spigot: use the SoundtrackplayerPLUGIN plugin:
/soundtrackplugin play <@a/player> <id> <url/resource> <link/sound> ...and/soundtrackplugin stop <@a/player> <id/all> [fadeoutTicks]. It saves everything, so players that join later hear the same thing at the same time. Tab completion shows the ids that are actually playing and the custom sounds your players have. - Singleplayer, Fabric, NeoForge and Forge servers: use the API from your own mod.
API
Server side (every loader, singleplayer included):
Soundtrack boss = Soundtrack.builder("boss", "soundtrackplayer:soundtracks/boss.ogg")
.volume(0.8f).fadeIn(40).fadeOut(60).loop(true).build();
SoundtrackPlayerAPI.playForAll(server, boss);
SoundtrackPlayerAPI.play(player, boss);
SoundtrackPlayerAPI.stopForAll(server, "boss", 100);
Client side: SoundtrackClientAPI to play local tracks, stop them, read or change the Soundtracks volume and listen to tracks starting and stopping.
Plugin: SoundtrackPlayerAPI.get() with the same methods for Paper plugins, plus SoundtrackClientReadyEvent when a player with the mod joins.
Source code and docs:
Available for Fabric 1.20.1 - 26.2, NeoForge 1.20.1 - 26.2 and Forge 1.20.1 / 1.20.4.
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SoundtrackPlayer
- 移植至 Fabric 26.2 以及 NeoForge 1.20.1、1.20.4、1.21.1、1.21.4、1.21.5、1.21.8、1.21.11 和 26.2
- 1.20.x 版本构建再次运行于 Java 17
/soundtrack play <id> resource <sound>和/soundtrack play <id> url <link>,无需引号,且resource可自动补全资源包中的音效- 音轨文件夹:资源包中
assets/<namespace>/soundtracks/下的.ogg文件无需sounds.json即可工作,并在按下 F3+T 后显示在标签补全列表中 - 支持任意链接:纯 ogg/mp3/wav 文件、YouTube 或 SoundCloud 等页面,以及其他媒体如 mp4 或 m4a。所需工具会在首次使用时自动下载
- 重复播放相同的 id 和音效时,可实时调整音量、音调或淡入淡出,无需重启歌曲
- 离开并重新加入世界后,本地音轨仍能在正确的秒数继续播放
- 仅在出错时在聊天栏中提示
- 延迟加入者、重新连接和资源重载时,歌曲会从与其他玩家相同的秒数开始播放
- F3+T 和暂停菜单不再停止音轨播放
stop命令提供可选的淡出效果,可覆盖曲目自带的淡出fadeloop选项:使循环的每一圈都进行淡入淡出处理category选项:可在任意原版声音类别中播放,默认为新增的 SOUNDTRACKS 类别- “音乐与音效”设置中的“Soundtracks”音量滑块,已翻译为 20 种语言
/soundtrack list和/soundtrack stop all命令- 当滑块数值回升时,处于某类别下音量 0% 的曲目会恢复播放
- 来自某个服务器的音轨不再在下个服务器中继续播放
- 服务端 API 与客户端 API
- Forge jar 现在包含 mixin refmap,使其能够在开发环境之外正常工作
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧