DearImGui for Minecraft
A library mod that provides developers with the ability to integrate ImGui into the Minecraft environment. This tool specializes in creating debug interfaces and debugging tools directly within the game space.
Connection Setup
To begin using, you need to add the dependency to your project's build.gradle(.kts) file:
repositories {
maven("https://maven.deftu.dev/snapshots")
}
dependencies {
modImplementation("dev.deftu:dearimguimc-<MINECRAFTVERSION>-fabric:<VERSION>")
}
Specify the Minecraft version instead of <MINECRAFTVERSION> and the library version instead of <VERSION> according to your needs.
Interface Creation
To work with ImGUI, create your own DearImGuiEntrypoint class and register it in the configuration file fabric.mod.json:
{
"entrypoints": {
"imgui": ["your.package.here.DearImGuiEntrypoint"]
}
}
The DearImGuiEntrypoint class supports two overridable methods — createRenderer and render:
public class ExampleDearImGuiEntrypoint implements DearImGuiEntrypoint {
@Override
public ImGuiRenderer createRenderer() {
return new ExampleImGuiRenderer();
}
@Override
public void render() {
// Place ImGui rendering code here
}
}
The createRenderer method provides more configuration possibilities, allowing you to pass additional parameters to your renderer.
Implementation Examples
Demonstration of a basic renderer:
public class ExampleImGuiRenderer implements ImGuiRenderer {
@Override
public void render() {
ImGui.showDemoWindow();
}
}
Using the render method directly:
public class ExampleDearImGuiEntrypoint implements DearImGuiEntrypoint {
@Override
public void render() {
ImGui.showDemoWindow();
}
}
The library is distributed under the LGPL-3.0 license, which provides flexibility for use in various projects.