-
Notifications
You must be signed in to change notification settings - Fork 5
Screen Builder
Lortseam edited this page Sep 2, 2023
·
11 revisions
To build a config screen, a ConfigScreenBuilder is needed. CompleteConfig provides different screen builders, each one in a seperate GUI module. If you didn't add one of the GUI modules yet, check out the setup page.
ConfigScreenBuilder screenBuilder = new ClothConfigScreenBuilder();ConfigScreenBuilder screenBuilder = new YaclScreenBuilder();The build method takes the parent screen and your config as arguments and returns the generated screen.
Screen configScreen = screenBuilder.build(parentScreen, config);public class ModMenuIntegration implements ModMenuApi {
private static final ClothConfigScreenBuilder configScreenBuilder = new ClothConfigScreenBuilder();
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> configScreenBuilder.build(parent, MyMod.getConfig());
}
}Remember to add the modmenu entrypoint to your fabric.mod.json file.
MinecraftClient.getInstance().setScreen(configScreen);