Skip to content

Commit

Permalink
update readme and zh_tw.json
Browse files Browse the repository at this point in the history
  • Loading branch information
3093FengMing committed Jan 13, 2023
1 parent 5f1d5c2 commit 2b45f94
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 19 deletions.
79 changes: 72 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,27 @@

# 配置文件

## 模块化

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

`config.json`是必须的,`config.json`定义了`模块.json`
`config.json`如下:
```json
{
"mods": [
"模块"
]
}
```
这样`模块.json`才会被正常读取读取并使用

## 基础配置

Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文统称***配置文件***
~~Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文统称***配置文件***~~

[节-模块化](#模块化)

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

Expand All @@ -23,7 +41,7 @@ Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文
"stack_depth": -1
},
"key": "I'm key",
"value": "I'm value"
"value": "@I'm value"
},
{
"target_class": {
Expand All @@ -50,7 +68,7 @@ Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文
[
{
"key": "I'm key",
"value": "I'm value"
"value": "@I'm value"
},
{
"key": "Dragon Relic",
Expand Down Expand Up @@ -79,21 +97,53 @@ Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文

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

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

#### 键(Key)
`key`,顾名思义,指定的是要翻译的字符串。

如果我想翻译标题界面的``Copyright Mojang AB. Do not distribute!``
那么可以指定`"key":"Copyright Mojang AB. Do not distribute!"`

#### 值(Value)

有了键,还得有值。

那么我想将``Copyright Mojang AB. Do not distribute!``改为``Mojang AB.``
那就可以指定`"value":"Mojang AB."`

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

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

例子:
```json
{
"key": "Grass",
"value": "@CAO"
}
```
这样就会把所有的`Grass`都替换为`CAO`(包括`Grass Block``Grass``Tall Grass`


这样一个基础的键值对就完成了。
应该是这样子的:

```json
{
"target_class": {
"name": "",
"mapping": "SRG",
"stack_depth": 0
},
"key": "Copyright Mojang AB. Do not distribute!",
"value": "Mojang AB."
}
```
或者
```json
{
"key": "Copyright Mojang AB. Do not distribute!",
Expand Down Expand Up @@ -137,10 +187,22 @@ Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文

类名的匹配规则大概是这样的:

*`#`开头的字符串会视为模糊匹配(示例:`#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`
* 不以`#`开头的字符串会视为全匹配(示例:`net.minecraft.client.gui.screens.TitleScreen`会匹配`net.minecraft.client.gui.screens.TitleScreen`

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

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

#### 完全匹配

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

Expand All @@ -150,6 +212,9 @@ Vault Patcher会在`.minecraft\config\vaultpatcher`下生成config.json(下文

### 堆栈深度(stack depth)

#### **(Tips: 过于复杂,不建议新手用)**
#### **(作者其实也不会)**

堆栈深度在堆栈中用于更精准的匹配类,
例如在如下堆栈中

Expand Down Expand Up @@ -226,4 +291,4 @@ TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.TitleScreen(TitleS

#### 想法:yiqv([github](https://github.com/yiqv))

#### Mod地址:[github](https://github.com/3093FengMing/VaultPatcher)[mcmod]()[bilibili]()
#### Mod地址:[github](https://github.com/3093FengMing/VaultPatcher)[mcmod](https://www.mcmod.cn/class/8765.html)[bilibili]()
79 changes: 67 additions & 12 deletions README_en_us.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,29 @@

# Configs

## 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`.

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

`config.json` is as follows:
```json
{
"mods": [
"module"
]
}
```
Only in this way can `module.json` read and used normally.

## Basic Config

`Vault Patcher` will generate config.json in `.minecraft\config\vaultpatcher`
(Hereinafter collectively referred to as ***Config File***)
~~`Vault Patcher` will generate config.json in `.minecraft\config\vaultpatcher`
(Hereinafter collectively referred to as ***Config File***)~~

See for [Section-Modular](#Modular)

The format of the config file is roughly as follows:

Expand All @@ -24,7 +43,7 @@ The format of the config file is roughly as follows:
"stack_depth": -1
},
"key": "I'm key",
"value": "I'm value"
"value": "@I'm value"
},
{
"target_class": {
Expand All @@ -51,7 +70,7 @@ or
[
{
"key": "I'm key",
"value": "I'm value"
"value": "@I'm value"
},
{
"key": "Dragon Relic",
Expand All @@ -74,24 +93,45 @@ Where
"stack_depth": -1
},
"key": "I'm key",
"value": "Im value"
"value": "@I'm value"
}
```

is a Translate Key Value Pair Objects, this object includes`key`, `value` and `target_class`.

### Key & Value
### Key Value Pairs

#### Key
`key`, as the name implies, it refers to the string to be translated.

If you want to translate the `Copyright Mojang AB. Do not distribute!` in the title screen,
you can type `"key":"Copyright Mojang AB. Do not distribute!"`.

#### Value

With keys, there must be values.

So if you want to change `Copyright Mojang AB. Do not distribute!` to `Mojang AB.`.
you can type `"value":"Mojang AB."`.

#### Semi-match
#### (1.2.5+)

All of the above methods are full match (that is, full replace), and only replace the same text as `key`.

If you want to semi-match, or the original string contains formatted text (such as `§a`, `%d`, `% s`, etc.),
you can try to add the `@` character before the string of `value` to achieve semi-matching.

For Example:
```json
{
"key": "Grass",
"value": "@GLASS"
}
```
This will replace all `GLASS` with `Grass` (such as `Grass Block`, `Grass`, `Tall Grass`, etc.)


This completes a basic key value pair.
If there is no mistake, it should be as follows:

Expand Down Expand Up @@ -139,10 +179,24 @@ So we need`target_class`.

The matching rules of `name` are as follows:

* The string starts with `#`, will be regarded as fuzzy match (For Example: `#TitleScreen` will
match `net.minecraft.client.gui.screens.TitleScreen` and `net.minecraft.client.gui.screens.titlescreen`
#### Class Match

* The string starts with `#`, will be regarded as Class Match (For Example: `#TitleScreen` will
match `net.minecraft.client.gui.screens.TitleScreen`
and `net.minecraft.client.gui.screens.titlescreen`.
but will not match `net.minecraft.client.gui.titlescreen.screens`)
* The string does not start with `#`, will be considered as a full match (For

#### 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`
and `net.minecraft.client.gui.screens.BeaconScreen`.
Also match `net.minecraft.client.gui.titlescreen.screens`)

#### Full Match

* The string does not start with `#` or `@`, will be considered as a full match (For
Example: `net.minecraft.client.gui.screens.TitleScreen` will match `net.minecraft.client.gui.screens.TitleScreen`
and `net.minecraft.client.gui.screens.titlescreen`
but will not match `net.minecraft.client.gui.titlescreen.screens`)
Expand All @@ -153,8 +207,8 @@ Reserved Field.

### Stack Depth

The stack depth is used for more accurate matching classes in the stack,
for example, in the following stack:
The stack depth is used for more accurate matching classes in the stack.
For example:

```
java.base/java.lang.Thread.getStackTrace(Thread.java:1610),
Expand All @@ -163,6 +217,7 @@ TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.TitleScreen(TitleS
...
```

In the example.
`stack_depth` of `net.minecraft.client.gui.screens.TitleScreen` is 2.
The size of `stack_depth` depends on the position of the stack to be located in the array,
Use `stack_depth`, `name` cannot be fuzzy match.
Expand Down Expand Up @@ -229,4 +284,4 @@ If you look carefully, you will find that `target_class` key is rarely used in c

#### Idea:yiqv([github](https://github.com/yiqv))

#### Mod Link:[github](https://github.com/3093FengMing/VaultPatcher)[mcmod](.)[bilibili](.)
#### Mod Link:[github](https://github.com/3093FengMing/VaultPatcher)[mcmod](https://www.mcmod.cn/class/8765.html)[bilibili](.)
6 changes: 6 additions & 0 deletions src/main/resources/assets/vaultpatcher/lang/zh_tw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commands.vaultpatcher.export.tips.success": "完成!導出到langpatcher.json",
"commands.vaultpatcher.export.warning.wip": "警告:此功能仍是*WIP*!",
"commands.vaultpatcher.list.warning.wip": "警告:此功能仍是*WIP*!",
"commands.vaultpatcher.list.tips.modslist": "以下為已加載的模塊列表:"
}

0 comments on commit 2b45f94

Please sign in to comment.