CozyRadio Mod
一款适用于 Minecraft 的无限、服务器同步互联网广播流——将 Cozy Radio 唱片放入唱片机后,附近的所有玩家(约 65 格范围内)即可共同收听。
兼容原版唱片机:插入/弹出、红石比较器输出以及音乐粒子效果均正常工作。
无内置音频:默认歌单由精选的 MP3 中继源(SomaFM、Radio Paradise)组成,每位玩家都可以添加自己的 YouTube 直播流作为个人电台。
加载器: Fabric — 游戏版本: 1.21.11 — 类型: 客户端 + 服务端(需同时安装于两者,或在单人游戏中安装)
功能特性
- Cozy Radio 唱片 — 使用
jukebox(唱片机)+ diamond(钻石)合成,将其放入唱片机,周围约 65 格内的所有玩家即可接入收听。
- 服务器同步轮换 — 整个服务器按照可配置的时间间隔(默认 5 分钟)同步切换电台;无需客户端状态支持。
- 玩家独立控制 —
/cozyradio next|prev|station <name> 可切换你当前的电台,直到下一次轮换边界;其他玩家则保持各自的选择或跟随轮换。
- 个人 YouTube 电台 — 通过
/cozyradio add <url> [label] 注册你自己的 YouTube 直播流(最多 5 个),列表中显示为 ★,并可像其他电台一样播放。数据保存在磁盘上,且按玩家独立存储。
- 仅播放你的轮换列表 —
/cozyradio rotation on 使轮换仅循环播放你个人收藏的电台。
- HUD 状态卡片 — 当电台缓冲时,显示动态的“Connecting…”扫描条;随后显示带有电台名称的渐隐“Now playing”卡片。
- 音量跟随你的唱片 × 主音量滑块(两者都必须非零)。
- 稳健播放 — 流媒体断线会自动重试;从未产生音频的流体会重新连接而非保持静音;过期的 YouTube 下载 URL 会自动重新解析。
- 一次性 YouTube 授权 — 当 YouTube 对您的网络进行机器人检查时,模组会通过 YouTube 官方的设备流程在游戏聊天中请求访问权限(详见下文)。
安装方法
- 安装 Fabric Loader 0.19.3+ 和适用于 1.21.11 的 Fabric API(Java 21+)。
- 将
cozyradio-mod-*.jar 放入服务器和客户端的 mods/ 文件夹中(仅在单人游戏中只需安装一份)。
- 在首次启动服务器时,模组会将配置文件写入
config/cozyradio-mod/playlist.json —— 编辑电台列表或轮换间隔,然后重启以应用更改。
使用方法
- 合成 Cozy Radio 唱片(在工作台中使用
jukebox + diamond)。
- 放置一个唱片机,插入唱片。
- 使用以下命令控制收音机。
命令
| 命令 |
描述 |
/cozyradio status |
正在播放的唱片机数量、轮换间隔、当前电台、你个人电台的数量 |
/cozyradio list |
所有电台(你的电台标记为 ★);标记你正在收听的电台 |
/cozyradio next |
跳过到下一个电台(按玩家独立) |
/cozyradio prev |
返回上一个电台(按玩家独立) |
/cozyradio station <name> |
通过名称跳转到指定电台(Tab 补全:仅限你的电台) |
/cozyradio add <url> [label] |
将 YouTube 直播流注册为你的电台(最多 5 个;标签必须为单个单词) |
/cozyradio remove <name> |
通过名称移除你个人的某个电台 |
/cozyradio rotation on|off |
在你个人电台之间循环轮换(不带参数显示当前状态) |
/cozyradio debug |
仅限 OP:显示唱片机位置、监听者流信息 |
个人电台 (YouTube)
/cozyradio add "https://www.youtube.com/watch?v=X4VbdwhkE10" "MyLofi"
→ Added "MyLofi" to your stations — /cozyradio station MyLofi
/cozyradio list # 共享电台在前,你的电台在后并带 ★
/cozyradio station MyLofi # 按名称选择,不区分大小写
- 通过其标签识别(标签中不能有空格)—— 重新添加相同名称会替换该电台的 URL,而不是重复添加。
- 支持的链接格式:
www.youtube.com/watch?v=…、youtu.be/…、music.youtube.com/…
(纯 http 协议也可用)。其他 URL(包括 MP3 中继源)将被拒绝,因此服务器无法引导你的客户端连接到任意主机。
- 保存至
config/cozyradio-mod/personal-stations.json,重启后保留,且旧版本(使用 yours-<videoId> ID)的文件会自动迁移。
YouTube 授权(一次性)
在某些网络上,YouTube 会对匿名请求进行机器人检查,因此每位玩家的客户端需通过 YouTube 官方的设备流程进行一次 YouTube 访问授权。当需要 YouTube 电台时,游戏聊天中会出现一条消息(链接可点击):
Cozy Radio: YouTube authorization required — open <url> and enter code <code>
点击链接或在任何设备的任何浏览器中打开它,使用任意 Google 账户登录,输入代码并允许访问。客户端会自动轮询,并将刷新令牌保存到 config/cozyradio-mod/youtube-oauth.json,然后开始播放 —— 无需重启。在授权完成之前,YouTube 电台保持静音(MP3 电台继续播放);一旦你完成代码验证,等待中的流媒体将自动恢复。此过程每个客户端仅需一次 —— 服务器端永远不需要令牌。
关于 YouTube 直播流: 每当 24/7 广播重新启动时,直播 ID 就会失效(著名的 Lofi Girl ID 在 2026 年就已失效)。这就是为什么默认歌单中没有包含任何 YouTube 电台的原因 —— 玩家需要通过 /cozyradio add 添加当前的有效链接。如果某个电台失效,只需移除它并添加当前的 URL 即可修复。
配置
config/cozyradio-mod/playlist.json(首次启动时生成):
{
"rotationMinutes": 5,
"stations": [
{ "id": "groove-salad", "name": "Groove Salad — SomaFM", "url": "https://ice1.somafm.com/groovesalad-128-mp3", "type": "mp3" },
{ "id": "lush", "name": "Lush — SomaFM", "url": "https://ice1.somafm.com/lush-128-mp3", "type": "mp3" },
{ "id": "radio-paradise", "name": "Radio Paradise", "url": "https://stream.radioparadise.com/mp3-192", "type": "mp3" }
]
}
"type": "mp3" — SHOUTcast/Icecast MP3 流(当 type 缺失时的默认值)。
"type": "youtube" — YouTube 视频或直播流 URL。
仅当文件尚不存在时才会写入这些默认值——删除该文件即可重新生成。
故障排除
- 没有声音? 流的音量跟随录音 (Record) 和主音量 (Master) 滑块。如果任一滑块被静音,你将听不到声音(本模组不使用音乐滑块)。
- 某个电台无声或加载失败 —— 中继电台的 URL 偶尔会变更。请更新
config/cozyradio-mod/playlist.json 中该电台的 url 并重启游戏。
- YouTube 电台保持无声 —— 检查游戏内聊天栏是否出现
Cozy Radio: YouTube authorization required 提示,并完成一次性授权;随后流媒体将自动恢复。
- YouTube 电台停止播放 —— 直播流的视频 ID 已失效(24/7 广播已重新开始)。移除该电台并
/cozyradio add 当前有效的 URL。
许可与致谢
- 模组代码:CC0-1.0 — GitHub 源码 · 报告问题
- 播放引擎:Lavaplayer (
dev.arbjerg:lavaplayer, Apache-2.0) + youtube-source
(dev.lavalink.youtube:v2) — 采用 jar-in-jar 打包方式,总大小约 34 MB(包含所有平台的 Lavaplayer 原生库)。
- 本项目约 90% 的代码由 AI 生成,发布前经过人类审查与测试——仍可能存在 bug,欢迎反馈。
CozyRadio Mod
An endless, server-synchronized internet radio stream for Minecraft — drop the Cozy
Radio disc in a jukebox and every player nearby (~65 blocks) tunes in together.
Compatible with vanilla jukeboxes: insert/eject, redstone comparator output and
music particles all work normally.
No bundled audio: the default playlist is curated MP3 relays (SomaFM, Radio
Paradise), and every player can add their own YouTube live streams as personal
stations.
Loader: Fabric — Game version: 1.21.11 — Type: Client + Server (install on both, or in singleplayer)
Features
- Cozy Radio disc — craft it with a
jukebox + a diamond, pop it into a jukebox, and every player within ~65 blocks tunes in.
- Server-synchronized rotation — the whole server rotates stations together on a configurable interval (default 5 min); no client state.
- Per-player controls —
/cozyradio next|prev|station <name> switches your station until the next rotation boundary; other players keep their own picks or the rotation.
- Personal YouTube radios — register your own YouTube live streams with
/cozyradio add <url> [label] (up to 5), listed with ★ and played like any other station. Saved on disk and kept per player.
- Play your own rotation —
/cozyradio rotation on cycles only your personal stations on the rotation cadence.
- HUD status card — an animated "Connecting…" sweep bar while a station buffers, then a fading "Now playing" card with the station name.
- Volume follows your Record × Master sliders (both must be non-zero).
- Resilient playback — stream dropouts retry automatically; streams that never produce audio reconnect instead of staying silent; expired YouTube download URLs re-resolve on their own.
- One-time YouTube authorization — when YouTube bot-checks your network, the mod asks for access through YouTube's official device flow, right in the game chat (more below).
Installation
- Install Fabric Loader 0.19.3+ and Fabric API for 1.21.11 (Java 21+).
- Drop
cozyradio-mod-*.jar into the mods/ folder of both your server and your client (singleplayer only needs the one instance).
- On first server start, the mod writes its config to
config/cozyradio-mod/playlist.json — edit the station list or the rotation interval and restart to apply.
Usage
- Craft the Cozy Radio disc (
jukebox + diamond in a crafting table).
- Place a jukebox, insert the disc.
- Use the commands below to control the radio.
Commands
| Command |
Description |
/cozyradio status |
Jukeboxes playing, rotation interval, current station, your personal-station count |
/cozyradio list |
All stations (yours are marked ★); marks the one you're hearing |
/cozyradio next |
Skip to the next station (per player) |
/cozyradio prev |
Go back to the previous station (per player) |
/cozyradio station <name> |
Jump to a station by name (tab-complete: your stations) |
/cozyradio add <url> [label] |
Register a YouTube live stream as your station (max 5; label must be a single word) |
/cozyradio remove <name> |
Remove one of your personal stations by name |
/cozyradio rotation on|off |
Cycle the rotation through your personal stations (no-arg shows state) |
/cozyradio debug |
Op-only: jukebox positions, listener streams |
Personal stations (YouTube)
/cozyradio add "https://www.youtube.com/watch?v=X4VbdwhkE10" "MyLofi"
→ Added "MyLofi" to your stations — /cozyradio station MyLofi
/cozyradio list # shared stations first, yours after with ★
/cozyradio station MyLofi # select by name, case-insensitive
- Identified by their label (no spaces in it) — re-adding the same name replaces
that station's URL instead of duplicating.
- Accepted links:
www.youtube.com/watch?v=…, youtu.be/…, music.youtube.com/…
(plain http works too). Other URLs — including MP3 relays — are rejected, so
servers can't point your client at arbitrary hosts.
- Saved to
config/cozyradio-mod/personal-stations.json, survive restarts, and
files from older versions (which used yours-<videoId> ids) migrate automatically.
YouTube authorization (one-time)
YouTube bot-checks anonymous requests on some networks, so each player's client
authorizes YouTube access once through YouTube's official device flow. When a
YouTube station needs it, a message appears in the in-game chat (link is
clickable):
Cozy Radio: YouTube authorization required — open <url> and enter code <code>
Click the link or open it in any browser on any device, sign in with any Google
account, enter the code and allow access. The client polls automatically, saves
the refresh token to config/cozyradio-mod/youtube-oauth.json, and starts playing
— no restart needed. While the authorization is pending, YouTube stations stay
silent (MP3 stations keep playing); once you complete the code, the waiting stream
resumes on its own. This happens once per client — the server never needs a
token.
About YouTube live streams: live IDs die whenever a 24/7 broadcast restarts
(the famous Lofi Girl ID died in 2026). That's why no YouTube station ships in
the default playlist — players add current ones with /cozyradio add. A stale
station is fixed by removing it and adding the current URL.
Configuration
config/cozyradio-mod/playlist.json (written on first start):
{
"rotationMinutes": 5,
"stations": [
{ "id": "groove-salad", "name": "Groove Salad — SomaFM", "url": "https://ice1.somafm.com/groovesalad-128-mp3", "type": "mp3" },
{ "id": "lush", "name": "Lush — SomaFM", "url": "https://ice1.somafm.com/lush-128-mp3", "type": "mp3" },
{ "id": "radio-paradise", "name": "Radio Paradise", "url": "https://stream.radioparadise.com/mp3-192", "type": "mp3" }
]
}
"type": "mp3" — a SHOUTcast/Icecast MP3 stream (default when type is missing).
"type": "youtube" — a YouTube video or live stream URL.
The defaults are only written when the file doesn't exist yet — delete it to
regenerate.
Troubleshooting
- No sound? The stream volume follows the Record and Master sliders. If
either is muted, you'll hear silence (the mod does not use the Music slider).
- A station goes silent or fails to load — radio relay URLs change occasionally.
Update the station's
url in config/cozyradio-mod/playlist.json and restart.
- A YouTube station stays silent — check the in-game chat for the
Cozy Radio: YouTube authorization required message and complete the one-time
authorization; the stream resumes on its own.
- A YouTube station stops — the live stream's video ID died (the 24/7 broadcast
restarted). Remove it and
/cozyradio add the current URL.
License & credits
- Mod code: CC0-1.0 — Source on GitHub · Report issues
- Playback: Lavaplayer (
dev.arbjerg:lavaplayer, Apache-2.0) + youtube-source
(dev.lavalink.youtube:v2) — bundled jar-in-jar, ~34 MB total (includes the
Lavaplayer natives for all platforms).
- This project is roughly 90% AI-generated code, reviewed and tested by a human
before release — bugs are still possible, reports welcome.
评论 0
登录后参与评分
还没有评论,来抢沙发吧