Skip to content

Show Litematica and MiniHUD world overlays with a pack on - #1

Open
simply-sunny wants to merge 2 commits into
ohjey:mainfrom
simply-sunny:fix/mod-world-overlays
Open

simply-sunny wants to merge 2 commits into
ohjey:mainfrom
simply-sunny:fix/mod-world-overlays

Conversation

@simply-sunny

Copy link
Copy Markdown

Summary

With any pack on, the pack's final covered draws that mods make straight into the main target. Two places needed changes.

The first is the end of the level, which now happens at the same point Iris uses:

 LevelRenderer.render
   frame.execute
     executeOutline
   Matrix4fStack.popMatrix
+    EngineStages.afterLevel        # pack chain + final
   ...
   RETURN
     MaLiLib world-last renderers   # MiniHUD numbers, Litematica boxes
-GameRenderer.renderLevel
-  EngineStages.afterLevel

The second is a layer that holds whatever mods draw on the main target during the outline phase:

 executeOutline                     # wrapped
+  PackChain.openModDraws           # main colour -> cleared layer, depth unchanged
   Litematica @HEAD: schematic blocks
   (game outlines, own target)
   Litematica @TAIL: schematic overlay
+  restore main colour (finally)
+  PackChain.closeModDraws          # compose layer onto the features target

New files: LevelRendererModDrawsMixin and RenderTargetAccessor, both mc26.3 only.

Evidence

Tested on Minecraft 26.3 with Fabric, Sodium 0.9.2, Metallum 0.0.25, Litematica 0.29.1, MiniHUD 0.41.2 and MaLiLib 0.30.2. A schematic was placed and MiniHUD's light level overlay was on. The 26.2 and 26.3 builds and ./gradlew test pass.

Pack Before After
oh shiny! 1.4.8 no numbers, no boxes, no ghost blocks all shown
Complementary Unbound r5.9.3 no numbers, no boxes, no ghost blocks all shown
shaders off all shown all shown, unchanged
  • Before (oh shiny!): before, oh shiny
    After (oh shiny!): after, oh shiny
  • Before (Complementary): before, Complementary
    After (Complementary): after, Complementary
  • Shaders off, for reference: shaders off

There were no visible regressions in the sky, sun, clouds or hand: oh shiny!, Complementary.

Merge Danger

Door: two-way

Mixin and rendering changes only. Reverting the two commits restores 0.2.0's behaviour exactly.

Blast Radius: rendering

  • The pack's final now runs before anything at LevelRenderer.render RETURN. Any mod that drew there and relied on being covered, or on being composited by the pack, now draws on top, as it does on Iris.
  • Everything a mod draws on the main target during executeOutline goes through the layer. The pack doesn't light or shade it, much like Litematica on Iris.
  • Only the mc26.3 build is changed. The 26.2 AfterLevelMixin and outline phase are untouched.
  • Only tested on Fabric.

The pack chain ran after LevelRenderer.render returned, behind MaLiLib's
world-last renderers at its RETURN, so the pack's final covered
MiniHUD's overlays and Litematica's boxes. It now runs at the
Matrix4fStack pop inside render, the line Iris ends its level on, and
those draws land on the pack's image. Nothing between there and the
return draws.
Litematica draws its schematic at the head and tail of executeOutline,
through passes it opens on the main target, where the pack's final
covered them. For the length of that method the main target's colour
now points at a cleared layer, keeping the world's depth, and the layer
is composed premultiplied onto the target the world's translucents
blend onto. The game's glowing outlines draw to a target of their own
and are untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant