Skip to content

About

Client-side UI layout engine and OpenGL matrix transformation hooks using bytecode Mixins.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RelocateUI

Move, scale and hide any HUD element, from vanilla or from other mods, with an in-game drag-and-drop editor.

Minecraft 1.21.1 · NeoForge · client-side only · CC0 (public domain)

Press K in game to open the editor. The player-facing feature list and full controls are in MODRINTH.md.

How it works

  • Layers: NeoForge draws the HUD as named GUI layers and fires RenderGuiLayerEvent.Pre/Post around each one. LayerTransformer wraps every layer in a transform on RenderSystem's model-view matrix. That also moves mods that skip GuiGraphics and draw with their own matrices, like Xaero's Minimap.
  • Overlays outside layers: mods that draw in RenderGuiEvent.Pre/Post instead of registering a layer are grouped into two pseudo-layers, relocateui:before_hud and relocateui:after_hud.
  • Compat mixins (mixin/compat, applied only when the target mod is installed, via RelocateUIMixinPlugin): Jade's overlay is split out of the after-HUD group into jade:overlay (LayerTransformer.beginNested). Spell Atlas's inventory panels are moved by shifting the rectangles its InventoryPanel.area()/bottomArea() return.
  • Menus: ScreenEditor and ScreenLayout move widgets that mods add to container screens (via an offset in AbstractWidget.getX()/getY()) and compat-reported panels, with offsets saved per screen type.
  • Bounds: GuiGraphicsMixin hooks the low-level draw methods (fill, innerBlit, drawString, renderItem, and so on) to measure where each layer naturally draws. Anchoring and scaling are computed from that measurement. The same mixin moves scissor rectangles, which ignore matrices.
  • HUD under the editor: GameRendererMixin hides the editor screen during the HUD pass, so mods that skip drawing while a screen is open keep drawing.
  • Storage: layouts are saved to config/relocateui-layout.json.
File Role
client/LayerTransformer Applies each layer's placement and keeps the matrix stack balanced
client/LayerTracker Natural bounds per layer, and which layers drew this frame
client/Placement, client/Anchor Anchor and scale math
client/LayoutStore JSON persistence
client/LayoutEditorScreen The editor: dragging, snapping, grid, keys

Building

./gradlew build        # jar in build/libs/
./gradlew runClient    # dev client; put test mods in run/client/mods/

Requires Java 21.

License

CC0 1.0. Files from the NeoForge MDK template are under TEMPLATE_LICENSE.txt.

About

Client-side UI layout engine and OpenGL matrix transformation hooks using bytecode Mixins.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages