Move lang missing test back to GetConfigScreen

This commit is contained in:
James Seibel
2025-09-27 20:08:04 -05:00
parent ed50161cfd
commit 0f968255e0
2 changed files with 25 additions and 15 deletions
@@ -79,7 +79,6 @@ public abstract class AbstractModInitializer
// Client uses config for auto-updater, so it's initialized here instead of post-init stage
this.initConfig();
this.initLang();
logModIncompatibilityWarnings(); // needs to be called after config loading
LOGGER.info(ModInfo.READABLE_NAME + " client Initialized.");
@@ -166,20 +165,6 @@ public abstract class AbstractModInitializer
Config.completeDelayedSetup();
}
private void initLang()
{
if (ModInfo.IS_DEV_BUILD)
{
String missingLangEntries = ConfigBase.INSTANCE.generateLang(true, true);
if (missingLangEntries != null
&& missingLangEntries.length() != 0)
{
LOGGER.warn("One or more language entries is missing:");
LOGGER.warn(missingLangEntries);
}
}
}
private void checkForUpdates()
{
if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get())
@@ -1,12 +1,18 @@
package com.seibel.distanthorizons.common.wrappers.gui;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.coreapi.ModInfo;
import com.seibel.distanthorizons.core.config.ConfigBase;
import com.seibel.distanthorizons.core.config.gui.JavaScreenHandlerScreen;
import net.minecraft.client.gui.screens.Screen;
import org.apache.logging.log4j.Logger;
import java.lang.invoke.MethodHandles;
public class GetConfigScreen
{
protected static final Logger LOGGER = DhLoggerBuilder.getLogger();
public static EType useScreen = EType.Classic;
public enum EType
@@ -17,6 +23,25 @@ public class GetConfigScreen
public static Screen getScreen(Screen parent)
{
// TODO it'd be nice to have this run automatically on startup
// but this will only work once MC has added our lang file,
// which won't be for sure added until we request a GUI
if (ModInfo.IS_DEV_BUILD)
{
String missingLangEntries = ConfigBase.INSTANCE.generateLang(true, true);
// trim to remove any newlines/spaces
// that may be present when no lang entries need changing
// then we can check length != 0 if any items are missing and need adding
String trimmedMissingEntries = missingLangEntries.trim();
if (!trimmedMissingEntries.isEmpty())
{
LOGGER.warn("One or more language entries is missing:");
LOGGER.warn(missingLangEntries);
}
}
switch (useScreen)
{
case Classic: