diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index c04693e20a..fe6cd6c582 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -352,7 +352,10 @@ public class ForgeHooksClient { return LazyInit.INSTANCE; } + // NO-OP method, kept for bin-compat. Used in TitleScreen.java + @Deprecated(forRemoval = true, since = "1.21.4") public static void renderMainMenu(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) { + /* VersionChecker.Status status = getForgeVersionStatus(); if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) { @@ -362,6 +365,7 @@ public class ForgeHooksClient { line = Component.translatable("forge.update.beta.2"); graphics.drawCenteredString(font, line, width / 2, 4 + (font.lineHeight + 1), 0xFFFFFF | alpha); } + */ } public static String forgeStatusLine; diff --git a/src/main/java/net/minecraftforge/internal/BrandingControl.java b/src/main/java/net/minecraftforge/internal/BrandingControl.java index e176e5a672..a34bd3cd5c 100644 --- a/src/main/java/net/minecraftforge/internal/BrandingControl.java +++ b/src/main/java/net/minecraftforge/internal/BrandingControl.java @@ -5,6 +5,7 @@ package net.minecraftforge.internal; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.ObjIntConsumer; @@ -17,6 +18,9 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.versions.mcp.MCPVersion; +/** + * Controls the title screen brandings for the game. + */ public final class BrandingControl { private BrandingControl() {} @@ -25,13 +29,29 @@ public final class BrandingControl { private static void computeBranding() { if (brandings == null) { - brandings = List.of( - "Forge " + ForgeVersion.getVersion(), - "Minecraft " + MCPVersion.getMCVersion(), - "MCP " + MCPVersion.getMCPVersion(), - ForgeI18n.parseMessage("fml.menu.loadingmods", ModList.get().size()) - ); - brandingsNoMC = brandings.subList(1, brandings.size()); + var list = new ArrayList(); + + // Forge + var forge = ForgeVersion.getVersion().split("-", 2); + + // I don't want to use VersionChecker to check for this, so I'm just going to use the version string. + // We only have Forge Betas on the "XX.0.XX" versions anyways. + boolean beta = "0".equals(forge[0].split("\\.")[1]); + var name = beta ? "§eForge Beta§f " : "Forge "; + list.add(name + forge[0] + " (" + ForgeI18n.parseMessage("fml.menu.loadingmods", ModList.get().size()) + ")"); + + // Extra forge version info (like branch) + if (forge.length > 1) list.add("Branch " + forge[1]); + + // TODO [Forge][FML] When FML is rewritten, add its version here behind a config value to show it (debugBrandingVersions) + // this is how to check if we are in ForgeDev: + // FMLLoader.launcherHandlerName().startsWith("forge_dev") + + // Minecraft + list.add("Minecraft " + MCPVersion.getMCVersion()); + + brandings = List.copyOf(list); + brandingsNoMC = brandings.subList(0, brandings.size() - 1); } } @@ -43,6 +63,11 @@ public final class BrandingControl { return reverse ? brandingsNoMC.reversed() : brandingsNoMC; } + /** + * Gets the branding lines to display over the copyright line. This is usually a message when Forge has an update. + * + * @return The branding lines to display + */ public static List getOverCopyrightBrandings() { final class LazyInit { private static final List INSTANCE = ForgeHooksClient.forgeStatusLine == null @@ -55,22 +80,46 @@ public final class BrandingControl { return LazyInit.INSTANCE; } + /** + * Iterates over each branding line, passing the line and its index to the consumer. + * + * @param includeMC Whether to include the Minecraft version line + * @param reverse Whether to iterate in reverse order + * @param lineConsumer The consumer to accept each line and its index + */ public static void forEachLine(boolean includeMC, boolean reverse, ObjIntConsumer lineConsumer) { var brandings = getBrandings(includeMC, reverse); for (int idx = 0; idx < brandings.size(); idx++) lineConsumer.accept(brandings.get(idx), idx); } + /** + * Iterates over each branding line that should be displayed above the copyright line, passing the line and its + * index to the consumer. + * + * @param lineConsumer The consumer to accept each line and its index + */ public static void forEachAboveCopyrightLine(ObjIntConsumer lineConsumer) { var overCopyrightBrandings = getOverCopyrightBrandings(); for (int idx = 0; idx < overCopyrightBrandings.size(); idx++) lineConsumer.accept(overCopyrightBrandings.get(idx), idx); } + /** + * Gets the branding to use in place of the default {@code "vanilla"} branding. + * + * @return The branding to use + */ public static String getBranding() { return "forge"; } + /** + * The reload listener for the branding control. On reload, the brandings are recomputed in + * {@link #computeBranding()}. + * + * @return The reload listener + */ public static ResourceManagerReloadListener resourceManagerReloadListener() { return BrandingControl::onResourceManagerReload; } diff --git a/src/main/resources/assets/forge/lang/en_us.json b/src/main/resources/assets/forge/lang/en_us.json index 0bb4175ac6..e6b479363e 100644 --- a/src/main/resources/assets/forge/lang/en_us.json +++ b/src/main/resources/assets/forge/lang/en_us.json @@ -141,8 +141,6 @@ "commands.config.getwithtype": "Config for %s of type %s found at %s", "commands.config.noconfig": "Config for %s of type %s not found", - "forge.update.beta.1": "%sWARNING: %sForge Beta", - "forge.update.beta.2": "Major issues may arise, verify before reporting.", "forge.update.newversion": "New Forge version available: %s", "forge.menu.updatescreen.title": "Mod Update",