-
Notifications
You must be signed in to change notification settings - Fork 0
Graphical Interface and Localization
Config Overhauled automates graphical interface rendering for the active configuration hierarchy. Implementations must register the provided screen factory and export localization keys for client-side translation.
Graphical interfaces are generated dynamically at runtime via ConfigManager::createScreen. This method traverses the active structural hierarchy and constructs discrete widgets for mapped properties.
GUI integration mandates a discrete ModMenu implementation.
package com.example.mod.client;
import com.example.mod.ExampleConfig;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ExampleConfig.CONFIG::createScreen;
}
}package com.example.mod;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.ConfigScreenHandler;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.fml.loading.FMLPaths;
@Mod(Constants.MOD_ID)
public class ExampleMod {
public ExampleMod() {
// ...
if (FMLEnvironment.dist == Dist.CLIENT) {
ModLoadingContext.get().registerExtensionPoint(
ConfigScreenHandler.ConfigScreenFactory.class,
() -> new ConfigScreenHandler.ConfigScreenFactory((minecraft, parentScreen) ->
ExampleConfig.CONFIG.createScreen(parentScreen)
)
);
}
}
}package com.example.mod;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
@Mod(Constants.MOD_ID)
public class ExampleMod {
public ExampleMod(ModContainer modContainer) {
// ...
if (FMLEnvironment.dist == Dist.CLIENT) {
modContainer.registerExtensionPoint(IConfigScreenFactory.class, (minecraft, parentScreen) ->
ExampleConfig.CONFIG.createScreen(parentScreen)
);
}
}
}Client-side graphical interfaces mandate translation keys for structural titles, property names, and tooltips.
Execute the following command in-game:
/config_lang_gen <modid>
The framework compiles the active memory state and outputs a structured JSON file containing all required translation keys to the root configuration directory. Transfer these generated key-value pairs into the primary en_us.json language file of the host mod to map the translation definitions.