-
Notifications
You must be signed in to change notification settings - Fork 0
Rules EN
This page documents every field currently implemented in config/item_nameplate_rules.json, including syntax and processing order. The root object must contain an entries array, with one label rule per object.
This ready-to-use rule matches tipped arrows, reads their item name, removes Chinese and English arrow wording, then replaces common effect names.
{
"desc": "Tipped arrow label",
"target": {
"type": "item",
"value": "minecraft:tipped_arrow"
},
"text_source": {
"type": "item_name"
},
"remove_text": ["之箭", "Arrow of "],
"replace": {
"瞬间治疗": "治疗",
"Instant Health": "Healing"
},
"priority": 10
}Only one matching rule is used.
- Higher
prioritywins. - For equal priority, the earlier entry in
entrieswins. - The default priority is
0.
For example, a specific smithing-template tag rule can use priority 10, while a general class rule uses 9.
target is required and must contain type and value. One rule chooses exactly one matching strategy.
type |
value syntax |
Match behavior |
|---|---|---|
item |
namespace:item_path |
One exact item. |
tag |
namespace:tag_path |
Every item in the item tag. |
class |
Fully qualified item Java class | The class and all subclasses. |
{
"target": {
"type": "item",
"value": "minecraft:enchanted_book"
}
}{
"target": {
"type": "tag",
"value": "minecraft:trim_templates"
}
}The built-in upgrade-template tag is:
{
"target": {
"type": "tag",
"value": "item_nameplate:smithing_templates"
}
}The class must load on the current client and inherit net.minecraft.world.item.Item.
{
"target": {
"type": "class",
"value": "net.minecraft.world.item.SpawnEggItem"
}
}All vanilla smithing templates use:
{
"target": {
"type": "class",
"value": "net.minecraft.world.item.SmithingTemplateItem"
}
}type |
Required field | Source |
|---|---|---|
item_name |
None | Current item display name. |
nbt |
path |
A string at an NBT path. |
tooltip |
index |
A normal vanilla tooltip line; the first line is 0. |
{
"text_source": {
"type": "item_name"
}
}For item_name, prepend, source-level replace, split, join, and i18n inside text_source are not processed. Use root-level remove_text and replace instead.
{
"text_source": { "type": "item_name" },
"remove_text": [" Spawn Egg", "刷怪蛋"],
"replace": {
"Instant Health": "Healing",
"瞬间治疗": "治疗"
}
}nbt reads only a path whose final value is a string tag. Use . for compound tags and [non-negative index] for list elements. Wildcards, quoted keys, negative indexes, and non-string final values are not supported.
{
"text_source": {
"type": "nbt",
"path": "display.Name"
}
}The first enchantment ID in an enchanted book is:
{
"text_source": {
"type": "nbt",
"path": "StoredEnchantments[0].id"
}
}Missing paths, out-of-range list indexes, and non-string final values fall back to the original item name.
tooltip.index is zero-based and reads normal, non-advanced tooltip lines.
{
"text_source": {
"type": "tooltip",
"index": 1
}
}Smithing templates use “Smithing Template” as line 0; their specific upgrade or trim name is line 1. Like item_name, tooltip sources use root-level processing rather than NBT-only fields.
The fields below work only when text_source.type is nbt.
Adds a prefix before the raw NBT value.
{
"text_source": {
"type": "nbt",
"path": "StoredEnchantments[0].id",
"prepend": "enchantment."
}
}minecraft:mending becomes enchantment.minecraft:mending.
This source-level replacement map runs after NBT splitting and joining. Replacements execute in JSON order.
{
"text_source": {
"type": "nbt",
"path": "StoredEnchantments[0].id",
"prepend": "enchantment.",
"replace": {
":": "."
}
}
}With i18n: true, the processed NBT text is treated as a Minecraft translation key.
{
"text_source": {
"type": "nbt",
"path": "StoredEnchantments[0].id",
"prepend": "enchantment.",
"replace": { ":": "." },
"i18n": true
}
}It does not translate ordinary English text automatically. A missing key displays as the key itself.
split.separator is required and cannot be empty. It is a literal separator, not a regular expression. Optional split.index is zero-based; omit it to keep all segments for join.
{
"text_source": {
"type": "nbt",
"path": "example",
"split": {
"separator": ":",
"index": 0
}
}
}For minecraft:mending, this yields minecraft. An invalid index falls back to the original item name.
join.separator is required. It joins all split results; join.prepend and join.append are optional. Root prepend is applied before join.prepend.
{
"text_source": {
"type": "nbt",
"path": "example",
"split": { "separator": ":" },
"join": {
"separator": "/",
"prepend": "[",
"append": "]"
}
}
}For minecraft:mending, this yields [minecraft/mending].
These fields are peers of text_source and work with all three source types.
An ordered array of literal strings to delete everywhere in the result. Removal is case-sensitive.
{
"remove_text": ["Splash Potion of ", "喷溅型", "药水"]
}Splash Potion of Healing becomes Healing.
The root-level replacement map runs after remove_text and works with item names, tooltips, and NBT.
{
"replace": {
"Instant Health": "Healing",
"瞬间治疗": "治疗"
}
}For NBT sources, text_source.replace runs first, then root remove_text, then root replace.
- Read the item name or selected tooltip line.
- Run root
remove_textin array order. - Run root
replacein JSON order. - Trim outer whitespace; an empty result falls back to the original item name.
- Clip the label to the actual pixel width of one item slot and render it.
- Read the string at
path. - Split with
split; keep onlysplit.indexwhen provided. - Join with
join, or use the first segment; addprepend,join.prepend, andjoin.append. - Run
text_source.replace. - Localize with
i18nwhen enabled. - Run root
remove_text. - Run root
replace. - Trim whitespace; on an empty result or failed read, use the original item name.
- Clip and render to one item slot.
{
"desc": "Display the first enchantment",
"target": {
"type": "item",
"value": "minecraft:enchanted_book"
},
"text_source": {
"type": "nbt",
"path": "StoredEnchantments[0].id",
"prepend": "enchantment.",
"replace": { ":": "." },
"i18n": true
},
"priority": 20
}{
"desc": "All spawn eggs",
"target": {
"type": "class",
"value": "net.minecraft.world.item.SpawnEggItem"
},
"text_source": { "type": "item_name" },
"remove_text": [" Spawn Egg", "刷怪蛋"],
"priority": 10
}{
"desc": "All armor trim templates",
"target": {
"type": "tag",
"value": "minecraft:trim_templates"
},
"text_source": {
"type": "tooltip",
"index": 1
},
"remove_text": [" Armor Trim", "盔甲纹饰"],
"priority": 10
}