概述
这是一个高度可定制且极其轻量级的模组,允许整合包开发者创建许多自定义的默认游戏内选项。它不仅支持原版的 options.txt 文件,还支持在游戏内配置的模组,例如 JourneyMap 和 FTB Utilities。请注意,该模组在游戏加载完成后零开销运行,并在你开始游戏前释放所有占用的内存,因为它仅在加载屏幕期间使用。
目的
对于整合包开发者来说,在整合包中分发诸如 options.txt 之类的文件通常是个坏主意,因为每次整合包更新时,用户配置的选项都会被整合包随附的文件版本覆盖。这对玩家来说非常令人沮丧,因为他们花时间设置了控制键,却发现设置会在整合包更新时被覆盖。然而,如果整合包不分发诸如 options.txt 之类的文件,整合包往往会遇到许多冲突的控制键映射,这可能会导致模组失效或让玩家感到困惑。
这个模组旨在解决这个问题,通过将自定义配置文件复制到游戏目录中,但仅当文件尚不存在时才进行复制。本质上,整合包制作者的自定义选项文件仅在首次启动整合包时创建,整合包更新不会尝试覆盖任何可能包含玩家进一步自定义设置的现有选项文件。
此模组并非用于位于 /config 目录中的标准模组配置文件,而是用于玩家选项,即由玩家在游戏中设置的选项。例如,设置默认的 JourneyMap 主题、图标或地图大小,更改默认按键绑定,或者设置其他默认情况下无法设置的选项。
更多默认选项?“More”是什么意思?
已经有一个名为 Default Options 的优秀模组,它能很好地创建默认的 options.txt 文件,但是像 JourneyMap 这样可以在游戏内配置的模组却面临着与 options.txt 文件相同的问题。整合包可以包含用于自定义 JourneyMap 的配置文件,但如果用户调整了 JourneyMap 的配置,未来的整合包更新将会覆盖这些用户设置。
这个模组受 Default Options 模组的启发,但其主要目标是在整合包中支持 JourneyMap 的配置,因为我个人发现许多 JourneyMap 的默认设置对我的整合包来说并不理想。
该模组还可以配置为在服务器、客户端或两者上复制特定的默认文件,允许整合包也在专用服务器上创建默认的世界生成选项(即 server.properties 文件)。
配置
此模组的配置文件(具有讽刺意味的是,默认情况下不会生成)基于 JSON,示例文件如下(你可以复制粘贴此示例文件以开始使用):
[
{
"sourceFilePath": "options.txt",
"destinationFilePath": "options.txt",
"clientSide": true,
"serverSide": false
},
{
"sourceFilePath": "journeymap.core.config",
"destinationFilePath": "journeymap/config/5.2/journeymap.core.config",
"clientSide": true,
"serverSide": true
},
{
"sourceFilePath": "journeymap.minimap.config",
"destinationFilePath": "journeymap/config/5.2/journeymap.minimap.config",
"clientSide": true,
"serverSide": false
}
]
请注意,JSON 必须是有效且无拼写错误的,否则模组将抛出异常并停止 Minecraft 的加载,这是为了设计上的考虑,以便整合包开发者可以快速纠正 JSON,而无需等待 Minecraft 完成加载。但是,如果配置文件不存在,模组会记录这一事实,卸载自身,然后允许游戏继续加载。有许多在线工具可以帮助你检查 JSON 是否有效,这个是我的最爱,显然,它不会捕捉拼写错误,但它肯定会捕捉格式错误(例如缺少的大括号、括号和逗号)。如果你有问题,欢迎在评论中发帖,我会尽力提供帮助(如果有时间的话)。
示例
我有一个使用我的模组 More Default Options 的整合包,所以如果你想查看配置文件的结构并测试其工作原理,请参阅我在 Curse 启动器上提供的名为 PureTech 的整合包。
目录结构
Curse 启动器在 Windows 上使用的典型目录结构示例可能是:
c:\Users\Steve\Documents\Curse\Minecraft\Instances\ModpackName
为了本示例的目的,让我们将上述目录称为 GameDir,因此通常你的游戏目录应如下结构化:
GameDir/
+ Config/
+ MoreDefaultOptions/
- Options.txt
- OtherDefaultFile.txt
- MoreDefaultOptions.json
+ Logs/
+ Mods/
+ ResourcePacks/
- manifest.json
- Options.txt
因此,配置文件 MoreDefaultOptions.json 将位于以下路径:
GameDir/Config/MoreDefaultOptions.json
……而默认文件应全部位于目录
GameDir/Config/MoreDefaultOptions/
我在 CurseForge 上维护的一个名为 PureTech 的整合包中已有一个可用的配置示例。如果你想下载并自行查看配置,可以前往该页面。此整合包会安装默认的 options.txt,以及 JourneyMap 的一组默认配置,如上文件夹截图所示。
其他配置说明
- 源默认文件必须始终存储在 MinecraftDir/config/MoreDefaultOptions/ 目录下。它们不能放置在子目录中,因此 JSON 配置文件中的 sourceFilePath 值仅为文件名。
- 默认文件的目的地是相对于游戏目录而言的,例如 options.txt 会被放置在游戏根目录。你不能使用如“../”之类的路径来向上遍历文件系统层级。destinationFilePath 不得以斜杠开头。
- 注意,在指定目录路径时,建议使用 Unix 风格的正斜杠“/”,因为它已在 Windows、Mac 和 Unix 系统上经过测试并正常工作;不过反斜杠“\”应该也能正常使用,不会出现问题。
- 如果你已配置好模组但似乎未生效,请检查日志文件(客户端或服务器端),因为启动期间记录的操作和错误信息将有助于你诊断任何问题。
- 从理论上讲,此模组可用于复制任何类型的文件(图片、音频文件,甚至其他模组),其原理相同:仅在目标位置不存在目标文件时才创建该文件。但这并非官方支持的功能。
- sourceFilePath 必须是文件,不能是目录。
杂项
我欢迎对本模组的改进建议,也欢迎在评论区留下反馈。如果你发现模组存在任何问题,请使用 CurseForge 项目页面 上的链接进行报告。
Overview
This mod is a highly customisable, yet extremely lightweight mod that allows modpack developers to create many custom default in game options. Not only does it support the vanilla options.txt file, but it also supports mods that are configured in game, for example, JourneyMap and FTB Utilities. Note that the mod has zero overhead once the game has loaded and will release all memory used before you start playing, as it is only used during the loading screen.
Purpose
It's generally a bad idea for modpack developers to ship files such as options.txt in their modpacks, as each time the modpack updates, user configured options would be overwritten by the version of the file that ships with the modpack. This is very frustrating for players, when they've spent time setting up their control keys, only to find the settings overwritten when the modpack is updated. However, when a modpack doesn't ship files such as options.txt, the modpack often ends up with many conflicting control key mappings, which can often break mods, or cause confusion for players.
This mod is designed to correct this problem, by copying custom config files to the game directories, but only when the file doesn't already exist. Essentially, the modpack maker's custom option files are only created when the modpack is first launched, and modpack updates will not attempt to overwrite any existing option files that might further customisations by the player.
This mod is not designed for standard mod config files that live in the /config directory, it is for player options, i.e. options set in game by the player. For example, set the default journey map theme, icons or map size, change the default key bindings, options that you otherwise can't set by default.
More Default Options? What's so "More" about it?
There's already a really good mod called Default Options, which does an excellent job of creating a default options.txt, however Mods such as JourneyMap that can be configured in game suffer from the same problem as the options.txt file. It's possible for the modpack to include the config files to customise JourneyMap, but if the user adjusts the JourneyMap configuration, future modpack updates would overwrite these user settings.
This mod was inspired by the Default Options mod, but its main objective was to support the configuration of JourneyMap in modpacks, as I personally find many of the JourneyMap defaults are not optimal for my modpacks.
The mod can also be configured to copy specific default files on either a server, client, or both, allowing modpacks to also create default world generation options on dedicated servers, (i.e. server.properties file).
Configuration
The configuration file for this mod (ironically, not generated by default) is JSON based, an example file is as follows (you can cut and paste this example file to get you started):
[
{
"sourceFilePath": "options.txt",
"destinationFilePath": "options.txt",
"clientSide": true,
"serverSide": false
},
{
"sourceFilePath": "journeymap.core.config",
"destinationFilePath": "journeymap/config/5.2/journeymap.core.config",
"clientSide": true,
"serverSide": true
},
{
"sourceFilePath": "journeymap.minimap.config",
"destinationFilePath": "journeymap/config/5.2/journeymap.minimap.config",
"clientSide": true,
"serverSide": false
}
]
Note that the JSON must be valid and be typo free, or the mod will throw an exception and stop Minecraft loading, this is by design to allow modpack developers to quickly correct the JSON without having to wait for Minecraft to complete loading, however if the configuration file is not present, the mod will log this fact, unload itself and then allow the game to continue loading. There are many online utilities to help you check the JSON is valid, this one is a favourite of mine, obviously, it won't catch typos, but it will certainly catch formatting errors (e.g. missing braces, parenthesis and commas). If you have problems, feel free to post in the comments, and I'll do my best to help (if time allows).
Example
I've got a modpack that uses my mod More Default Options, so if you're looking to see the structure of config files, and test how it works, please see my modpack called PureTech which is available on the Curse launcher.
Directory Structure
An example of a typical directory structure on Windows used by the Curse launcher, might be:
c:\Users\Steve\Documents\Curse\Minecraft\Instances\ModpackName
For the sake of this example, let's call this directory above, GameDir, so typically, your game dir should be structured as follows:
GameDir/
+ Config/
+ MoreDefaultOptions/
- Options.txt
- OtherDefaultFile.txt
- MoreDefaultOptions.json
+ Logs/
+ Mods/
+ ResourcePacks/
- manifest.json
- Options.txt
The configuration file MoreDefaultOptions.json, would therefore be found at:
GameDir/Config/MoreDefaultOptions.json
...and the default files should all be located in the directory
GameDir/Config/MoreDefaultOptions/
I have a working configuration in a modpack called PureTech that I maintain here on Curse, if you want to download and see the configuration for yourself. This modpack installs a default options.txt, and a default set of configuration for JourneyMap, as shown in the above folder screenshot.
Other Configuration Notes
- The source default files must be always be stored in MinecraftDir/config/MoreDefaultOptions/. They can't be placed in subdirectories, so the value of sourceFilePath in the JSON configuration file is simply a filename.
- The destination for the default files are relative to the game directory, so as options.txt would be placed in the top level game directory. You cannot use paths such as "../" to traverse higher in the file system hierarchy. The destinationFilePath must not start with a leading slash.
- Note, when specifying directory paths, I'd recommend using a unix style forward slash "/", as this has been tested and works on Windows, Mac and Unix, though a back slash "\" should work without any issues too.
- If you've configured the mod, and it doesn't appear to be working, check the log file (client or server), as it logs actions and errors during start up, which will help you diagnose any problems.
- This mod could theoretically be used to copy any type of file (images, audio files, even other mods), using the same principle of only creating the file in the desired location so long as the destination file doesn't already exist, though this isn't really a supported feature.
- The sourceFilePath must be a file, it cannot be a directory.
Miscellaneous
I'm open to suggestions for improving this mod, and welcome any feedback in the comments, if you find any issues with the mod, please report them using the links on the CurseForge project page.
评论 0
登录后参与评分
还没有评论,来抢沙发吧