Cranberry
在 macOS 上实现游戏内音乐播放
Cranberry 允许你从 Minecraft 内部控制电脑上正在播放的任何音乐。如果该模组也安装在服务器上,其他安装了此模组的玩家将能够看到你正在收听的内容(可禁用)。
目录
图片

访问画廊查看更多示例。
客户端安装
Cranberry 目前仅支持 macOS,并将在任何其他平台上自动禁用自身。
如果仅在客户端安装,按下快捷键(默认为 M)将打开一个屏幕,显示当前正在播放的音乐,并允许你播放/暂停。默认情况下,屏幕背景会根据图像中的主色调动态着色——这可以在配置中禁用(参见配置选项)。
服务器安装
在服务器上安装此模组允许客户端互相查看彼此的音乐状态——客户端可以在配置中禁用发送或接收状态。请注意,如果此模组安装在服务器上,owo-lib(此模组依赖的一个库模组)必须安装在每个连接的客户端上,否则由于注册表不匹配,他们将无法连接。模组本身是可选的。
配置选项
你可以在 config/cranberry-client-config.json5 中编辑配置值。或者,安装 Mod Menu 后,你可以通过图形界面更改以下配置选项:
- 发送音乐状态(默认:true;仅在多人游戏中生效)
- 接收音乐状态(默认:true;仅在多人游戏中生效)
- 动态背景(默认:true)
工作原理
魔法。
技术细节
Apple 在其平台上有一个名为 `MediaRemote` 的私有框架,它允许获取媒体播放信息和进行控制。一些 Swift 代码链接到该框架,编译为动态库,并通过 JNI 从 Java 调用。
Windows / Linux?
虽然这类功能在 Windows 和 Linux 上通常会更容易实现(Windows 有 MediaPlayer,Linux 有 MPRIS/D-Bus,两者都有完善的文档且旨在供公众使用,与 Apple 的 MediaRemote 不同),但我完全没有处理 WinRT 或 D-Bus 的经验。因此,尽管我有兴趣添加支持,但目前并没有实际计划这样做。
Cranberry
In-game music playback on macOS
Cranberry allows you to control whatever music is playing on your computer from within Minecraft. If also installed on a server, others with the mod will be able to see what you're listening to (disableable).
Table of Contents
Images

Visit the gallery for more examples.
Client Installation
Cranberry is currently only supported on macOS and will automatically disable itself on any other platform.
If installed only on the client, pressing the keybind (M by default) will open a screen that shows what music is currently being played and allows you to play/pause it. By default, the background of the screen is dynamically tinted with the dominant color from the image - this can be disabled in the configuration (see Configuration Options).
Server Installation
Installing the mod on the server allows clients to see each other's music statuses - clients may disable sending or receiving statuses in the configuration. Note that if this mod is installed on the server, owo-lib (a library mod that this mod depends on) must be installed on every connecting client, or they will not be able to connect due to registry mismatches. The mod itself is optional.
Configuration Options
You may edit configuration values in config/cranberry-client-config.json5. Alternatively, installing Mod Menu will allow you to change the following configuration options via a GUI:
- Send music statuses (default: true; only takes effect when playing multiplayer)
- Receive music statuses (default: true; only takes effect when playing multiplayer)
- Dynamic background (default: true)
How Does It Work?
Magic.
Technical details
Apple has a private framework on its platforms called `MediaRemote`, which allows for media playback information and control. Some Swift code is linked to this framework, built to a dynamic library, and called from Java using JNI.
Windows / Linux?
While this sort of thing would generally be easier on Windows and Linux (Windows has MediaPlayer and Linux has MPRIS/D-Bus, both of which are well-documented and intended for public consumption, as opposed to Apple's MediaRemote), I have absolutely no experience working with WinRT or D-Bus. So although I'm interested in adding support, I don't currently actually have plans to do it.
评论 0
登录后参与评分
还没有评论,来抢沙发吧