An unofficial Fabric Port of Vault Patcher. Let the hard coded strings change into localization strings in some mods.
ZH-CN / English
The format in config/HardcodePatcher/ directory like is config.json and several module.json. (Module files are currently required to exist in one or more of the Fabric versions)
config.json must be provided.
It is as follows:
{
"mods": [
"module"
],
"debug_mode": {
"is_enable": false,
"output_mode": 0,
"output_format": "<source> -> <target>"
},
"optimize_params": {
"disable_export": true,
"stack_min": -1,
"stack_max": -1
}
}config.json defined module.json.
Only in this way can module.json read and used normally.
Can be used when debugging and finding text.
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_mode.
output_format determines the format of debugging information. The default is <source> -> <target>.
<source>: Source string, the string before replacement.<target>: The replacement string.<stack>: Stacktrace array, which is theStackTrace(including this mod) of the class of this string.<method>: The method called when this text rendering.
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.
Optimize the parameters of the algorithm.
disable_export determines whether to disable the export feature, which is very useful for optimization.
But at the same time, /vaultpatcher export will also be disabled.
The default is false.
stack_min and stack_max determines the upper and lower limits of the stack trace array,
and the optimization effect can be achieved by properly adjusting the parameters.
The default is -1 (The upper and lower limits are not changed).
The format of the Module File is roughly as follows:
[
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": -1
},
"key": "I'm key",
"value": "@I'm value"
},
{
"target_class": {
"name": "me.modid.item.relics",
"mapping": "Intermediaty",
"stack_depth": 3
},
"key": "Dragon Relic",
"value": "namespace.modify.modid.item.relics.dragonrelic"
},
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": 0
},
"key": "Talents",
"value": "namespace.modify.the_vault.gui.talnets"
}
]or
[
{
"key": "I'm key",
"value": "@I'm value"
},
{
"key": "Dragon Relic",
"value": "namespace.modify.modid.item.relics.dragonrelic"
},
{
"key": "Talents",
"value": "namespace.modify.the_vault.gui.talnets"
}
]. Where
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": -1
},
"key": "I'm key",
"value": "@I'm value"
}is a Translate Key Value Pair Objects, this object includeskey, value and target_class.
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.".
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:
{
"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:
{
"key": "Copyright Mojang AB. Do not distribute!",
"value": "Mojang AB."
}For Example:
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": -1
},
"key": "Copyright Mojang AB. Do not distribute!",
"value": "Mojang AB."
}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 needtarget_class.
target_class has three keys: name, mapping and stack_depth.
The matching rules of name are as follows:
- The string starts with
#, will be regarded as Class Match (For Example:#TitleScreenwill matchnet.minecraft.client.gui.screen.TitleScreenandnet.minecraft.client.gui.screen.titlescreen. but will not matchnet.minecraft.client.gui.titlescreen.screen)
- The string starts with
@, will be regarded as Package Match (For Example:#net.minecraft.clientwill matchnet.minecraft.client.gui.screen.TitleScreenandnet.minecraft.client.gui.screen.DeathScreen. Also matchnet.minecraft.client.gui.titlescreen.screen)
- The string does not start with
#or@, will be considered as a full match (For Example:net.minecraft.client.gui.screen.TitleScreenwill matchnet.minecraft.client.gui.screen.TitleScreenandnet.minecraft.client.gui.screen.titlescreenbut will not matchnet.minecraft.client.gui.titlescreen.screen)
Reserved Field.
The stack depth is used for more accurate matching classes in the stack. For example:
java.base/java.lang.Thread.getStackTrace(Thread.java:1610),
TRANSFORMER/minecraft@1.18.2/net.minecraft.client.gui.screen.TitleScreen(TitleScreen.java:3),
...
In the example.
stack_depth of net.minecraft.client.gui.screen.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:
{
"target_class": {
"name": "net.minecraft.client.gui.screen.TitleScreen",
"mapping": "Intermediaty",
"stack_depth": 2
},
"key": "Copyright Mojang AB. Do not distribute!",
"value": "Mojang AB."
}Now, you can accurately locate the class net.minecraft.client.gui.screen.TitleScreen.
(For Vault Hunter 3rd Edition)
[
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": 0
},
"key": "Attack Damage",
"value": "namespace.modify.the_vault.gui.attackdamage"
},
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"stack_depth": 0
},
"key": "Dragon Relic",
"value": "namespace.modify.the_vault.item.relics.dragonrelic"
},
{
"target_class": {
"name": "",
"mapping": "Intermediaty",
"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.
-
Original Author:FengMing
-
Configuration Author:teddyxlandlee
-
Idea:yiqv