How to add Custom Window title in 1.16.4?

Started by Killar.exe on

Topic category: Advanced modding

Last seen on 12:37, 22. Nov 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add Custom Window title in 1.16.4?
Sun, 01/24/2021 - 21:59 (edited)

I think it's possible to add a custom window title like in 1.12.2. Because i found a hint!
If someone could know how to do or help to find it will be helpful!
 

package net.killarexe.negativen;

import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;

@NegativenModElements.ModElement.Tag
public class DisplayName extends NegativenModElements.ModElement {

	private Minecraft minecraft;
	private MainWindow window = minecraft.getMainWindow();
	private String title = "Negative-N 1.3 Pre-Release 3";
	 
	public DisplayName(NegativenModElements instance) {
		super(instance, 977);
	}

	@Override
	public void initElements() {
		window.setWindowTitle(title);
	}

}

this code doesn't work its just a start!

Edited by Killar.exe on Sun, 01/24/2021 - 21:59
Last seen on 11:55, 27. Mar 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I edited the window title…
Fri, 03/26/2021 - 20:26

I edited the window title going on net.minecraft.client.minecraft  and editing this

private String getWindowTitle() {
      StringBuilder stringbuilder = new StringBuilder("what you want");
      ClientPlayNetHandler clientplaynethandler = this.getConnection();
      if (clientplaynethandler != null && clientplaynethandler.getNetworkManager().isChannelOpen()) {
         stringbuilder.append(" - ");
         if (this.integratedServer != null && !this.integratedServer.getPublic()) {
            stringbuilder = new StringBuilder("non è trap se giochi da solo bro...");
         } else if (this.isConnectedToRealms()) {
            stringbuilder.append(I18n.format("title.multiplayer.realms"));
         } else if (this.integratedServer == null && (this.currentServerData == null || !this.currentServerData.isOnLAN())) {
            stringbuilder.append(I18n.format("title.multiplayer.other"));
         } else {
            stringbuilder.append(I18n.format("title.multiplayer.lan"));
         }
      }

      return stringbuilder.toString();
   }

you can delete everything between the first and the last line, that code is meant to show if you're playing single or multi and I18n.format should translate to the right language.
 

I hope this fix your problems, probably this is not the cleanest way to do it, but I started coding today and it's the only way i found out

Last seen on 12:37, 22. Nov 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
wow i don't expected that!…
Mon, 04/05/2021 - 10:16

wow i don't expected that! And also it's you for the message "it's not trap if you play alone bro" in Italian?