Posted October 18, 20205 yr Hi, thanks for taking the time to read my question. I'm trying to emulate a custom FontRenderer. I say emulate because I don't want to create a custom FontRenderer, I just want to parse text into sections, then render those with the default FontRenderer. Normally that would be no problem, but in my case it's complicated by the fact that a TextComponent includes no way to get style data that I can modify (Or at least that I know of, hopefully the answers will shed some light on this). To simplify my general problem with a single question; How could I get the string (including style codes) of a TextComponent? What I'm hoping to achieve is get the string of a TextComponent, say "Player has made the advancement [Hot Stuff]" as "Player has made the advancement [§aHot Stuff]" I've tried looking at the Style class, the problem here is I can't get the style for a specific part of a string Thanks for reading my question - ConsumerJunk
October 18, 20205 yr All ITextProperties (which TextComponent extend) holds a method called getString which should do this for you iirc. If that doesn't work, you can always use one of the components that return an optional of the specific IStyledTextAcceptor passed in. However, you should look into using IReordingProcessor in some fashion similarly to FontRenderer for support in different languages. Worst case scenario, you get the JSON conversion of the specific text component and parse from there.
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.