Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Imguimc Wiki › Guides › Hook Into Render Events for Real-Time Updates

Hook Into Render Events for Real-Time Updates

Using Frame Render Hooks

ImGuiMC provides event hooks at the start and end of every render frame. These let you update panel content in real-time based on game state.

Steps

1. Register a frame start listener — Hook into the pre-render event. This fires before ImGui draws, letting you prepare data.

2. Gather game state — Collect information you want to display: player position, health, inventory contents, or mod-specific values.

3. Draw your panel — Use ImGui functions to display the gathered data in windows and widgets.

4. Register a frame end listener — Optionally hook the post-render event to clean up or log data after drawing completes.

5. Test live updates — Launch the game and move around or change game state. Your panel should update every frame automatically.

Because hooks fire every frame, your panels always show current information without manual refresh. This is ideal for debug overlays, live statistics, or monitoring tools. No polling or tick events needed—the render loop handles everything.