Jump to content

[1.6] Translating chat strings.


maxpowa

Recommended Posts

What method do I pass messages through to strip them of their translation/color data and return the proper formatted/translated string? I know I used to have to use StringTranslate.getInstance().translateString(s) but that no longer exists... I've looked in the other chat classes, but they use an obfuscated class (I18n.java) and method that does nothing to the chat strings...

 

Example of what the obfuscated class (I18n.java) and method returns

width=800 height=4492013-07-05_20.15.04.png?dl=1 [/img]

Link to comment
Share on other sites

I hate bumping, but I really need help with this, I've tried

       event.message = I18n.func_135053_a(event.message);
       event.message = EnumChatFormatting.func_110646_a(event.message);
       event.message = new StringTranslate().translateKey(event.message);

And none of them work...

Link to comment
Share on other sites

So I've managed to find this method

ChatMessageComponent.func_111078_c(serializedMessage).func_111068_a(true)

but when I try to use it, it crashes with the stacktrace

 

 

2013-07-10 18:22:04 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Deserializing Message

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1932)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:898)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.main.Main.main(Main.java:93)

2013-07-10 18:22:04 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-07-10 18:22:04 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-07-10 18:22:04 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-07-10 18:22:04 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

2013-07-10 18:22:04 [iNFO] [sTDERR] Caused by: java.lang.ClassCastException: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonObject

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.util.MessageComponentSerializer.func_111056_a(MessageComponentSerializer.java:22)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.util.MessageComponentSerializer.deserialize(MessageComponentSerializer.java:204)

2013-07-10 18:22:04 [iNFO] [sTDERR] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)

2013-07-10 18:22:04 [iNFO] [sTDERR] at com.google.gson.Gson.fromJson(Gson.java:795)

2013-07-10 18:22:04 [iNFO] [sTDERR] at com.google.gson.Gson.fromJson(Gson.java:761)

2013-07-10 18:22:04 [iNFO] [sTDERR] at com.google.gson.Gson.fromJson(Gson.java:710)

2013-07-10 18:22:04 [iNFO] [sTDERR] at com.google.gson.Gson.fromJson(Gson.java:682)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.util.ChatMessageComponent.func_111078_c(ChatMessageComponent.java:334)

2013-07-10 18:22:04 [iNFO] [sTDERR] at maxpowa.tukmc.handlers.ChatListener.onChatMsgRecieved(ChatListener.java:47)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.ASMEventHandler_4_ChatListener_onChatMsgRecieved_ClientChatReceivedEvent.invoke(.dynamic)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.post(EventBus.java:108)

2013-07-10 18:22:04 [iNFO] [sTDERR] at maxpowa.tukmc.handlers.ChatListener.onChatMsgRecieved(ChatListener.java:101)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.ASMEventHandler_4_ChatListener_onChatMsgRecieved_ClientChatReceivedEvent.invoke(.dynamic)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.post(EventBus.java:108)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.multiplayer.NetClientHandler.handleChat(NetClientHandler.java:875)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet3Chat.processPacket(Packet3Chat.java:68)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.multiplayer.NetClientHandler.processReadPackets(NetClientHandler.java:281)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.multiplayer.WorldClient.tick(WorldClient.java:99)

2013-07-10 18:22:04 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1916)

2013-07-10 18:22:04 [iNFO] [sTDERR] ... 9 more

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.