diff --git a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/ContextMenuBuilder.java b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/ContextMenuBuilder.java index 7a23fb3b..02ae86db 100644 --- a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/ContextMenuBuilder.java +++ b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/ContextMenuBuilder.java @@ -44,7 +44,7 @@ public ContextMenuBuilder insertAtBottom(Collection toAdd) { } public void openContextMenu(BaseScreen gui) { - gui.openContextMenu(build(gui)); + gui.openContextMenu(build(gui)).setExtraZlevel(QuestScreen.Z_LEVEL); } public List build(BaseScreen gui) { diff --git a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/ChapterPanel.java b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/ChapterPanel.java index 514c0a3d..9df7f371 100644 --- a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/ChapterPanel.java +++ b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/ChapterPanel.java @@ -42,7 +42,6 @@ public class ChapterPanel extends Panel { public static final Icon ARROW_COLLAPSED = Icon.getIcon("ftbquests:textures/gui/arrow_collapsed.png"); public static final Icon ARROW_EXPANDED = Icon.getIcon("ftbquests:textures/gui/arrow_expanded.png"); - public static final int Z_LEVEL = 300; private static final Pattern NON_EMPTY_PAT = Pattern.compile("^.+$"); private final QuestScreen questScreen; @@ -140,7 +139,7 @@ public void drawBackground(GuiGraphics graphics, Theme theme, int x, int y, int @Override public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) { graphics.pose().pushPose(); - graphics.pose().translate(0, 0, Z_LEVEL); + graphics.pose().translate(0, 0, QuestScreen.Z_LEVEL); RenderSystem.enableDepthTest(); super.draw(graphics, theme, x, y, w, h); graphics.pose().popPose(); @@ -209,7 +208,7 @@ public void onClicked(MouseButton button) { run(); }, b.getTitle()).atMousePosition(); overlay.setWidth(150); - overlay.setExtraZlevel(Z_LEVEL + 10); + overlay.setExtraZlevel(QuestScreen.Z_LEVEL + 10); getGui().pushModalPanel(overlay); })); @@ -226,7 +225,7 @@ public void onClicked(MouseButton button) { } }, b.getTitle()).atMousePosition(); overlay.setWidth(150); - overlay.setExtraZlevel(Z_LEVEL + 10); + overlay.setExtraZlevel(QuestScreen.Z_LEVEL + 10); getGui().pushModalPanel(overlay); })); @@ -311,7 +310,7 @@ public void onClicked(MouseButton button) { run(); }, Component.translatable("ftbquests.chapter")).atMousePosition(); overlay.setWidth(150); - overlay.setExtraZlevel(Z_LEVEL + 10); + overlay.setExtraZlevel(QuestScreen.Z_LEVEL + 10); getGui().pushModalPanel(overlay); return; diff --git a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestButton.java b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestButton.java index 3c7af854..aeec77e8 100644 --- a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestButton.java +++ b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestButton.java @@ -402,7 +402,7 @@ public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) if (!questIcon.isEmpty()) { int s = (int) (w / 8F * 3F); poseStack.pushPose(); - poseStack.translate(x + w - s, y, 0); + poseStack.translate(x + w - s, y, QuestScreen.Z_LEVEL); questIcon.draw(graphics, 0, 0, s, s); poseStack.popPose(); } @@ -410,7 +410,7 @@ public void draw(GuiGraphics graphics, Theme theme, int x, int y, int w, int h) if (!hiddenIcon.isEmpty()) { int s = (int) (w / 8F * 3F); poseStack.pushPose(); - poseStack.translate(x, y, 0); + poseStack.translate(x, y, QuestScreen.Z_LEVEL); hiddenIcon.draw(graphics, 0, 0, s, s); poseStack.popPose(); } diff --git a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestScreen.java b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestScreen.java index 2a63c7ba..702345eb 100644 --- a/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestScreen.java +++ b/common/src/main/java/dev/ftb/mods/ftbquests/client/gui/quests/QuestScreen.java @@ -42,6 +42,10 @@ import java.util.*; public class QuestScreen extends BaseScreen { + // A fairly large z-offset is needed to ensure various GUI elements render above drawn block items, + // which can extend quite some way out of the screen if the quest button is scaled up... + public static final int Z_LEVEL = 1250; + final ClientQuestFile file; double scrollWidth, scrollHeight; @@ -107,6 +111,11 @@ public boolean doesGuiPauseGame() { return ClientQuestFile.INSTANCE.isPauseGame(); } + @Override + public int getMaxZLevel() { + return Z_LEVEL + 100; + } + @Override public void addWidgets() { QuestTheme.currentObject = selectedChapter;