Configuring the Widget Renderer
From version 3.0.0 onwards, you configure the renderer using `DynamicHudConfigurator.configureRenderer` or `DynamicHudConfigurator.overrideRenderer`.
public class MyIntegration implements DynamicHudIntegration{
TextWidget exampleWidget;
@Override
public void init() {
//Previously added and initialised text widget
}
@Override
public DynamicHudConfigurator configure(DynamicHudConfigurator configurator) {
return configurator
.addWidget(exampleWidget)
.configureRenderer(renderer -> {
// Render widgets in-game (e.g., in a world)
renderer.shouldRenderInGameHud(true);
// Add TitleScreen to allowed screens (default includes GameMenuScreen)
renderer.addScreen(TitleScreen.class);
// Set custom Z-index for rendering
// for example if you want a widget to appear above the inventory screen
// renderer.withZIndex(150);
})
.withMoveableScreen(config -> new AbstractMoveableScreen(Text.literal("My HUD Editor"), config.getRenderer()) {});
}
}Using a Custom Predicate
Overriding the Renderer
Last updated