Skip to content

Fix an item name that shows as item.modid.name (Minecraft mod)

The game shows the translation key when it finds no text for it. The key is built from the thing’s registry id: item.<mod id>.<name> for an item, block.<mod id>.<name> for a block, entity.<mod id>.<name> for a mob. Put each key and its text into assets/<mod id>/lang/en_us.json (en_us.lang on 1.12.2). Check the key matches the id exactly, that the file is valid JSON (no trailing comma) and that the lowercase file name is en_us.json. Other languages use their own file, such as de_de.json.

Works on Minecraft 1.20.1 to 26.3 on NeoForge; Minecraft 1.16.5 to 26.3 on Fabric; Minecraft 1.16.5 to 1.20.1 on Forge; Minecraft 1.12.2 on Forge. Each example was compiled against its loader and version before it shipped in Linen.

  1. Work out the key: item.<mod id>.<name> or block.<mod id>.<name>.
  2. Open assets/<mod id>/lang/en_us.json (make it if it is missing).
  3. Add “key”: “Name” and check the commas and quotes.
  4. Reload resources with F3+T or restart the game.
  5. Make more files, like de_de.json, to translate it.

The example uses these values. Change them in the code.

Setting In the example What it does
kind item What the name is for.

The example mod is examplemod in the package com.example.examplemod. Use your own mod id and package.

Fabric and NeoForge 1.20.4 to 26.3, NeoForge 1.20.1 to 1.20.2, Fabric 1.16.5 to 1.20.3, Forge 1.16.5 to 1.20.1

Section titled “Fabric and NeoForge 1.20.4 to 26.3, NeoForge 1.20.1 to 1.20.2, Fabric 1.16.5 to 1.20.3, Forge 1.16.5 to 1.20.1”

Uses:

  • Item.getDescriptionId
  • assets/lang/en_us.json

In src/main/resources/assets/examplemod/lang/en_us.json:

{
"item.examplemod.ruby_gem": "Ruby Gem"
}

Uses:

  • Item.getUnlocalizedName
  • assets/lang/en_us.lang

1.12.2 names end in .name (item.<modid>.<name>.name) and blocks use tile. instead of block.; the file is lang/en_us.lang with key=value lines.

In src/main/resources/assets/examplemod/lang/en_us.json:

{
"item.examplemod.ruby_gem.name": "Ruby Gem"
}

Linen’s How-tos library has this page too, with the example for your own mod’s loader and Minecraft version. Hover a name in your code and Linen points to the how-tos that explain it. Both are free. Download Linen.