Skip to content

Commit

Permalink
update icon and README
Browse files Browse the repository at this point in the history
  • Loading branch information
3093FengMing committed Dec 21, 2022
1 parent c755eda commit a355a98
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 9 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Vanilla Hardcoded Breaker(Vault Patcher)

[简体中文](README.md) [English](README_en_us.md)

### 硬编码->本地化字符串
### Let the hard coded change into localization string in some mods.

Expand Down Expand Up @@ -96,16 +98,17 @@ Vanilla Hardcoded Breaker会在`.minecraft\config\vaultpatcher`下生成config.j
简单解释下:

有一个GUI里面有`Close`(指关闭GUI)这个文本,另一个GUI也有`Close`(指关闭管道),

此时它们的含义不同,但是若不加上`target_class`,那么他们的翻译内容却是一样的。
所以要用到`target_class`

`target_class`中有三个键:`name``mapping``stack_depth`

### 类名(name)
类名的匹配规则大概是这样的:
*`#`开头的字符串会视为模糊匹配(示例:`#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``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``net.minecraft.client.gui.screens.titlescreen`
但不匹配`net.minecraft.client.gui.titlescreen.screens`

### 映射(mapping)
Expand Down Expand Up @@ -136,7 +139,7 @@ TRANSFORMER/minecraft@1.18.2/net.minecraft.client.gui.screens.TitleScreen(TitleS
"value":"Mojang AB."
}
```
此时便能精准的定位到`net.minecraft.client.gui.screens.TitleScreen`这个类
此时便能精准的定位到`net.minecraft.client.gui.screens.TitleScreen`这个类

### 参考配置
**_(用于Vault Hunter 3rd Edition)_**
Expand Down
184 changes: 184 additions & 0 deletions README_en_us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Vanilla Hardcoded Breaker(Vault Patcher)

[简体中文](README.md) [English](README_en_us.md)

### Hardcoded -> Localization
### Let the hard coded change into localization string in some mods.

## Basic Config
`Vanilla Hardcoded Breaker` will generate config.json in `.minecraft\config\vaultpatcher`
(Hereinafter collectively referred to as ***Config File***)

The format of the config file is roughly as follows:
```json
[
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":-1
},
"key":"I'm key",
"value":"Im value"
},
{
"target_class":{
"name":"me.modid.item.relics",
"mapping":"SRG",
"stack_depth":3
},
"key":"Dragon Relic",
"value":"namespace.modify.modid.item.relics.dragonrelic"
},
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":0
},
"key":"Talents",
"value":"namespace.modify.the_vault.gui.talnets"
}
]
```
Where
```json
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":-1
},
"key":"I'm key",
"value":"Im value"
}
```
is a Translate Key Value Pair Objects, this object includes`key`, `value` and `target_class`.

### Key & Value
`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!"`.

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

This completes a basic key value pair.
If there is no mistake, it should be as follows:
```json
{
"key":"Copyright Mojang AB. Do not distribute!",
"value":"Mojang AB."
}
```

However, this is not enough,
you must add `target_class`.

For Example:
```json
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Copyright Mojang AB. Do not distribute!",
"value":"Mojang AB."
}
```

## Advanced Config

### Target Class

`target_class`, this object is mainly used to specify different `value` of two identical `key`.
Simple explanation:

Now there is a GUI with `Close` button (Refers to close the GUI), and there is another gui with `Close` button (Refers to close the Pipe),

they have different meanings, but if not added `target_class`, then their translation content is the same.
So we need`target_class`.

`target_class` has three keys: `name`, `mapping` and `stack_depth`.

### Name
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`
but will not match `net.minecraft.client.gui.titlescreen.screens`)
* The string does not start with `#`, 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`)

### Mapping
Reserved Field.

### Stack Depth
The stack depth is used for more accurate matching classes in the stack,
for example, in the following stack:
```
java.base/java.lang.Thread.getStackTrace(Thread.java:1610),
TRANSFORMER/minecraft@1.18.2/net.minecraft.network.chat.TextComponent.handler$zza000$proxy_init(TextComponent.java:531),
TRANSFORMER/minecraft@1.18.2/net.minecraft.client.gui.screens.TitleScreen(TitleScreen.java:3),
...
```
`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.

For Example:
```json
{
"target_class":{
"name":"net.minecraft.client.gui.screens.TitleScreen",
"mapping":"SRG",
"stack_depth":2
},
"key":"Copyright Mojang AB. Do not distribute!",
"value":"Mojang AB."
}
```
Now, you can accurately locate the class `net.minecraft.client.gui.screens.TitleScreen`.

### Sample Config
**_(For Vault Hunter 3rd Edition)_**
```json
[
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":0
},
"key":"Attack Damage",
"value":"namespace.modify.the_vault.gui.attackdamage"
},
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":0
},
"key":"Dragon Relic",
"value":"namespace.modify.the_vault.item.relics.dragonrelic"
},
{
"target_class":{
"name":"",
"mapping":"SRG",
"stack_depth":0
},
"key":"Talents",
"value":"namespace.modify.the_vault.gui.talnets"
}
]
```
If you look carefully, you will find that `target_class` key is rarely used in config.

## Others
#### Author:FengMing([github](https://github.com/3093FengMing))
#### Configuration Author:teddyxlandlee([github](https://github.com/teddyxlandlee))
#### Idea:yiqv([github](https://github.com/yiqv))
#### Mod Link:[github](https://github.com/3093FengMing/VaultPatcher)[mcmod](.)[bilibili](.)
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.2+1.18.2'
version = 'forge-1.2.3+1.18.2'
group = 'me.fengming.vaultpatcher' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'vaultpatcher'

Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft versio
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="GNU General Public License v3.0"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
issueTrackerURL="https://github.com/3093FengMing/VaultPatcher/issues"
# A list of mods - how many allowed here is determined by the individual mod loader
logoFile="icon.png"
[[mods]] #mandatory
# The modid of the mod
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.2+1.18.2" #mandatory
# A display name for the mod
version="1.2.3+1.18.2" #mandatory
# A display name for the mod
displayName="Vanilla Hardcoded Bearker" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
displayURL="https://github.com/3093FengMing/VaultPatcher" #optional
# A text field displayed in the mod UI
authors="FengMing, teddyxlandlee" #optional
# The description text for the mod (multi line!) (#mandatory)
Expand Down
Binary file added src/main/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a355a98

Please sign in to comment.