mojira.dev
MC-105140

Item in /give and block in /testforblock feedback translated in language defined by server instead of client

When using the /give command in any server, the message in chat uses the host's language.
Notes:
This only happens in the message. The items themselves got the right name
Steps to reproduce:

  1. Change language to french or something

  2. Open to lan

  3. Enter lan from another computer

  4. Use /give coal 1 0 on the other computer:

  5. The item name in the message in chat will be in french

Affects the following feedback:

  • Item name in /give

  • Block name in failed /testforblock


Code analysis by @unknown can be found in this comment.

Linked issues

Comments 8

Those messages are generated by the server.

Yes but they should use the json localization which us replcaed by the client

You can edit your messages. There is a pencil symbol at the top right of your comment.

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

The reason for this is that the method net.minecraft.item.ItemStack.getTextComponent() returns a TextComponentString instead of a TextComponentTranslation and therefor uses the language of the server.

Should affect all servers and not only LAN. Please change the summary to "Item name in /give feedback translated in language defined by server instead of client" or something similar

Affects the /testforblock command as well if the block tested for is not at the provided position. The reason for this is that the method net.minecraft.block.Block.getLocalizedName() is called which returns the block name as a translated string.

Can no longer reproduce in 1.13.1 Someone else please verify if this issue is fixed.

Gal Horowitz

(Unassigned)

Confirmed

Minecraft 1.10.2, Minecraft 1.11, Minecraft 16w50a

Minecraft 1.13.1

Retrieved