From 105afc4ac334a19a614a1ce7416b05747fca8ac0 Mon Sep 17 00:00:00 2001 From: luxvent Date: Thu, 18 Jun 2026 19:59:30 +0300 Subject: [PATCH 1/5] Update veil to 4.2.1 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 76b337e..7d2b179 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ # Every field you add must be added to the root build.gradle expandProps map. # Project -version=1.0.6 +version=1.0.7 group=wawa.mapwright java_version=21 @@ -22,7 +22,7 @@ neo_form_version=1.21.1-20240808.144430 parchment_minecraft=1.21.1 parchment_version = 2024.11.17 -veil_version = 4.0.0 +veil_version = 4.2.1 dh_version = 2.4.5-b dh_api_version = 5.1.0 fcap_version=21.1.6 From 2afbe478cbf9627cc35822a37f8c277f0219b912 Mon Sep 17 00:00:00 2001 From: luxvent Date: Thu, 18 Jun 2026 19:59:38 +0300 Subject: [PATCH 2/5] Update changelog --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 42eb74e..266547c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1 +1 @@ -- Updated Veil to 4.0.0 \ No newline at end of file +- Updated Veil to 4.2.1 (Fixes incompatability with Sodium 0.8.12([16](https://github.com/BeeIsYou/map-drawing/issues/16)) ) \ No newline at end of file From 4fea3fee2effc8833b5048789cbb22c69ec2024a Mon Sep 17 00:00:00 2001 From: luxvent Date: Sat, 20 Jun 2026 16:40:43 +0300 Subject: [PATCH 3/5] Beating veil with a lead pipe 2.0 --- .../mixin/compat/VeilIrisCompatFix.java | 28 +++++++++++++++++++ .../src/main/resources/mapwright.mixins.json | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/wawa/mapwright/mixin/compat/VeilIrisCompatFix.java diff --git a/common/src/main/java/wawa/mapwright/mixin/compat/VeilIrisCompatFix.java b/common/src/main/java/wawa/mapwright/mixin/compat/VeilIrisCompatFix.java new file mode 100644 index 0000000..60ab609 --- /dev/null +++ b/common/src/main/java/wawa/mapwright/mixin/compat/VeilIrisCompatFix.java @@ -0,0 +1,28 @@ +package wawa.mapwright.mixin.compat; + +import foundry.veil.impl.client.render.shader.program.ShaderProgramImpl; +import net.minecraft.client.Minecraft; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import wawa.mapwright.Rendering; + +@Mixin(value = ShaderProgramImpl.Wrapper.class, priority = 2000) +public class VeilIrisCompatFix { + + /** + * Veil's Iris compat ({@code ShaderWrapperMixin}) breaks map rendering by redireecting + * every draw made with a Veil shader into an internal Iris offscreen framebuffer whenever + * a shaderpack is active, and the geometry ends up rendered into a buffer that's never + * displayed. + *

+ * Re-binds the correct render target immediately after Veil's redirect. + */ + @Inject(method = "apply", at = @At("TAIL")) + private void beginBeatingVeilWithASteelPipe(CallbackInfo ci) { + if (Rendering.inGuiShaderDraw) { + Minecraft.getInstance().getMainRenderTarget().bindWrite(true); + } + } +} \ No newline at end of file diff --git a/common/src/main/resources/mapwright.mixins.json b/common/src/main/resources/mapwright.mixins.json index 53d476b..b45cef8 100644 --- a/common/src/main/resources/mapwright.mixins.json +++ b/common/src/main/resources/mapwright.mixins.json @@ -15,7 +15,8 @@ "coordinates_config.DebugScreenOverlayMixin", "coordinates_config.GuiMixin", "coordinates_config.KeyboardHandlerMixin", - "coordinates_config.PlayerMixin" + "coordinates_config.PlayerMixin", + "compat.VeilIrisCompatFix" ], "injectors": { "defaultRequire": 1 From c2401b801bd4aafcc2f4fcc057a351809a806e50 Mon Sep 17 00:00:00 2001 From: luxvent Date: Sat, 20 Jun 2026 17:37:38 +0300 Subject: [PATCH 4/5] Keep GUI render target bound during map screen draws under Iris --- .../main/java/wawa/mapwright/Rendering.java | 35 ++++-- .../java/wawa/mapwright/map/MapScreen.java | 32 +++-- .../map/stamp_bag/widgets/DualGUIElement.java | 14 ++- .../stamp_bag/widgets/GUIElementButton.java | 9 +- .../map/stamp_bag/widgets/StampBagWidget.java | 28 +++-- .../stamp_bag/widgets/StampEntryWidget.java | 116 +++++++++--------- 6 files changed, 138 insertions(+), 96 deletions(-) diff --git a/common/src/main/java/wawa/mapwright/Rendering.java b/common/src/main/java/wawa/mapwright/Rendering.java index 15a3b8c..8364993 100644 --- a/common/src/main/java/wawa/mapwright/Rendering.java +++ b/common/src/main/java/wawa/mapwright/Rendering.java @@ -24,6 +24,13 @@ public class Rendering { + /** + * True for the duration of MapScreen's render pass. Works around in Veil's Iris + * compat that redirects any Veil-shaded draw into an internal Iris + * framebuffer whenever an Iris pipeline is registered. See {@link wawa.mapwright.mixin.compat.VeilIrisCompatFix } + */ + public static boolean inGuiShaderDraw = false; + public static class RenderTypes { public static final ResourceLocation PALETTE_SWAP = MapwrightClient.id("palette_swap"); public static final ResourceLocation UV_REMAP = MapwrightClient.id("uv_remap"); @@ -55,16 +62,22 @@ public static void renderPlayerIcon(final GuiGraphics graphics, final double x, final RenderType renderType = VeilRenderType.get(RenderTypes.UV_REMAP, skinTexture, Textures.HEAD_ICON); if(renderType == null) return; - final ShaderUniform xOffset = VeilRenderSystem.setShader(Shaders.UV_REMAP).getUniform("XOffset"); - final float rot = ((player.yRotO + 90) % 360) / 360.0f; - final int frame = Math.round(rot * 16); + Rendering.inGuiShaderDraw = true; + try { + final ShaderUniform xOffset = VeilRenderSystem.setShader(Shaders.UV_REMAP).getUniform("XOffset"); + + final float rot = ((player.yRotO + 90) % 360) / 360.0f; + final int frame = Math.round(rot * 16); - xOffset.setFloat(0.0f); - Rendering.renderTypeBlit(graphics, renderType, x, y, 0, 0.0f, 16.0f * frame, 16, 16, 16, 256, alpha); + xOffset.setFloat(0.0f); + Rendering.renderTypeBlit(graphics, renderType, x, y, 0, 0.0f, 16.0f * frame, 16, 16, 16, 256, alpha); - xOffset.setFloat(0.5f); - Rendering.renderTypeBlit(graphics, renderType, x, y, 0, 0.0f, 16.0f * frame, 16, 16, 16, 256, alpha); + xOffset.setFloat(0.5f); + Rendering.renderTypeBlit(graphics, renderType, x, y, 0, 0.0f, 16.0f * frame, 16, 16, 16, 256, alpha); + } finally { + Rendering.inGuiShaderDraw = false; + } } public static NativeImage getPaletteTexture() { @@ -102,9 +115,9 @@ public static void renderTypeBlit(final GuiGraphics guiGraphics, final RenderTyp } public static void renderTypeBlitUV1(final GuiGraphics guiGraphics, final RenderType renderType, - final int x, final int y, final int width, final int height, - final int textureWidth, final int textureHeight, final int blitOffset, - final float u, final float v) { + final int x, final int y, final int width, final int height, + final int textureWidth, final int textureHeight, final int blitOffset, + final float u, final float v) { final Matrix4f matrix4f = guiGraphics.pose().last().pose(); final BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_LIGHTMAP_COLOR); bufferBuilder.addVertex(matrix4f, (float)x, (float)y, (float)blitOffset) @@ -139,4 +152,4 @@ public static void croppedBlit(final GuiGraphics graphics, final ResourceLocatio BufferUploader.drawWithShader(bufferbuilder.buildOrThrow()); RenderSystem.disableBlend(); } -} +} \ No newline at end of file diff --git a/common/src/main/java/wawa/mapwright/map/MapScreen.java b/common/src/main/java/wawa/mapwright/map/MapScreen.java index f436b03..c2a8146 100644 --- a/common/src/main/java/wawa/mapwright/map/MapScreen.java +++ b/common/src/main/java/wawa/mapwright/map/MapScreen.java @@ -17,6 +17,7 @@ import wawa.mapwright.Helper; import wawa.mapwright.LerpedVector2d; import wawa.mapwright.MapwrightClient; +import wawa.mapwright.Rendering; import wawa.mapwright.map.stamp_bag.widgets.StampBagWidget; import wawa.mapwright.map.tool.PanTool; import wawa.mapwright.map.widgets.CompassWidget; @@ -91,19 +92,24 @@ protected void init() { @Override public void render(final GuiGraphics guiGraphics, final int mouseX, final int mouseY, final float partialTick) { - final Vector2d diffTracker = new Vector2d(); - this.lerpedPanning.tickProgress(0.05 * Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), diffTracker); - this.backgroundPanning.add(diffTracker.mul(this.zoom)); - - super.render(guiGraphics, mouseX, mouseY, partialTick); - - this.stampScreen.renderScreen(guiGraphics, mouseX, mouseY, partialTick); - - final Vec2 mouse = Helper.preciseMousePos(); - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(mouse.x % 1, mouse.y % 1, 0); - MapwrightClient.TOOL_MANAGER.get().renderScreen(guiGraphics, mouseX, mouseY); - guiGraphics.pose().popPose(); + Rendering.inGuiShaderDraw = true; + try { + final Vector2d diffTracker = new Vector2d(); + this.lerpedPanning.tickProgress(0.05 * Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), diffTracker); + this.backgroundPanning.add(diffTracker.mul(this.zoom)); + + super.render(guiGraphics, mouseX, mouseY, partialTick); + + this.stampScreen.renderScreen(guiGraphics, mouseX, mouseY, partialTick); + + final Vec2 mouse = Helper.preciseMousePos(); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(mouse.x % 1, mouse.y % 1, 0); + MapwrightClient.TOOL_MANAGER.get().renderScreen(guiGraphics, mouseX, mouseY); + guiGraphics.pose().popPose(); + } finally { + Rendering.inGuiShaderDraw = false; + } } // widgets that are rendered last (on top) have the highest interaction priority diff --git a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/DualGUIElement.java b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/DualGUIElement.java index efc78c4..51f1c14 100644 --- a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/DualGUIElement.java +++ b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/DualGUIElement.java @@ -1,6 +1,7 @@ package wawa.mapwright.map.stamp_bag.widgets; import net.minecraft.client.gui.GuiGraphics; +import wawa.mapwright.Rendering; import wawa.mapwright.gui.GUIElementAtlases; public class DualGUIElement extends GUIElementButton{ @@ -15,10 +16,15 @@ public DualGUIElement(final int x, final int y, final int scale, final GUIElemen @Override protected void renderWidget(final GuiGraphics guiGraphics, final int mouseX, final int mouseY, final float partialTick) { - if (this.imageSwitch) { - this.secondary.render(guiGraphics, this.getX(), this.getY()); - } else { - super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + Rendering.inGuiShaderDraw = true; + try { + if (this.imageSwitch) { + this.secondary.render(guiGraphics, this.getX(), this.getY()); + } else { + super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + } + } finally { + Rendering.inGuiShaderDraw = false; } } } diff --git a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/GUIElementButton.java b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/GUIElementButton.java index 7b59aa0..754e084 100644 --- a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/GUIElementButton.java +++ b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/GUIElementButton.java @@ -3,6 +3,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; +import wawa.mapwright.Rendering; import wawa.mapwright.gui.GUIElementAtlases; public class GUIElementButton extends Button { @@ -16,6 +17,12 @@ public GUIElementButton(final int x, final int y, final int scale, final GUIElem @Override protected void renderWidget(final GuiGraphics guiGraphics, final int mouseX, final int mouseY, final float partialTick) { - this.texture.render(guiGraphics, this.getX(), this.getY()); + Rendering.inGuiShaderDraw = true; + try { + this.texture.render(guiGraphics, this.getX(), this.getY()); + } finally { + Rendering.inGuiShaderDraw = false; + } + } } diff --git a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampBagWidget.java b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampBagWidget.java index 0891d59..b830130 100644 --- a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampBagWidget.java +++ b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampBagWidget.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.network.chat.Component; import wawa.mapwright.MapwrightClient; +import wawa.mapwright.Rendering; import wawa.mapwright.gui.GUIElementAtlases; import wawa.mapwright.map.MapScreen; import wawa.mapwright.map.StampBagScreen; @@ -24,18 +25,23 @@ public StampBagWidget(final int x, final int y, final MapScreen screen) { @Override protected void renderWidget(final GuiGraphics guiGraphics, final int mouseX, final int mouseY, final float v) { - if ((this.mapScreen.toolPicker.getImageFromScissorTool() != null & MapwrightClient.TOOL_MANAGER.get() instanceof CopyTool) - || StampBagScreen.INSTANCE.getState() != StampBagScreen.ScreenState.IDLE) { - GUIElementAtlases.STAMP_BAG_OPEN.render(guiGraphics, this.getX(), this.getY()); - if (this.isHovered) { - GUIElementAtlases.STAMP_BAG_OPEN_HIGHLIGHT.render(guiGraphics, this.getX() - 1, this.getY() - 1); - } - } else { - GUIElementAtlases.STAMP_BAG_CLOSED.render(guiGraphics, this.getX(), this.getY()); - if (this.isHovered) { - GUIElementAtlases.STAMP_BAG_CLOSED_HIGHLIGHT.render(guiGraphics, this.getX() - 1, this.getY() - 1); - guiGraphics.renderTooltip(Minecraft.getInstance().font, Component.translatable("mapwright.tool.stamp"), mouseX, mouseY); + Rendering.inGuiShaderDraw = true; + try { + if ((this.mapScreen.toolPicker.getImageFromScissorTool() != null & MapwrightClient.TOOL_MANAGER.get() instanceof CopyTool) + || StampBagScreen.INSTANCE.getState() != StampBagScreen.ScreenState.IDLE) { + GUIElementAtlases.STAMP_BAG_OPEN.render(guiGraphics, this.getX(), this.getY()); + if (this.isHovered) { + GUIElementAtlases.STAMP_BAG_OPEN_HIGHLIGHT.render(guiGraphics, this.getX() - 1, this.getY() - 1); + } + } else { + GUIElementAtlases.STAMP_BAG_CLOSED.render(guiGraphics, this.getX(), this.getY()); + if (this.isHovered) { + GUIElementAtlases.STAMP_BAG_CLOSED_HIGHLIGHT.render(guiGraphics, this.getX() - 1, this.getY() - 1); + guiGraphics.renderTooltip(Minecraft.getInstance().font, Component.translatable("mapwright.tool.stamp"), mouseX, mouseY); + } } + } finally { + Rendering.inGuiShaderDraw = false; } } diff --git a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampEntryWidget.java b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampEntryWidget.java index 17976e8..a652104 100644 --- a/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampEntryWidget.java +++ b/common/src/main/java/wawa/mapwright/map/stamp_bag/widgets/StampEntryWidget.java @@ -56,63 +56,67 @@ public void onClick(final double mouseX, final double mouseY) { @Override protected void renderWidget(final GuiGraphics guiGraphics, final int mx, final int my, final float v) { - if (this.stampInformation == null) { - return; - } - - final StampTexture manager = this.stampInformation.getTextureManager(); - final NativeImage tex = manager.getTexture(); - if (tex == null) { - return; - } - - if (!this.registered) { - this.registered = true; - Minecraft.getInstance().getTextureManager().register(this.id, manager); - } - - final PoseStack ps = guiGraphics.pose(); - ps.pushPose(); - final RenderType renderType = VeilRenderType.get(Rendering.RenderTypes.PALETTE_SWAP, this.id); - if (renderType == null) { - return; - } - - ps.pushPose(); - //TODO:center - ps.translate(this.getX() + 1, this.getY() + 1, 0); - - final float scale = Math.min(56f / tex.getWidth() / 2f, 56f / tex.getHeight() / 2f); - ps.scale(scale, scale, 1); - - Rendering.renderTypeBlit(guiGraphics, renderType, 4.1, 4, 0, 0f, 0f, - manager.getTexture().getWidth(), manager.getTexture().getHeight(), manager.getTexture().getWidth(), manager.getTexture().getHeight(), 1); - ps.popPose(); - - ps.pushPose(); - guiGraphics.enableScissor(this.getX() + 36, this.getY() + 5, this.getX() + 123, this.getY() + 27); - ps.translate(this.getX() + 38, this.getY() + 8, 0); - if (Minecraft.getInstance().font.width(this.stampInformation.getCustomName()) < 85) { - ps.translate(0, 4, 0); - } - - // slight scale to handle wordwrap weirdness - ps.scale(1.05f, 1.05f, 1); - - //TODO: scroll - guiGraphics.drawWordWrap(Minecraft.getInstance().font, FormattedText.of(this.stampInformation.getCustomName()), 0, 0, 85, Color.WHITE.getRGB()); - guiGraphics.disableScissor(); - ps.popPose(); - - if (this.isHovered()) { - ps.translate(0, 0, 10); - final int tx = mx - tex.getWidth() - 16; - final int ty = my - tex.getHeight() / 2; - guiGraphics.blitSprite(StampBagDebuggerTool.backgroundID, tx - 5, ty - 5, tex.getWidth() + 10, tex.getHeight() + 10); - Rendering.renderTypeBlit(guiGraphics, renderType, tx, ty, 0, 0f, 0f, + Rendering.inGuiShaderDraw = true; + try { + if (this.stampInformation == null) { + return; + } + + final StampTexture manager = this.stampInformation.getTextureManager(); + final NativeImage tex = manager.getTexture(); + if (tex == null) { + return; + } + + if (!this.registered) { + this.registered = true; + Minecraft.getInstance().getTextureManager().register(this.id, manager); + } + + final RenderType renderType = VeilRenderType.get(Rendering.RenderTypes.PALETTE_SWAP, this.id); + if (renderType == null) { + return; // nothing pushed yet, safe + } + + final PoseStack ps = guiGraphics.pose(); + ps.pushPose(); + //TODO:center + ps.translate(this.getX() + 1, this.getY() + 1, 0); + + final float scale = Math.min(56f / tex.getWidth() / 2f, 56f / tex.getHeight() / 2f); + ps.scale(scale, scale, 1); + + Rendering.renderTypeBlit(guiGraphics, renderType, 4.1, 4, 0, 0f, 0f, manager.getTexture().getWidth(), manager.getTexture().getHeight(), manager.getTexture().getWidth(), manager.getTexture().getHeight(), 1); + ps.popPose(); + + ps.pushPose(); + guiGraphics.enableScissor(this.getX() + 36, this.getY() + 5, this.getX() + 123, this.getY() + 27); + ps.translate(this.getX() + 38, this.getY() + 8, 0); + if (Minecraft.getInstance().font.width(this.stampInformation.getCustomName()) < 85) { + ps.translate(0, 4, 0); + } + + // slight scale to handle wordwrap weirdness + ps.scale(1.05f, 1.05f, 1); + + //TODO: scroll + guiGraphics.drawWordWrap(Minecraft.getInstance().font, FormattedText.of(this.stampInformation.getCustomName()), 0, 0, 85, Color.WHITE.getRGB()); + guiGraphics.disableScissor(); + ps.popPose(); + + if (this.isHovered()) { + ps.translate(0, 0, 10); + final int tx = mx - tex.getWidth() - 16; + final int ty = my - tex.getHeight() / 2; + guiGraphics.blitSprite(StampBagDebuggerTool.backgroundID, tx - 5, ty - 5, tex.getWidth() + 10, tex.getHeight() + 10); + Rendering.renderTypeBlit(guiGraphics, renderType, tx, ty, 0, 0f, 0f, + manager.getTexture().getWidth(), manager.getTexture().getHeight(), manager.getTexture().getWidth(), manager.getTexture().getHeight(), 1); + } + + ps.popPose(); + } finally { + Rendering.inGuiShaderDraw = false; } - - ps.popPose(); } } From 827c7d06942ab4ba0c76412d3979b04424fe9209 Mon Sep 17 00:00:00 2001 From: luxvent Date: Sat, 20 Jun 2026 17:40:23 +0300 Subject: [PATCH 5/5] Update changelog --- Changelog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 266547c..1520f68 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1 +1,2 @@ -- Updated Veil to 4.2.1 (Fixes incompatability with Sodium 0.8.12([16](https://github.com/BeeIsYou/map-drawing/issues/16)) ) \ No newline at end of file +- Updated Veil to 4.2.1 (Fixes incompatability with Sodium 0.8.12([16](https://github.com/BeeIsYou/map-drawing/issues/16)) ) +- Fixed map screen not rendering whenever an Iris shaderpack is active on newer versions of Veil \ No newline at end of file