Jump to content

similar ClientChatReceivedEvent for Client only sendMessage


Joe6pack

Recommended Posts

Hello

I just started with java and minecraft modding. I want to implement a very simple task but unfortunately I do not know the right event for it. Messages sent via

Minecraft.getMinecraft().player.sendChatMessage(message);

from the client to the server I can use:

public void onChat(ClientChatReceivedEvent event)

to read it back in. However, there are now also messages that are sent via

Minecraft.getMinecraft().player.sendMessage(m)

only direct to the client. Is there also a possibility to read these messages? Another mod writes these "client only" messages that I want to respond to.

Joe6pack

Link to comment
Share on other sites

it's me again, somehow I can't get to the message even via the gui

Minecraft.getMinecraft().player.sendChatMessage("erste Nachricht");
		
ITextComponent m = new TextComponentString("zweite Nachricht");
Minecraft.getMinecraft().player.sendMessage(m);
Minecraft.getMinecraft().player.sendChatMessage("dritte Nachricht");
		
String msg =  Minecraft.getMinecraft().ingameGUI.getChatGUI().getSentMessages().toString();
logger.info(msg);

Output: [erste Nachricht, dritte Nachricht]

what am i doing wrong?

Link to comment
Share on other sites

ok i have to give up. i don't have the slightest idea how to use or read chatlines.
All the search was unsuccessful.
Can not you give me a little tip how the code must look like to access chatlines?

I can handle the processing of the array

Let's assume there is only one entry in the complete chat and I want to read this... please help me.

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.