### ConfigItem Usage Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/types.md Demonstrates how to get and set values for configuration items, such as blur effects. ```java ConfigItem blurEffect = Config.CLIENT.mBlurEffect; boolean enabled = blurEffect.get(); ``` -------------------------------- ### MenuScreen Instantiation Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Example demonstrating how to create and display a MenuScreen. This involves setting up UI fragments, container menus, player inventory, and then using Minecraft.getInstance().setScreen() to show the screen. ```java Fragment containerUI = new ContainerUIFragment(); AbstractContainerMenu menu = new ChestContainerMenu(...); Inventory playerInventory = Minecraft.getInstance().player.getInventory(); MenuScreen screen = new MenuScreen<>( containerUI, new ScreenCallback() { @Override public boolean isPauseScreen() { return false; // Don't pause during container interaction } }, menu, playerInventory, Component.literal("Custom Container") ); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Proper MenuScreen Setup Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Set up a `MenuScreen` correctly by providing the container fragment, callback, player inventory, and a descriptive component. ```java // ✅ Proper MenuScreen setup var screen = MuiModApi.get().createMenuScreen( containerFragment, null, // Let fragment be callback if implements ScreenCallback Minecraft.getInstance().player.containerMenu, // Current container Minecraft.getInstance().player.getInventory(), // Player inventory Component.literal("Container") ); ``` -------------------------------- ### Light Levels Packing Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ModernTextRenderer.md Demonstrates how to pack block light and sky light values into a single integer for the packedLight parameter. ```java int packedLight = (blockLight << 4) | skyLight; // or int packedLight = 15 << 20 | 15; // Full brightness ``` -------------------------------- ### SimpleScreen Constructor Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Demonstrates how to create and display a SimpleScreen with a custom Fragment, ScreenCallback, and title. The screen is then set as the current screen in Minecraft. ```java Fragment myUI = new MyFragment(); SimpleScreen screen = new SimpleScreen( myUI, new ScreenCallback() { @Override public boolean isPauseScreen() { return true; } }, previousScreen, Component.literal("My GUI") ); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Color Format Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ModernTextRenderer.md Illustrates the ARGB color format (32-bit integer) used for specifying text color, including examples of opaque and semi-transparent colors. ```java // 0xAARRGGBB // AA = Alpha (transparency): 00-FF // RR = Red: 00-FF // GG = Green: 00-FF // BB = Blue: 00-FF // Examples: // 0xFFFFFFFF = Opaque white // 0xFF000000 = Opaque black // 0xFF0000FF = Opaque red // 0x80CCCCCC = Semi-transparent gray ``` -------------------------------- ### Modify UI Configuration Programmatically Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/configuration.md Example of how to programmatically enable blur, set its radius, customize tooltips, and apply all configuration changes. ```java public class ConfigModifier { public static void customizeUI() { // Enable blur with custom radius BlurHandler.sBlurEffect = true; BlurHandler.sBlurRadius = 10; // Customize tooltips TooltipRenderer.sRoundedShapes = true; TooltipRenderer.sCornerRadius = 8.0f; // Apply all changes Config.CLIENT.apply(); } } ``` -------------------------------- ### Integrate and Configure Tooltips Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/TooltipRenderer.md Example of setting up Modern UI tooltips by enabling the renderer, applying styles like rounded shapes and corner radius, and defining fill and stroke colors from client configuration. ```java public class MyTooltipSetup { public static void setupTooltips() { // Enable Modern UI tooltips TooltipRenderer.sTooltip = Config.CLIENT.mTooltip.get(); // Apply styling TooltipRenderer.sRoundedShapes = Config.CLIENT.mRoundedTooltip.get(); TooltipRenderer.sCornerRadius = Config.CLIENT.mTooltipRadius.get().floatValue(); // Set colors List fillColors = Config.CLIENT.mTooltipFill.get(); for (int i = 0; i < Math.min(4, fillColors.size()); i++) { TooltipRenderer.sFillColor[i] = Color.parseColor(fillColors.get(i)); } List strokeColors = Config.CLIENT.mTooltipStroke.get(); for (int i = 0; i < Math.min(4, strokeColors.size()); i++) { TooltipRenderer.sStrokeColor[i] = Color.parseColor(strokeColors.get(i)); } } } ``` -------------------------------- ### Typical MenuScreen Usage Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Demonstrates how to create a custom UI fragment, instantiate a MenuScreen for a container, and access it via screen change listeners. This shows the lifecycle and integration of MenuScreen. ```java // 1. Create a Fragment for container UI public class ChestUIFragment extends Fragment { @Override protected void onCreateView(@Nonnull ViewGroup parent) { // Build custom UI for the container var container = new LinearLayout(parent.getContext()); // Add UI components... parent.addView(container); } } // 2. Create a MenuScreen when opening a container public void openContainerScreen(AbstractContainerMenu menu) { Fragment ui = new ChestUIFragment(); MenuScreen screen = new MenuScreen<>( ui, null, // Use default callback menu, Minecraft.getInstance().player.containerMenu.getItems(), Component.literal("Chest") ); Minecraft.getInstance().setScreen(screen); } // 3. Access from a screen event MuiModApi.addOnScreenChangeListener((oldScreen, newScreen) -> { if (newScreen instanceof MuiScreen muiScreen && muiScreen.isMenuScreen()) { MenuScreen menuScreen = (MenuScreen) newScreen; System.out.println("Opened container"); } }); ``` -------------------------------- ### Screen Lifecycle Methods Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Methods related to the lifecycle of the SimpleScreen, including initialization and removal, which handle the setup and cleanup of the Modern UI host and resources. ```APIDOC ## Screen Lifecycle ### `init()` #### Description Called when the screen is being initialized. Initializes the Modern UI host. #### Called from - Main thread ### `removed()` #### Description Called when the screen is being removed. Cleans up Modern UI resources. #### Called from - Main thread ``` -------------------------------- ### Implementing ScreenCallback with SimpleScreen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ScreenCallback.md Demonstrates how to implement the ScreenCallback interface when creating a SimpleScreen instance. This example shows overriding methods to define custom behavior for pause state, background blurring, and back key events. ```java SimpleScreen screen = new SimpleScreen( fragment, new ScreenCallback() { @Override public boolean isPauseScreen() { return false; } @Override public boolean shouldBlurBackground() { return Config.CLIENT.mBlurEffect.get(); } @Override public boolean isBackKey(int keyCode, KeyEvent event) { // Standard behavior - Escape to close return super.isBackKey(keyCode, event); } }, previousScreen, Component.literal("Custom Screen") ); ``` -------------------------------- ### Draw Gradient Panel Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ExtendedGuiGraphics.md Demonstrates drawing a UI panel with a vertical gradient background using ExtendedGuiGraphics.fillGradientRect. Ensure the graphics context and colors are correctly defined. ```java public void drawGradientPanel(GuiGraphics graphics) { int width = 200; int height = 100; int x = 50; int y = 50; // Create a gradient from top (red) to bottom (blue) int topColor = 0xFFFF0000; // Red int bottomColor = 0xFF0000FF; // Blue ExtendedGuiGraphics.fillGradientRect( graphics, x, y, x + width, y + height, topColor, bottomColor ); } ``` -------------------------------- ### Navigation Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiScreen.md Gets the previous screen in the navigation stack, allowing for back navigation. ```APIDOC ## getPreviousScreen() ### Description Returns the previous screen associated with this screen. If non-null, the back pressed handler will return to that screen. ### Method ```java @Nullable Screen getPreviousScreen() ``` ### Returns The previous screen or null. Always null for menu screens. ### Example ```java Screen previous = screen.getPreviousScreen(); if (previous != null) { // Back will return to this screen } ``` ``` -------------------------------- ### Register Screen Change Listener Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/README.md Example of how to register a listener for screen change events. This callback is invoked whenever the game's screen is changed. ```java MuiModApi.addOnScreenChangeListener((oldScreen, newScreen) -> { // Handle screen change }); ``` -------------------------------- ### Color Format Example Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/configuration.md Colors are specified as ARGB hex strings. AA is alpha, RR is red, GG is green, and BB is blue. ```text #AARRGGBB ``` -------------------------------- ### Get ChatFormatting by Code Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Retrieves ChatFormatting based on a character code. This is an optimized replacement for ChatFormatting.getByCode(). ```java public static ChatFormatting getFormattingByCode(char code) ``` ```java ChatFormatting bold = MuiModApi.getFormattingByCode('l'); ChatFormatting red = MuiModApi.getFormattingByCode('c'); ``` -------------------------------- ### Get UIManager Instance Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Access the singleton instance of the UIManager. This is the primary way to interact with the UI system. ```java UIManager manager = UIManager.getInstance(); ``` -------------------------------- ### Typical Usage of SimpleScreen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Demonstrates the typical workflow for creating and displaying a custom screen using SimpleScreen, including creating a Fragment, implementing ScreenCallback, and opening the screen. ```java // 1. Create a custom Fragment public class MyUIFragment extends Fragment { @Override protected void onCreateView(@Nonnull ViewGroup parent) { var root = new LinearLayout(parent.getContext()); // Build your UI here parent.addView(root); } } // 2. Create a ScreenCallback implementation public class MyScreenCallback implements ScreenCallback { @Override public boolean isPauseScreen() { return true; // Pause the game when open } @Override public boolean shouldBlurBackground() { return true; // Apply blur to game world } } // 3. Create and open the screen Fragment fragment = new MyUIFragment(); ScreenCallback callback = new MyScreenCallback(); SimpleScreen screen = new SimpleScreen( fragment, callback, Minecraft.getInstance().screen, // Previous screen Component.literal("My Screen") ); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Access BlurHandler Singleton Instance Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/BlurHandler.md Get the singleton instance of BlurHandler to manage screen background effects. ```java BlurHandler handler = BlurHandler.INSTANCE; ``` -------------------------------- ### Get Screen Callback Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiScreen.md Retrieve the ScreenCallback for customizing screen behavior. Returns null if no callback was provided. ```java ScreenCallback callback = screen.getCallback(); if (callback != null && callback.isPauseScreen()) { // Game is paused } ``` -------------------------------- ### Get Frame Time in Nanoseconds Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Obtain the duration of the current render frame in nanoseconds. Primarily used for performance analysis. ```java @RenderThread public static long getFrameTimeNanos() ``` -------------------------------- ### SimpleScreen init() Method Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Called when the screen is initialized. This method is responsible for setting up the screen size, buttons, and initializing the Modern UI host. It is executed on the main thread. ```java @Override protected void init() { super.init(); this.host.initialize(this, this.fragment); } ``` -------------------------------- ### Create a Simple Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/README.md Demonstrates how to create a basic screen using a Fragment and open it in Minecraft. Requires creating a Fragment subclass and then using MuiModApi to create and display the screen. ```java public class MyUIFragment extends Fragment { @Override protected void onCreateView(@Nonnull ViewGroup parent) { // Build your UI hierarchy here var root = new LinearLayout(parent.getContext()); parent.addView(root); } } Fragment fragment = new MyUIFragment(); var screen = MuiModApi.get().createScreen(fragment); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Programmatic Configuration Access Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/configuration.md Demonstrates how to read configuration values, check if configuration is loaded, and apply changes programmatically. ```java // Reading values boolean blurEnabled = Config.CLIENT.mBlurEffect.get(); int radius = Config.CLIENT.mBlurRadius.get(); List colors = Config.CLIENT.mBackgroundColor.get(); // Checking if loaded if (Config.CLIENT.mLoaded) { // Config values are safe to read } // Applying changes Config.CLIENT.apply(); // Apply and propagate changes to listeners // Listening for changes (if supported) // Can subscribe to ConfigItem changes ``` -------------------------------- ### Custom Screen Initialization using UIManager Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Shows how a custom screen's init() method calls mHost.initScreen(this), where mHost is an instance of UIManager, to initialize the screen within the UI manager. ```java @Override protected void init() { super.init(); mHost.initScreen(this); // mHost is UIManager instance } ``` -------------------------------- ### Get Primary Font Family Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/FontResourceManager.md Retrieves the configured primary font family name. This is the first font to be used in text rendering. ```java Config.CLIENT.mFirstFontFamily.get() ``` -------------------------------- ### Create a Menu Screen with Container Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/README.md Shows how to create a screen that includes a container menu, such as a chest or furnace. This involves providing a UI fragment, the container menu, and player inventory. ```java Fragment containerUI = new ContainerUIFragment(); AbstractContainerMenu menu = ...; // Your container Inventory inventory = player.getInventory(); var screen = MuiModApi.get().createMenuScreen( containerUI, null, // callback menu, inventory, Component.literal("Container Title") ); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Accessing Client and Text Configuration Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/configuration.md Demonstrates how to retrieve boolean values for client-side configuration options like blur effect and color emoji usage. ```java boolean blurEnabled = Config.CLIENT.mBlurEffect.get(); // Common configuration // ... boolean colorEmoji = Config.CLIENT.mUseColorEmoji.get(); ``` -------------------------------- ### Get Back Pressed Dispatcher Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Retrieves the dispatcher responsible for handling back button events. Used for managing the back navigation stack. ```java public OnBackPressedDispatcher getOnBackPressedDispatcher() ``` -------------------------------- ### Customizing Tooltip Border and Shadow Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/TooltipRenderer.md Illustrates how to directly set static properties on TooltipRenderer to customize border width, corner radius, shadow blur, and shadow transparency. ```java // Border styling TooltipRenderer.sBorderWidth = 1.5f; // Pixels TooltipRenderer.sCornerRadius = 8.0f; // Corner radius // Shadow effect TooltipRenderer.sShadowRadius = 4.0f; // Blur radius TooltipRenderer.sShadowAlpha = 0.5f; // Transparency ``` -------------------------------- ### Get Elapsed Time Since Screen Set Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Retrieve the time in milliseconds since the current screen was initialized. Useful for time-based UI logic. ```java @RenderThread public static long getElapsedTime() ``` ```java long elapsed = UIManager.getElapsedTime(); if (elapsed > 5000) { System.out.println("Screen has been open for 5+ seconds"); } ``` -------------------------------- ### Screen Lifecycle: init() Method Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md The init() method is called during screen initialization. It is responsible for setting up the Modern UI host and the container layout. ```java @Override protected void init() { super.init(); this.host.init(this, this.fragment); this.container.init(this, this.menu, this.inventory); } ``` -------------------------------- ### Get Font Scale Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/FontResourceManager.md Retrieves the global font scale multiplier. This value is applied to text rendering size and affects glyph atlas generation. ```java Config.CLIENT.mFontScale.get() ``` -------------------------------- ### Polymorphic Screen Handling Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiScreen.md Demonstrates accessing common screen properties like fragment and callback, and conditionally handling menu vs. simple screens. ```java void handleScreen(MuiScreen screen) { Fragment frag = screen.getFragment(); ScreenCallback callback = screen.getCallback(); if (screen.isMenuScreen()) { // This is a menu screen System.out.println("Menu screen, previous: " + screen.getPreviousScreen()); } else { // This is a simple screen Screen prev = screen.getPreviousScreen(); if (prev != null) { System.out.println("Will return to: " + prev.getTitle()); } } } ``` -------------------------------- ### Get Fallback Font List Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/FontResourceManager.md Retrieves the list of fallback font family names. These fonts are tried in order when the primary font is missing a glyph. ```java Config.CLIENT.mFallbackFontFamilyList.get() ``` -------------------------------- ### Create Basic Modern UI Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Use this method to create a standard Modern UI screen with a fragment and default settings. Ensure the fragment is not null. ```java Fragment myFragment = new MyCustomFragment(); var screen = MuiModApi.get().createScreen(myFragment); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### Get Previous Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiScreen.md Retrieve the previously displayed screen. If non-null, pressing the back button will navigate to this screen. This is always null for menu screens. ```java Screen previous = screen.getPreviousScreen(); if (previous != null) { // Back will return to this screen } ``` -------------------------------- ### SimpleScreen Constructor Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Creates a new SimpleScreen instance. This screen is designed for basic UI displays without a container menu. It requires a Fragment and a title, with optional callback and previous screen configurations. ```APIDOC ## SimpleScreen Constructor ### Description Creates a new SimpleScreen with a fragment and optional configuration. ### Parameters #### Path Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy - **callback** (ScreenCallback) - Optional - Callback for screen behavior customization - **previous** (Screen) - Optional - Screen to return to when back is pressed - **title** (Component) - Required - The title displayed in the window/chat ### Throws - NullPointerException if fragment or title is null ### Example ```java Fragment myUI = new MyFragment(); SimpleScreen screen = new SimpleScreen( myUI, new ScreenCallback() { @Override public boolean isPauseScreen() { return true; } }, previousScreen, Component.literal("My GUI") ); Minecraft.getInstance().setScreen(screen); ``` ``` -------------------------------- ### Get Font Registration List Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/FontResourceManager.md Retrieves the list of font resource locations to be registered. These are typically paths to .ttf or .otf files within resource packs. ```java Config.CLIENT.mFontRegistrationList.get() ``` -------------------------------- ### createScreen(Fragment fragment) Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Creates a Modern UI screen with a fragment and default settings. This is the most basic way to create a new screen. ```APIDOC ## createScreen(Fragment fragment) ### Description Creates a Modern UI screen with a fragment and default settings. ### Method static ### Parameters #### Path Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy ### Returns A screen implementing both `Screen` and `MuiScreen` interfaces. ### Throws `NullPointerException` if fragment is null ### Example ```java Fragment myFragment = new MyCustomFragment(); var screen = MuiModApi.get().createScreen(myFragment); Minecraft.getInstance().setScreen(screen); ``` ``` -------------------------------- ### MuiScreen Implementation Methods Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Methods implementing the MuiScreen interface for SimpleScreen, providing access to the screen's fragment, callback, previous screen, and indicating it's not a menu screen. ```APIDOC ## MuiScreen Implementation ### `self()` #### Description Returns this screen as a `Screen` instance. #### Returns - Screen: This screen instance ### `getFragment()` #### Description Returns the main fragment. #### Returns - Fragment: The fragment passed to the constructor ### `getCallback()` #### Description Returns the screen callback, or null if none was provided. #### Returns - ScreenCallback: The callback, or the fragment if it implements `ScreenCallback`, or null ### `getPreviousScreen()` #### Description Returns the previous screen to return to when back is pressed. #### Returns - Screen: The previous screen or null ### `isMenuScreen()` #### Description Returns whether this is a menu screen. For `SimpleScreen`, always returns `false`. #### Returns - boolean: `false` ``` -------------------------------- ### fillGradientRect Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ExtendedGuiGraphics.md Fills a rectangle with a vertical gradient from a start color to an end color. This method is useful for creating visually appealing backgrounds or UI elements with color transitions. ```APIDOC ## fillGradientRect ### Description Fills a rectangle with a vertical gradient from start color to end color. ### Method `static void fillGradientRect(GuiGraphics graphics, int x1, int y1, int x2, int y2, int colorStart, int colorEnd)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **graphics** (GuiGraphics) - Required - The graphics context - **x1** (int) - Required - Left edge X coordinate - **y1** (int) - Required - Top edge Y coordinate - **x2** (int) - Required - Right edge X coordinate - **y2** (int) - Required - Bottom edge Y coordinate - **colorStart** (int) - Required - Starting color (top, ARGB format `0xAARRGGBB`) - **colorEnd** (int) - Required - Ending color (bottom, ARGB format `0xAARRGGBB`) ### Request Example ```java ExtendedGuiGraphics.fillGradientRect(graphics, 10, 10, 200, 100, 0xFF0000FF, 0xFF0000FF); ``` ### Response #### Success Response None (void method) #### Response Example None ``` -------------------------------- ### addOnWindowResizeListener Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Registers a callback that is invoked at the beginning of `Minecraft.resizeGui()`. ```APIDOC ## addOnWindowResizeListener(OnWindowResizeListener listener) ### Description Registers a callback invoked at the beginning of `Minecraft.resizeGui()`. ### Method public static void addOnWindowResizeListener(@Nonnull OnWindowResizeListener listener) ### Parameters #### Path Parameters * listener (OnWindowResizeListener) - Required - Callback to register ### Request Example ```java MuiModApi.addOnWindowResizeListener((width, height, guiScale, oldGuiScale) -> { System.out.println("Window resized to " + width + "x" + height); System.out.println("GUI scale changed from " + oldGuiScale + " to " + guiScale); }); ``` ``` -------------------------------- ### Getting Synced UI Frame Time Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Retrieves the synced UI frame time in milliseconds. This value is updated every frame and ignores game pauses. Must be called from the render thread. ```java @RenderThread public static long getFrameTime() ``` -------------------------------- ### Navigate to Previous Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/README.md Creates a custom screen and sets the previous screen. This allows for seamless navigation back to the prior UI. ```java // When creating the screen, pass the previous screen var screen = MuiModApi.get().createScreen( fragment, null, Minecraft.getInstance().screen, // Previous screen null ); ``` -------------------------------- ### Static Configuration Properties Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/BlurHandler.md Configure various visual aspects of the screen background, including blur effects, animations, colors, and volume control. ```APIDOC ## Static Configuration Properties Configure various visual aspects of the screen background, including blur effects, animations, colors, and volume control. ### Blur Effects | Property | Type | Default | Description | |----------|------|---------|-------------| | `sBlurEffect` | boolean | — | Enable blur effect when Modern UI screens are open | | `sBlurForVanillaScreens` | boolean | — | Apply blur to vanilla Minecraft screens | | `sOverrideVanillaBlur` | boolean | — | Override vanilla blur with Modern UI blur | | `sBlurRadius` | int | — | Blur radius in pixels (higher = more blurred) | ### Animation & Fade | Property | Type | Default | Description | |----------|------|---------|-------------| | `sBackgroundDuration` | int | — | Fade-in duration in milliseconds | ### Background Color | Property | Type | Default | Description | |----------|------|---------|-------------| | `sBackgroundColor` | int[] | `[0x99000000, 0x99000000, 0x99000000, 0x99000000]` | ARGB colors for background in 4 states | ### Volume Control | Property | Type | Default | Description | |----------|------|---------|-------------| | `sFramerateInactive` | int | — | Frame rate limit when window inactive | | `sMasterVolumeInactive` | float | — | Master volume when window inactive (0.0-1.0) | | `sMasterVolumeMinimized` | float | — | Master volume when window minimized (0.0-1.0) | | `sGlobalVolumeControl` | boolean | — | Enable global volume control | ``` -------------------------------- ### Getting Synced UI Frame Time in Nanoseconds Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Retrieves the synced UI frame time in nanoseconds. This value is updated every frame and ignores game pauses. Must be called from the render thread. ```java @RenderThread public static long getFrameTimeNanos() ``` -------------------------------- ### Getting Elapsed Time Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Retrieves the time elapsed since the current screen was set, in milliseconds. This value is updated every render frame and is not affected by game pauses. Must be called from the render thread. ```java @RenderThread public static long getElapsedTime() ``` ```java long elapsed = MuiModApi.getElapsedTime(); if (elapsed > 5000) { // More than 5 seconds have passed } ``` -------------------------------- ### Create Modern UI Screen with Callback Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Create a Modern UI screen and customize its behavior using a ScreenCallback. The callback is optional. ```java var screen = MuiModApi.get().createScreen(fragment, new ScreenCallback() { @Override public boolean isPauseScreen() { return false; // Don't pause the game } }); Minecraft.getInstance().setScreen(screen); ``` -------------------------------- ### MuiModApi Methods Delegating to UIManager Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Illustrates static methods in MuiModApi that internally call UIManager methods for common operations like getting elapsed time, frame time, or posting to the UI thread. ```java MuiModApi.getElapsedTime() // -> UIManager.getElapsedTime() MuiModApi.getFrameTime() // -> UIManager.getFrameTimeNanos() / 1000000 MuiModApi.postToUiThread(r) // -> Posts to UIManager's handler ``` -------------------------------- ### MuiScreen Implementation Methods Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Methods implementing the MuiScreen interface, providing access to screen components and behavior. ```APIDOC ## MuiScreen Implementation ### `self()` #### Description Returns this screen as a `Screen` instance. #### Method ```java @Nonnull @Override public Screen self() ``` #### Returns This screen instance ### `getFragment()` #### Description Returns the main fragment. #### Method ```java @Nonnull @Override public Fragment getFragment() ``` #### Returns The fragment passed to the constructor ### `getCallback()` #### Description Returns the screen callback, or null if none was provided. #### Method ```java @Nullable @Override public ScreenCallback getCallback() ``` #### Returns The callback, or the fragment if it implements `ScreenCallback`, or null ### `getPreviousScreen()` #### Description Returns the previous screen. For menu screens, this always returns null. #### Method ```java @Nullable @Override public Screen getPreviousScreen() ``` #### Returns Always `null` ### `isMenuScreen()` #### Description Returns whether this is a menu screen. #### Method ```java @Override public boolean isMenuScreen() ``` #### Returns Always `true` ### `onBackPressed()` #### Description Handles back button press. Closes the container menu and returns to the previous game state. #### Method ```java @UiThread @Override public void onBackPressed() ``` ``` -------------------------------- ### Callback and Configuration Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiScreen.md Retrieves the screen's callback object, used for customizing behavior, or null if no callback was specified. ```APIDOC ## getCallback() ### Description Returns the screen callback that customizes behavior, or null if none was provided. ### Method ```java @Nullable ScreenCallback getCallback() ``` ### Returns The `ScreenCallback` or null ### Example ```java ScreenCallback callback = screen.getCallback(); if (callback != null && callback.isPauseScreen()) { // Game is paused } ``` ``` -------------------------------- ### createScreen(Fragment fragment, ScreenCallback callback) Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Creates a Modern UI screen with a fragment and an optional callback for customizing screen behavior. ```APIDOC ## createScreen(Fragment fragment, ScreenCallback callback) ### Description Creates a Modern UI screen with a fragment and optional callback. ### Method static ### Parameters #### Path Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy - **callback** (ScreenCallback) - Optional - Callback for screen behavior customization ### Returns A screen implementing both `Screen` and `MuiScreen` interfaces. ### Example ```java var screen = MuiModApi.get().createScreen(fragment, new ScreenCallback() { @Override public boolean isPauseScreen() { return false; // Don't pause the game } }); Minecraft.getInstance().setScreen(screen); ``` ``` -------------------------------- ### Configure SLF4J Debug Logging Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Enable debug logs for the 'icyllis.modernui' logger by configuring logback or setting Java properties. ```xml ``` ```properties -Dorg.slf4j.simpleLogger.defaultLogLevel=debug ``` -------------------------------- ### Accessing Tooltip Configuration Properties Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/TooltipRenderer.md Demonstrates how to access various tooltip styling and behavior settings through the Config.CLIENT object. These settings control aspects like tooltip styling, shape, color, and positioning. ```java Config.CLIENT.mTooltip.get(); // boolean Config.CLIENT.mRoundedTooltip.get(); // boolean Config.CLIENT.mCenterTooltipTitle.get(); // boolean Config.CLIENT.mTooltipTitleBreak.get(); // boolean Config.CLIENT.mExactTooltipPositioning.get(); // boolean Config.CLIENT.mTooltipFill.get(); // List Config.CLIENT.mTooltipStroke.get(); // List Config.CLIENT.mTooltipWidth.get(); // Double (border width) Config.CLIENT.mTooltipRadius.get(); // Double (corner radius) Config.CLIENT.mTooltipShadowRadius.get(); // Double Config.CLIENT.mTooltipShadowAlpha.get(); // Double (0.0-1.0) Config.CLIENT.mTooltipCycle.get(); // Integer (ticks) Config.CLIENT.mAdaptiveTooltipColors.get(); // boolean Config.CLIENT.mTooltipArrowScrollFactor.get(); // Integer Config.CLIENT.mTooltipLineWrapping.get(); // boolean ``` -------------------------------- ### MenuScreen Constructor Signature Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Signature for creating a new MenuScreen instance. It requires a fragment, menu, inventory, and title component, with an optional screen callback. ```java public MenuScreen( @Nonnull Fragment fragment, @Nullable ScreenCallback callback, @Nonnull T menu, @Nonnull Inventory inventory, @Nonnull Component title) ``` -------------------------------- ### Customizing Tooltip Border Color Animation Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/TooltipRenderer.md Demonstrates setting static properties for tooltip border color animation and adaptive coloring. This controls the duration of color cycling and whether colors adjust based on content. ```java // Border color animation TooltipRenderer.sBorderColorCycle = 100; // Ticks between color changes TooltipRenderer.sAdaptiveColors = true; // Auto-adjust colors based on content ``` -------------------------------- ### createScreen(Fragment fragment, ScreenCallback callback, Screen previousScreen, CharSequence title) Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Creates a Modern UI screen with full customization options, including a previous screen and a title. ```APIDOC ## createScreen(Fragment fragment, ScreenCallback callback, Screen previousScreen, CharSequence title) ### Description Creates a Modern UI screen with full customization options. ### Method static ### Parameters #### Path Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy - **callback** (ScreenCallback) - Optional - Callback for screen behavior customization - **previousScreen** (Screen) - Optional - Screen to return to when back is pressed - **title** (CharSequence) - Optional - Title for the virtual window ### Returns A screen implementing both `Screen` and `MuiScreen` interfaces. ### Example ```java var previousScreen = Minecraft.getInstance().screen; var screen = MuiModApi.get().createScreen( myFragment, myCallback, previousScreen, Component.literal("My Custom Screen") ); Minecraft.getInstance().setScreen(screen); ``` ``` -------------------------------- ### SimpleScreen getPreviousScreen() Method Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Returns the Screen instance to navigate back to when the back action is triggered. Returns null if no previous screen was specified. ```java @Nullable @Override public Screen getPreviousScreen() { return this.previous; } ``` -------------------------------- ### Defining Tooltip Colors Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/TooltipRenderer.md Shows how to define a list of ARGB hex strings for tooltip colors, representing different states like default, hovered, pressed, and disabled. The format is #AARRGGBB. ```java List colors = Arrays.asList( "#FFFFFFFF", // Default: white "#FFCCCCCC", // Hovered: light gray "#FF888888", // Pressed: dark gray "#FF444444" // Disabled: very dark gray ); ``` -------------------------------- ### Programmatically Apply Configuration Changes Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Apply and propagate configuration changes made programmatically by calling `apply()` after setting new values. ```java // Programmatic config change Config.CLIENT.mBlurEffect.set(true); Config.CLIENT.apply(); // Apply and propagate changes ``` -------------------------------- ### MenuScreen Constructor Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Creates a new MenuScreen instance. This screen is designed for GUIs that manage item containers and integrates a Fragment for UI rendering. ```APIDOC ## MenuScreen Constructor ### Description Creates a new MenuScreen with a fragment and container menu. ### Method `public MenuScreen( @Nonnull Fragment fragment, @Nullable ScreenCallback callback, @Nonnull T menu, @Nonnull Inventory inventory, @Nonnull Component title)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy - **callback** (ScreenCallback) - Optional - Callback for screen behavior customization - **menu** (AbstractContainerMenu) - Required - The container menu to manage - **inventory** (Inventory) - Required - The player inventory - **title** (Component) - Required - The title displayed in the window/chat ### Throws `NullPointerException` if any required parameter is null ### Request Example ```java Fragment containerUI = new ContainerUIFragment(); AbstractContainerMenu menu = new ChestContainerMenu(...); Inventory playerInventory = Minecraft.getInstance().player.getInventory(); MenuScreen screen = new MenuScreen<>( containerUI, new ScreenCallback() { @Override public boolean isPauseScreen() { return false; // Don't pause during container interaction } }, menu, playerInventory, Component.literal("Custom Container") ); Minecraft.getInstance().setScreen(screen); ``` ### Response None ### Response Example None ``` -------------------------------- ### Initialize a MuiScreen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Initializes a MuiScreen instance. This method is typically called internally by screen lifecycle management. ```java public void initScreen(@Nonnull MuiScreen screen) ``` -------------------------------- ### Access Client Configuration Properties Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/BlurHandler.md Retrieve configuration values for blur effect, radius, duration, and colors from Config.Client. ```java // Enable blur effect Config.CLIENT.mBlurEffect.get(); // boolean // Blur radius Config.CLIENT.mBlurRadius.get(); // int // Background fade duration Config.CLIENT.mBackgroundDuration.get(); // int milliseconds // Background colors (4 ARGB values) Config.CLIENT.mBackgroundColor.get(); // List // Override vanilla blur Config.CLIENT.mOverrideVanillaBlur.get(); // boolean // Additional blur for vanilla screens Config.CLIENT.mAdditionalBlurEffect.get(); // boolean ``` -------------------------------- ### createMenuScreen(Fragment fragment, ScreenCallback callback, AbstractContainerMenu menu, Inventory inventory, Component title) Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Creates a Modern UI menu screen specifically for managing container interactions, requiring menu and inventory details. ```APIDOC ## createMenuScreen(Fragment fragment, ScreenCallback callback, AbstractContainerMenu menu, Inventory inventory, Component title) ### Description Creates a Modern UI menu screen for container interactions. ### Method static ### Parameters #### Path Parameters - **fragment** (Fragment) - Required - The main fragment containing the UI hierarchy - **callback** (ScreenCallback) - Optional - Callback for screen behavior customization - **menu** (AbstractContainerMenu) - Required - The container menu to manage - **inventory** (Inventory) - Required - The player inventory - **title** (Component) - Required - Screen title ### Returns A screen implementing `Screen`, `MenuAccess`, and `MuiScreen` interfaces. ### Example ```java var menuScreen = MuiModApi.get().createMenuScreen( containerFragment, null, containerMenu, playerInventory, Component.literal("Container") ); ``` ``` -------------------------------- ### Enable Blur Effect via Callback Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Use this callback to enable the blur effect, respecting the client configuration. ```java // ✅ Enable blur via callback public class MyCallback implements ScreenCallback { @Override public boolean shouldBlurBackground() { return Config.CLIENT.mBlurEffect.get(); // Respect config } } ``` -------------------------------- ### Initialize GradientRectangleRenderState Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ExtendedGuiGraphics.md Initializes a render state for gradients with four distinct corner colors. This allows for more complex color blending than simple two-color gradients. ```java GradientRectangleRenderState renderState = new GradientRectangleRenderState( color1, color2, color3, color4 ); ``` -------------------------------- ### Screen Lifecycle Methods Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Methods related to the screen's lifecycle, including initialization and removal. ```APIDOC ## Screen Lifecycle ### `init()` #### Description Called when the screen is being initialized. Initializes the Modern UI host and container layout. #### Method ```java @Override protected void init() ``` #### Called from Main thread ### `removed()` #### Description Called when the screen is being removed. Cleans up Modern UI resources and closes the container. #### Method ```java @Override public void removed() ``` #### Called from Main thread ``` -------------------------------- ### UIManager.initScreen(MuiScreen screen) Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Initializes a given MuiScreen. This method is typically called automatically by screen initialization methods. ```APIDOC ## UIManager.initScreen(MuiScreen screen) ### Description Initializes a screen. Called automatically by `SimpleScreen.init()` and `MenuScreen.init()`. ### Method ``` void initScreen(@Nonnull MuiScreen screen) ``` ### Parameters #### Path Parameters - **screen** (MuiScreen) - Required - The screen to initialize ``` -------------------------------- ### Combine ExtendedGuiGraphics with Standard GuiGraphics Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/ExtendedGuiGraphics.md Illustrates how to use both ExtendedGuiGraphics for gradient backgrounds and standard GuiGraphics for other elements like filled rectangles and text. This allows for complex UI compositions. ```java public void drawComplexUI(GuiGraphics graphics) { // Draw gradient background ExtendedGuiGraphics.fillGradientRect( graphics, 0, 0, 256, 256, 0xFF444444, 0xFF111111 ); // Draw standard filled rect on top graphics.fill(50, 50, 150, 150, 0xFF00FF00); // Draw text ExtendedGuiGraphics.drawString( graphics, "Hello World", 60, 60, 0xFFFFFFFF ); } ``` -------------------------------- ### Fix Screen Not Appearing: Setting the Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Ensure created screens are displayed by explicitly calling Minecraft.getInstance().setScreen(screen) after creating it. ```java // ❌ Wrong var screen = MuiModApi.get().createScreen(fragment); // Created but not set // ✅ Correct var screen = MuiModApi.get().createScreen(fragment); Minecraft.getInstance().setScreen(screen); // Now it shows ``` -------------------------------- ### addOnPreKeyInputListener Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Registers a callback that is invoked when GLFW key input is detected. ```APIDOC ## addOnPreKeyInputListener(OnPreKeyInputListener listener) ### Description Registers a callback invoked when GLFW key input is detected. ### Method public static void addOnPreKeyInputListener(@Nonnull OnPreKeyInputListener listener) ### Parameters #### Path Parameters * listener (OnPreKeyInputListener) - Required - Callback to register ``` -------------------------------- ### Implement Custom Screen Callback Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/README.md Illustrates how to implement custom behavior for a screen using the ScreenCallback interface. This allows overriding methods like `isPauseScreen` and `shouldBlurBackground`. ```java public class MyCallback implements ScreenCallback { @Override public boolean isPauseScreen() { return true; // Pause the game } @Override public boolean shouldBlurBackground() { return true; // Apply blur effect } } ``` -------------------------------- ### Custom Screen Rendering using UIManager Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/UIManager.md Demonstrates how a custom screen's extractRenderState() method calls mHost.render(gr, mouseX, mouseY, deltaTick) to delegate rendering tasks to the UIManager instance. ```java @Override public void extractRenderState(GuiGraphicsExtractor gr, ...) { mHost.render(gr, mouseX, mouseY, deltaTick); super.extractRenderState(gr, ...); } ``` -------------------------------- ### Rendering Method Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MenuScreen.md Method for extracting and drawing the background of the screen. ```APIDOC ## Rendering ### `extractBackground(GuiGraphicsExtractor gr, int mouseX, int mouseY, float deltaTick)` #### Description Extracts the background render state. Draws the container background if callback permits. #### Method ```java @Override public void extractBackground( @Nonnull GuiGraphicsExtractor gr, int mouseX, int mouseY, float deltaTick) ``` #### Parameters - **gr** (GuiGraphicsExtractor) - Required - Graphics context for extraction - **mouseX** (int) - Required - Mouse X position - **mouseY** (int) - Required - Mouse Y position - **deltaTick** (float) - Required - Partial tick time ``` -------------------------------- ### BlurHandler Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/types.md Singleton for managing screen background blur effects. ```APIDOC ## BlurHandler ### Description Singleton for managing screen background blur effects. ### Static Instance - **INSTANCE** (BlurHandler) - The singleton instance. ### See [`api-reference/BlurHandler.md`](api-reference/BlurHandler.md) ``` -------------------------------- ### Create Modern UI Menu Screen Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Create a Modern UI screen specifically for managing container interactions, such as inventory screens. Requires menu, inventory, and title components. ```java var menuScreen = MuiModApi.get().createMenuScreen( containerFragment, null, containerMenu, playerInventory, Component.literal("Container") ); ``` -------------------------------- ### Rendering Methods Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/SimpleScreen.md Methods responsible for rendering the background and the main UI state of the SimpleScreen, utilizing a GuiGraphicsExtractor for drawing operations. ```APIDOC ## Rendering ### `extractBackground(GuiGraphicsExtractor gr, int mouseX, int mouseY, float deltaTick)` #### Description Extracts the background render state. Draws blur effect or vanilla background depending on callback. #### Parameters - **gr** (GuiGraphicsExtractor) - Required - Graphics context for extraction - **mouseX** (int) - Required - Mouse X position - **mouseY** (int) - Required - Mouse Y position - **deltaTick** (float) - Required - Partial tick time ### `extractRenderState(GuiGraphicsExtractor gr, int mouseX, int mouseY, float deltaTick)` #### Description Extracts the main render state. Renders the Modern UI content and then vanilla overlay. #### Parameters - **gr** (GuiGraphicsExtractor) - Required - Graphics context for extraction - **mouseX** (int) - Required - Mouse X position - **mouseY** (int) - Required - Mouse Y position - **deltaTick** (float) - Required - Partial tick time ``` -------------------------------- ### Proper Input Handling Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/errors.md Handle input events correctly by checking focus, delegating to focused elements, and then passing to the host. ```java // ✅ Properly handle input @Override public boolean keyPressed(KeyEvent event) { if (getFocused() != null && getFocused().keyPressed(event)) { return true; // Consumed } // Fall through to UIManager mHost.onKeyPress(event.key(), event.scancode(), event.modifiers()); return false; // Not consumed by container } ``` -------------------------------- ### ConfigItem Class Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/types.md A generic class for managing configuration items, allowing retrieval and setting of configuration values. ```APIDOC ## ConfigItem Class ### Description A configuration item that stores and manages a single config value. ### Type Parameters - `T` - The type of value (Boolean, Integer, String, List, etc.) ### Methods - `T get()` - Get the current value - `void set(T value)` - Set the value ### Usage ```java ConfigItem blurEffect = Config.CLIENT.mBlurEffect; boolean enabled = blurEffect.get(); ``` ``` -------------------------------- ### Configuration File Locations Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/configuration.md Specifies typical locations for ModernUI configuration files based on the mod loader. ```text .minecraft/config/modernui/client.toml .minecraft/config/modernui/common.toml ``` ```text .minecraft/config/modernui/client.json .minecraft/config/modernui/common.json ``` -------------------------------- ### loadBlacklist Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/BlurHandler.md Loads screen class name patterns to exclude from blur effects. Patterns can use wildcards. ```APIDOC ## loadBlacklist(List patterns) Loads screen class name patterns to exclude from blur effects. Patterns can use wildcards. ### Method `loadBlacklist` ### Parameters #### Path Parameters - **patterns** (List) - Optional - List of blacklist patterns (e.g., "net.minecraft.client.gui.screens.*") ### Request Example ```java BlurHandler.INSTANCE.loadBlacklist(Arrays.asList( "net.minecraft.client.gui.screens.TitleScreen", "com.example.mymod.*" )); ``` ``` -------------------------------- ### Register Window Resize Listener Source: https://github.com/blocamlimb/modernui-mc/blob/master/_autodocs/api-reference/MuiModApi.md Registers a callback that is invoked at the beginning of Minecraft's GUI resize process. Use this to adapt UI elements or logic to new window dimensions. ```java public static void addOnWindowResizeListener(@Nonnull OnWindowResizeListener listener) ``` ```java MuiModApi.addOnWindowResizeListener((width, height, guiScale, oldGuiScale) -> { System.out.println("Window resized to " + width + "x" + height); System.out.println("GUI scale changed from " + oldGuiScale + " to " + guiScale); }); ```