MEOWS
我现有的设置将会保留
这是什么?
类似于 YOSBR
或 Configured Defaults,此模组提供了一种在启动 Minecraft 时复制默认游戏文件的方法。
这对于需要包含配置文件但不想在每次更新后重置用户修改的整合包制作者来说非常有用。
与上述模组不同,MEOWS 实现了一个“操作”系统,允许在启动期间执行某些操作,例如覆盖或删除指定文件。这些操作仅运行一次。
如何使用?
defaults 目录中的每个文件都会被复制到游戏根目录下的相应位置。例如,如果 .minecraft/options.txt 尚不存在,则 .minecraft/defaults/options.txt 将被复制到 .minecraft/options.txt。
可以通过 config/meows/config.json 文件对此模组进行配置。这包括当前默认文件的版本(用于操作),以及每个版本要执行的操作。如果想让 MEOWS 像 YOSBR 或 Configured Defaults 那样工作,可以忽略这些选项。
操作以对象数组的形式存储,每个对象包含一个要覆盖或删除的文件数组以及相应的版本。以下是一个将覆盖 options.txt 文件的示例:
{
"version": 2,
"actions": [
{
"version": 2,
"overwrite": [
"options.txt"
]
}
]
}
当游戏启动时,如果尚未执行过,MEOWS 将执行这些操作。随后本地 MEOWS 版本将会更新,以防止再次执行这些操作。
对于覆盖操作,defaults 目录中必须存在对应的文件。
{
"version": 3,
"actions": [
{
"version": 3,
"delete": [
"options.txt"
]
},
{
"version": 2,
"overwrite": [
"options.txt"
]
}
]
}
在此示例中,最上方的操作具有优先级。尽管在上一个版本中被覆盖,但 options.txt 仍会被删除。
请注意,如果 options.txt 文件仍然包含在 defaults 目录中,它将在下次游戏启动时作为非存在文件被复制,因为操作只处理一次。
为什么?
根据我维护整合包的经验,我发现类似的模组在一个关键方面有所欠缺:整合包作者如何控制文件更改? 毕竟,它们仅在文件不存在时才复制文件,这意味着无法进行重大的配置文件更改或更新已生成的文件。MEOWS 通过其操作系统的单次文件操作方法解决了这个问题。
常见问题
会移植到其他加载器吗?
未来可能会。
会移植到更多的 Minecraft 版本吗?
未来可能会。
为什么使用 preLaunch 而不是作为 Fabric 上的语言提供程序?
理想情况下,这个模组应该绝对易于维护。因此,我在许多架构决策上选择了“正确”的方式, notably 避免了其他类似模组使用的 hacky 语言提供程序方法以便尽快运行。这确实意味着一些其他模组可能在 MEOWS 能够复制它们的默认文件之前创建文件。然而,我发现这种情况并不常见,因此并不是什么大问题。
MEOWS
my existing options will survive
What?
Similar to YOSBR
or Configured Defaults, this mod provides a way to copy default game
files when Minecraft is started.
This is useful for mod pack creators who need to include configuration files but don't want to reset user changes after
every update.
Different from the aforementioned mods, MEOWS implements an "actions" system, in which certain actions can be performed
during startup, such as overwriting or deleting specified files. Actions will only run once.
How?
Every file in the defaults directory will be copied to their relevant places in the game's root directory. For
example, .minecraft/defaults/options.txt will be copied to .minecraft/options.txt if the file doesn't already exist.
The mod can be configured from the config/meows/config.json file. This includes the current version of the default
files (for actions), and the actions to perform per each version. To use MEOWS like YOSBR or Configured Defaults, these
options can be ignored.
Actions are stored as an array of objects, each containing an array of files to overwrite or delete and the relevant
version. Here's an example that will overwrite the options.txt file:
{
"version": 2,
"actions": [
{
"version": 2,
"overwrite": [
"options.txt"
]
}
]
}
When the game is started, MEOWS will perform these actions if it hasn't already. The local MEOWS version will then be
updated so these actions cannot be performed again.
For overwrite actions, the file must have a corresponding file located in the defaults directory.
{
"version": 3,
"actions": [
{
"version": 3,
"delete": [
"options.txt"
]
},
{
"version": 2,
"overwrite": [
"options.txt"
]
}
]
}
In this example, the top-most action will take precedence. options.txt will be deleted, despite being overwritten in
the previous version.
Note that, if the options.txt file is still included in the defaults directory, it will be copied if non-existent
when the game is next started as actions are only processed once.
Why?
From my experience maintaining mod packs, I've found that similar mods are lacking in one crucial way: how could a mod
pack author control file changes? After all, they only copy files if they don't already exist, meaning that major
configuration file changes or updating files that have already been generated are impossible. MEOWS solves this issue
with its actions system, providing the method of performing one-time operations on files.
FAQ
Will this be ported to more mod loaders?
In the future, probably.
Will this be ported to more Minecraft versions?
In the future, probably.
Why does this use preLaunch rather than serving as a language provider on Fabric?
Ideally, this mod should be absolutely effortless to maintain. As such, I opted for the "right" ways when it came to
many architectural decisions, notably avoiding the hacky language provider method other similar mods use in order to run
as soon as possible. This does mean that some other mods might create files before MEOWS is able to copy their defaults.
However, I've found that these cases are uncommon enough to where it's not much of an issue.
评论 0
登录后参与评分
还没有评论,来抢沙发吧