Jump to content

How to force unfocus chat?


Recommended Posts



I've made a custom GUI for my mod (in 1.8), and wanted to use a TextField with autocompletion. I managed to achieve that by making my Gui class extending GuiChat.

That way, I am now able to use the method "autocompletePlayerNames()" to complete the name that I start to write in the TextField.


But, after a bit, I realized that the chat was active when this Gui was open (seems logic). I managed to remove the writing line of the chat so that when I type, the text don't appear in both the Chat box and my own Text box.

I thought it would do the whole job, but it actually leaves the chat history be. All the messages received are constantly rendered, the chat never unfocus...


So here is my question: What do I have to do to cancel this focus? Or maybe is there another way to autocomplete ( without having to re-write the whole algorithm that do it )

Link to comment
Share on other sites

Thing is that I don't want to update to 1.9. I mean... I have my reasons to stay on 1.8 so i asked for a possible solution on that version. (just figured that i didn't mention the version i used ^^)

Still, thank you for the idee

Link to comment
Share on other sites

Ok, I am currently trying to replicate the CuiChat methods that autocomplete the player name.

Here are the methods in GuiChat I copied:


-  setText(String , boolean)

-  autocompletePlayerNames()

-  sendAutocompleteRequest(String , String)

-  onAutocompleteResponse(String[] )


I change the differents objects names to mine (like "inputField" into "textBox" which is my textField i want te autocomplete to act)

But now, I think i need to add a Handler for the communications of Packets. autocomplete and sendAutoCompleteRequest are fired when i Tab to complete. But onAutocompleteResponse is never fired...


The packets to autocomplete is C14PacketTabComplete (I think, even so there is a BlockPos as argument) and i can't find the packet handler fired on response so I don't know how to fire the last method.


Does someone know what i have to do next ?

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.

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.

  • Create New...

Important Information

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