Jump to content

Recommended Posts

Posted

Hi,

 

I'm having a problem reading the "large text" (titles/subtitles) displayed on screen.

 

The only reference to this problem I could find was in version 1.8 on this forum:

 

From that thread, the following code would retrieve the on-screen title by using Forge's ReflectionHelper to read protected fields:

String title = (String) ReflectionHelper.findField(GuiIngame.class, "displayedTitle", "field_175201_x").get(Minecraft.getMinecraft().ingameGUI);

alternatively using:

String title = ReflectionHelper.getPrivateValue(GuiIngame.class, Minecraft.getMinecraft().ingameGUI, "field_175201_x", "displayedTitle");

However, in 1.14, 1.12, and even 1.8 (for me), this returns an empty string no matter what, unless I manually set the field using

ReflectionHelper.findField(GuiIngame.class, "displayedTitle", "field_175201_x").set(ClientUtils.mc().ingameGUI, "Hey this is a title sort of");

 

Setting the field in this will NOT create a title onscreen, and the actual onscreen title has no bearing on this field- I tested with in-game title commands, and titles set via:

Minecraft.getMinecraft().ingameGUI.displayTitle("This will create an actual functional title", "But I can't access it with reflections", 0, 60, 1);

 

Is there an alternative to reflections in modern minecraft versions? Or am I missing something? I feel like I'm not accessing the correct instance of GuiInGame, however I can call methods on that instance just fine, so it might be reflections. I have never used reflections prior to this.

 

Using reflections without Forge's wrapper also produced the same result:

Field f = GuiIngame.class.getDeclaredField("displayedTitle");
f.setAccessible(true);
System.out.println(f.get(Minecraft.getMinecraft().ingameGUI));

 

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.