Jump to content

[SOLVED] Print something in chat input line


CeperaProduction

Recommended Posts

Hi guys. Is it possible to place some strings in chat input? Like it does by clicking on some messages created by using json, but how can i do the same, clicking on some mob, player or something else?

Would be nice, it there is way to do this on server side, but if someone knows how to do this on client side, it would be good too.

Edited by CeperaProduction
Solution was found
Link to comment
Share on other sites

13 hours ago, diesieben07 said:

You can send chat to a specific player by using EntityPlayer::sendMessage. You can send chat to everyone on the server using PlayerList::sendMessage.

I know this, but this is not what i need. I wanna do something like printing /msg <player> in chat input when one player clicks on anotherone

Link to comment
Share on other sites

14 minutes ago, CeperaProduction said:

I know this, but this is not what i need. I wanna do something like printing /msg <player> in chat input when one player clicks on anotherone

 

Create an instance of GuiChat using the GuiChat(String) constructor, which populates the text box with the specified string; then display it with Minecraft#displayGuiScreen.

 

There's no existing server-to-client packet that does this, so you'll need to create your own.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

If the chat GUI is already open, you can add text to it by calling GuiTextField#writeText on GuiChat#inputField. The field is protected, so you'll need to access it via reflection.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

45 minutes ago, Choonster said:

 

Create an instance of GuiChat using the GuiChat(String) constructor, which populates the text box with the specified string; then display it with Minecraft#displayGuiScreen.

 

There's no existing server-to-client packet that does this, so you'll need to create your own.

Thanks, it's right what i need.

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.