Skip to content

Commit

Permalink
fix for 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 12, 2024
1 parent 90d52dc commit a65e66b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void onRenderGameOverlayPost(DrawContext drawContext)

if (GuiSchematicManager.hasPendingPreviewTask())
{
OverlayRenderer.getInstance().renderPreviewFrame(mc);
OverlayRenderer.getInstance().renderPreviewFrame(mc, drawContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ public void postRenderHovered(int mouseX, int mouseY, boolean selected, DrawCont
int x1 = x + 10;
int x2 = x1 + w1 + 20;

// TODO 1.21.2+
// Draw a Background Mask to hide Button Widgets behind it (Hack-around)
fi.dy.masa.litematica.render.RenderUtils.renderBackgroundMask(x + 1, y + 1, totalWidth - 2, 58, drawContext);
//fi.dy.masa.litematica.render.RenderUtils.renderBackgroundMask(x + 1, y + 1, totalWidth - 2, 58, drawContext);
RenderUtils.drawOutlinedBox(x, y, totalWidth, 60, 0xFF000000, GuiBase.COLOR_HORIZONTAL_BAR);
y += 6;
int y1 = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,13 @@ public void render(int x, int y, MinecraftClient mc, DrawContext drawContext)
{
if (this.stateExpected != null && this.stateFound != null)
{
// TODO 1.21.2+
/*
if (this.useBackgroundMask)
{
fi.dy.masa.litematica.render.RenderUtils.renderBackgroundMask(x + 1, y + 1, this.totalWidth - 1, this.totalHeight - 1, drawContext);
}
*/

MatrixStack matrixStack = drawContext.getMatrices();
matrixStack.push();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/fi/dy/masa/litematica/render/BlockInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ public void render(int x, int y, MinecraftClient mc, DrawContext drawContext)
{
if (this.state != null)
{
// TODO 1.21.2+
/*
if (this.useBackgroundMask)
{
fi.dy.masa.litematica.render.RenderUtils.renderBackgroundMask(x + 1, y + 1, this.totalWidth - 1, this.totalHeight - 1, drawContext);
}
*/

RenderUtils.drawOutlinedBox(x, y, this.totalWidth, this.totalHeight, 0xFF000000, GuiBase.COLOR_HORIZONTAL_BAR);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,21 +615,24 @@ else if (hasInvSchematic)
{
BlockMismatchInfo info = new BlockMismatchInfo(stateSchematic, stateClient);
this.getOverlayPosition(align, info.getTotalWidth(), info.getTotalHeight(), offY, invHeight, mc);
info.toggleUseBackgroundMask(true);
// TODO 1.21.2+
//info.toggleUseBackgroundMask(true);
info.render(this.blockInfoX, this.blockInfoY, mc, drawContext);
}
else if (traceWrapper.getHitType() == RayTraceWrapper.HitType.VANILLA_BLOCK)
{
BlockInfo info = new BlockInfo(stateClient, "litematica.gui.label.block_info.state_client");
this.getOverlayPosition(align, info.getTotalWidth(), info.getTotalHeight(), offY, invHeight, mc);
info.toggleUseBackgroundMask(true);
// TODO 1.21.2+
//info.toggleUseBackgroundMask(true);
info.render(this.blockInfoX, this.blockInfoY, mc, drawContext);
}
else if (traceWrapper.getHitType() == RayTraceWrapper.HitType.SCHEMATIC_BLOCK)
{
BlockInfo info = new BlockInfo(stateSchematic, "litematica.gui.label.block_info.state_schematic");
this.getOverlayPosition(align, info.getTotalWidth(), info.getTotalHeight(), offY, invHeight, mc);
info.toggleUseBackgroundMask(true);
// TODO 1.21.2+
//info.toggleUseBackgroundMask(true);
info.render(this.blockInfoX, this.blockInfoY, mc, drawContext);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/fi/dy/masa/litematica/render/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,13 @@ public static int renderInventoryOverlay(BlockInfoAlignment align, LeftRight sid
return props.height;
}

// TODO 1.21.2+
/*
public static void renderBackgroundMask(int startX, int startY, int width, int height, DrawContext drawContext)
{
fi.dy.masa.malilib.render.RenderUtils.drawTexturedRect(GuiBase.BG_TEXTURE, startX, startY, 0, 0, width, height, drawContext);
}
*/

/*
private static void renderModelBrightnessColor(IBlockState state, IBakedModel model, float brightness, float r, float g, float b)
Expand Down

0 comments on commit a65e66b

Please sign in to comment.