Jump to content

[Solved] [1.8] EnumChatFormatting bold not working in GUIs


Recommended Posts

Posted

Hello,

 

I have a problem, I'm making a GUI with text and text formatting, but the bold doesn't work.

In 1.7 it worked perfectly, even in buttons.

 

How it works:

1. I get a string like : "&xbUpdate 1.2#*&xiAdded Keyboard Controls#*?#&c*Added More Options" (the "#" is used later to separate lines into an array)

2. After that, I replace the "&xb"/"ξ" with "EnumChatFormatting.xxx.toString() with:

text = text.replaceAll("&xb", EnumChatFormatting.BOLD.toString());

 

And for the button, it works with every text formatting except the bold too:

this.buttonList.add(buttonRight = new GuiButton(4, (width - newsPaneWidth) / 2 + 74 + 32, (height-30) / 2 + 74, 25, 20, bold + ">"));

 

Source code:

GuiServerNews.java

 

  Reveal hidden contents

 

Note 1: The code looks ugly, because I wrote the base when I started learning Java.

Note 2: The text in bold has more space between characters.

 

Thanks for your help.

Posted
  On 7/22/2015 at 10:29 PM, diesieben07 said:

My question is, why don't you just send the formatting codes from the server directly (e.g. §l for bold, see the list on the Minecraft Wiki)?

It's because when I made it in 2013 I was bad at codding and found it easier to do it that way, and I never thought about changing it because it was working.

But I'm planning on using them.

Posted
  On 7/22/2015 at 11:11 PM, diesieben07 said:

Now is the time! ;)

I will change it :)

I tested, and it works perfectly except for the bold.

 

Thank you for suggesting the change.

Posted
  On 7/22/2015 at 11:32 PM, diesieben07 said:

I just did some tests and I cannot get bold text to render at all either. Not sure what that's about.

It might be a bug in the game.

I will put the thread as solved and I will check for another update.

 

Thank you for your help :)

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.