Skip to content

Commit

Permalink
update readme and mod infos
Browse files Browse the repository at this point in the history
1.2.6 will come soon.
  • Loading branch information
3093FengMing committed Jan 17, 2023
1 parent 228f9ca commit f41c1f5
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 35 deletions.
53 changes: 33 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,48 @@

# 配置文件

## 模块化
## 配置

在1.2.5以后,配置文件均采用模块的形式
`config/vaultpatcher/`下的格式为`config.json``模块.json`
`config/vaultpatcher/`下的格式为`config.json`和若干个`模块.json`

`config.json`是必须的`config.json`定义了`模块.json`
`config.json`如下:
`config.json`是必须的
如下:
```json
{
"mods": [
"模块"
]
],
"debug_mode": {
"is_enable": false,
"output_mode": 0,
"output_format": "<source> -> <target>"
}
}
```
这样`模块.json`才会被正常读取读取并使用
### 模块(mods)
`config.json`定义了`模块.json`
`模块.json`才会被正常读取读取并使用。反之亦然。

### 调试模式(Debug Mode)
**(Tips: 仅供调试使用)**

## 基础配置
`is_enable`决定调试功能是否开启。
若为`true`,那么会在替换字符串时向日志中输出一行调试信息,调试信息的格式由`output_format`决定,调试信息的内容由`output_mode`决定。
若为`false`,则不会在替换字符串时向日志中输出任何内容。

~~Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文统称***配置文件***~~
`output_format`决定了调试信息的格式,默认为`<source> -> <target>`
`<source>`为源内容,即未做替换前的字符串;`<target>`为做替换后的字符串。
还有一个`<stack>`未展示出来,因为输出的很多,容易污染日志。
`<stack>`为堆栈跟踪数组,是此字符串所在类的`StackTrace`(包括本mod),它更多是为`target_class`中的`stack_depth``name`服务的。

[节-模块化](#模块化)
`output_mode`决定了调试信息的内容。
若为 0, 则仅输出替换的字符串;
若为 1, 则仅输出不被替换的字符串。

配置文件的格式大概这样:
## 模块

模块的格式大概这样:

```json
[
Expand Down Expand Up @@ -97,7 +116,7 @@

就是一个翻译键值对,主要涉及到`key``value``target_class`

### 键值对(key value pair)
### 键值对(key-value pair)

#### 键(Key)
`key`,顾名思义,指定的是要翻译的字符串。
Expand All @@ -113,11 +132,10 @@
那就可以指定`"value":"Mojang AB."`

#### 半匹配
#### (1.2.5+)
以上的方式均为全匹配(即完全替换),只替换与`key`相同的文本。

如果你想半匹配,或者原字符串中有格式化文本(例如`§a``%d``%s`等)。
那么可以在`value`的前面加上'@'字符,实现半匹配。
那么可以在`value`的前面加上`@`字符,实现半匹配。

例子:
```json
Expand Down Expand Up @@ -151,10 +169,6 @@
}
```

~~然而,光有这点东西是无法使用的。
你还得加上虽然基本用不到但是还是要加上的``target_class``~~
(1.2.4及以上不需要)

例如

```json
Expand Down Expand Up @@ -189,14 +203,13 @@

#### 类匹配

*`#`开头的字符串会视为半匹配(示例:`#TitleScreen`会匹配`net.minecraft.client.gui.screens.TitleScreen`
*`#`开头的字符串会视为类匹配(示例:`#TitleScreen`会匹配`net.minecraft.client.gui.screens.TitleScreen`
`net.minecraft.client.gui.screens.titlescreen`
但不匹配`net.minecraft.client.gui.titlescreen.screens`

#### 包匹配
#### (1.2.5+)

*`@`开头的字符串会视为半匹配(示例:`#net.minecraft.client`会匹配`net.minecraft.client.gui.screens.TitleScreen`
*`@`开头的字符串会视为包匹配(示例:`#net.minecraft.client`会匹配`net.minecraft.client.gui.screens.TitleScreen`
`net.minecraft.client.gui.screens.BeaconScreen`等等
也匹配`net.minecraft.client.gui.titlescreen.screens`

Expand Down
45 changes: 32 additions & 13 deletions README_en_us.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,53 @@

### Let the hard coded strings change into localization strings in some mods.

# Configs
# Configs File

## Modular

After 1.2.5, config files are in the form of modules,
the format in `config/vaultpatcher/` directory like is `config.json`, `module.json`.
the format in `config/vaultpatcher/` directory like is `config.json` and several `module.json`.

`config.json` must be provided, `config.json` defined `module.json`.

`config.json` is as follows:
`config.json` must be provided.
It is as follows:
```json
{
"mods": [
"module"
]
],
"debug_mode": {
"is_enable": false,
"output_mode": 0,
"output_format": "<source> -> <target>"
}
}
```

### Mods
`config.json` defined `module.json`.
Only in this way can `module.json` read and used normally.

## Basic Config
### Debug Mode
**(Tips: ONLY DEBUG)**

~~`Vault Patcher` will generate config.json in `.minecraft\config\vaultpatcher`
(Hereinafter collectively referred to as ***Config File***)~~
`is_enable` determines whether the debugging feature is enabled.
If it is `true`, a line of debugging information will be output to the log when replacing the string,
The format of debugging information is `output_format`, and determines the content of debugging information by `output_format`.
If it is `false`, Will not output anything to the log when replacing the string.

See for [Section-Modular](#Modular)
`output_format` determines the format of debugging information. The default is `<source> -> <target>`.
`<source>` is the source string, that is, the string before replacement. and `<target>`is the replacement string.
There is another `<stack>` that is not shown, if you include it in `output_format`,
the log will be polluted because of the large amount of output information.
`<stack>` is a stacktrace array, which is the `StackTrace` (including this mod) of the class of this string,
This value is more for `stack_depth` and `name` in `target_class`.

The format of the config file is roughly as follows:
`output_mode` determines the content of debugging information.
If it is 0, only the replaced string will be output,
If it is 1, only the strings that are not replaced are output.

## Module

The format of the Module File is roughly as follows:

```json
[
Expand Down Expand Up @@ -187,7 +207,6 @@ The matching rules of `name` are as follows:
but will not match `net.minecraft.client.gui.titlescreen.screens`)

#### Package Match
#### (1.2.5+)

* The string starts with `@`, will be regarded as Package Match (For Example: `#net.minecraft.client` will
match `net.minecraft.client.gui.screens.TitleScreen`
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'


version = 'forge-1.2.5+1.18.2'
version = 'forge-1.2.6+1.18.2'
group = 'me.fengming.vaultpatcher' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'vaultpatcher'

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ modId = "vaultpatcher" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version = "1.2.5+1.18.2" #mandatory
version = "1.2.6+1.18.2" #mandatory
# A display name for the mod
displayName = "Vault Patcher" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
Expand Down

0 comments on commit f41c1f5

Please sign in to comment.