aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java140
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java45
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java62
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java68
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java344
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetCategory.java61
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetMechanicBrowser.java116
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetSecret.java87
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetState.java53
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetStateTooltip.java54
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AbsXY.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Align.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AspectRatioFitter.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Background.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Border.java10
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Button.java8
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Clip.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ConstrainedBox.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Flexible.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicHeight.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicWidth.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Line.java7
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/LocationedPopup.java51
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Measure.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Padding.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/PopupMgr.java33
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scaler.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ScrollablePanel.java10
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scrollbar.java5
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java6
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Stack.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java98
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/UnconstrainedBox.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestPopup.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestView.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/DomElementRegistry.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/StringConversions.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java59
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/elements/locationedPopup.gui20
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/elements/popupmgr.gui2
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/elements/scrollablePanel.gui2
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/elements/simpleButton.gui26
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/elements/size.gui2
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/browser.gui55
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/category.gui20
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/secret.gui25
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/state.gui25
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui34
52 files changed, 938 insertions, 643 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
index 48e515bb..91b87969 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
@@ -24,20 +24,29 @@ import kr.syeyoung.dungeonsguide.mod.SkyblockStatus;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle;
import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor;
import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler;
+import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent;
import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.mod.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2.WidgetMechanicBrowser;
import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton;
import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayType;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
+import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
@@ -48,27 +57,29 @@ import org.lwjgl.opengl.GL14;
import java.awt.*;
import java.io.IOException;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
+import java.util.UUID;
public class FeatureMechanicBrowse extends GuiFeature {
+
+ private OverlayWidget lastOpen;
+ private OverlayWidget widget;
+ private WidgetMechanicBrowser mechanicBrowser;
+
public FeatureMechanicBrowse() {
super("Dungeon.Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300);
addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float"));
- mGuiMechanicBrowser = new MGuiMechanicBrowser(this);
- mGuiMechanicBrowser.setWorldAndResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
- lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight;
}
public double getScale() {
return this.<Float>getParameter("scale").getValue();
}
- private MGuiMechanicBrowser mGuiMechanicBrowser;
@Override
public void drawDemo(float partialTicks) {
- super.drawDemo(partialTicks);
double scale = FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue();
GlStateManager.scale(scale, scale, 1.0);
@@ -86,44 +97,59 @@ public class FeatureMechanicBrowse extends GuiFeature {
fr.drawString("Open Chat to Select Secrets", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA);
}
- private int lastWidth, lastHeight;
-
@Override
- public void drawScreen(float partialTicks) {
-
- int i = Mouse.getEventX();
- int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY();
- if (Minecraft.getMinecraft().displayWidth != lastWidth || Minecraft.getMinecraft().displayHeight != lastHeight) mGuiMechanicBrowser.initGui();
- lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight;
- mGuiMechanicBrowser.drawScreen(i,j,partialTicks);
- }
+ public void drawHUD(float partialTicks) {
+ SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null || !DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().isInitialized()) return;
+ DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext();
- @Override
- public void setFeatureRect(GUIRectangle featureRect) {
- super.setFeatureRect(featureRect);
- mGuiMechanicBrowser.initGui();
- }
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ if (dungeonRoom == null) return;
+ if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
- @Override
- public void drawHUD(float partialTicks) { }
+ double scale = FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue();
+ GlStateManager.scale(scale, scale, 1.0);
+
+ Dimension bigDim = getFeatureRect().getRectangleNoScale().getSize();
+ Dimension effectiveDim = new Dimension((int) (bigDim.width / scale),(int)( bigDim.height / scale));
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ Gui.drawRect(0, 0, effectiveDim.width, fr.FONT_HEIGHT + 4, 0xFF444444);
+ Gui.drawRect(1, 1, effectiveDim.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626);
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ fr.drawString("Selected: ", 2,2, 0xFFAAAAAA);
+ if (grp.getPath("MECH-BROWSER") == null)
+ fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000);
+ else {
+ ActionRoute route = grp.getPath("MECH-BROWSER");
+ fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00);
+ }
+ fr.drawString("Open Chat to Select Secrets", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA);
+ }
@DGEventHandler
public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
-
- try {
- mGuiMechanicBrowser.handleMouseInput();
- } catch (IOException e) {
- e.printStackTrace();
- }
+//
+// try {
+// mGuiMechanicBrowser.handleMouseInput();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
}
@DGEventHandler
public void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered) {
-
- int i = Mouse.getEventX();
- int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY();
- mGuiMechanicBrowser.drawScreen(i, j, rendered.renderPartialTicks);
+//
+// int i = Mouse.getEventX();
+// int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY();
+// mGuiMechanicBrowser.drawScreen(i, j, rendered.renderPartialTicks);
}
@DGEventHandler
@@ -140,9 +166,9 @@ public class FeatureMechanicBrowse extends GuiFeature {
DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
if (dungeonRoom == null) return;
if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
- String id = mGuiMechanicBrowser.getPanelMechanicBrowser().getSelectedID();
+ String id = mechanicBrowser.getSelectedId();
if (id != null) {
- Optional.ofNullable(dungeonRoom.getMechanics().get(mGuiMechanicBrowser.getPanelMechanicBrowser().getSelectedID()))
+ Optional.ofNullable(dungeonRoom.getMechanics().get(mechanicBrowser.getSelectedId()))
.ifPresent(a -> {
a.highlight(new Color(0,255,255,50), id +" ("+(
dungeonRoom.getMechanics().get(id).getRepresentingPoint(dungeonRoom) != null ?
@@ -158,10 +184,54 @@ public class FeatureMechanicBrowse extends GuiFeature {
mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue()) {{
setOnUpdate(() ->{
FeatureMechanicBrowse.this.<Float>getParameter("scale").setValue(this.getData());
- mGuiMechanicBrowser.initGui();
}); }
}));
return mPanels;
}
+
+ @DGEventHandler
+ public void onOpen(GuiOpenEvent event) {
+ if (event.gui instanceof GuiChat) {
+ if (widget != null)
+ OverlayManager.getInstance().addOverlay(lastOpen = widget);
+ } else {
+ if (lastOpen != null)
+ OverlayManager.getInstance().removeOverlay(lastOpen);
+ lastOpen = null;
+ }
+ }
+
+
+ private UUID lastRoomUid = null;
+ @DGEventHandler
+ public void onTick(DGTickEvent event) {
+ Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext())
+ .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition()))
+ .map(a -> {
+ return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a);
+ });
+ UUID currentUID = dungeonRoomOpt.map(a -> a.getDungeonRoomInfo().getUuid()).orElse(null);
+ // Event-ify above this.
+
+ if (!Objects.equals(lastRoomUid, currentUID)) {
+ if (currentUID == null) {
+ mechanicBrowser = null;
+ widget = null;
+ } else {
+ if (lastOpen != null)
+ OverlayManager.getInstance().removeOverlay(lastOpen);
+ widget = new OverlayWidget(
+ mechanicBrowser = new WidgetMechanicBrowser(dungeonRoomOpt.get()),
+ OverlayType.OVER_CHAT,
+ () -> {
+ Rectangle loc = getFeatureRect().getRectangleNoScale();
+ return new Rect(loc.x, loc.y, loc.width, loc.height);
+ });
+ }
+ }
+ if (mechanicBrowser != null)
+ mechanicBrowser.update();
+ lastRoomUid = currentUID;
+ }
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java
deleted file mode 100644
index d7d69e0a..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser;
-
-import kr.syeyoung.dungeonsguide.mod.gui.MGui;
-import lombok.Getter;
-
-public class MGuiMechanicBrowser extends MGui {
- private FeatureMechanicBrowse featureMechanicBrowse;
- @Getter
- private PanelMechanicBrowser panelMechanicBrowser;
- public MGuiMechanicBrowser(FeatureMechanicBrowse mechanicBrowse) {
- this.featureMechanicBrowse = mechanicBrowse;
- panelMechanicBrowser = new PanelMechanicBrowser(mechanicBrowse);
- getMainPanel().add(panelMechanicBrowser);
- }
-
- @Override
- public void initGui() {
- super.initGui();
- panelMechanicBrowser.setBounds(featureMechanicBrowse.getFeatureRect().getRectangle());
- panelMechanicBrowser.setScale(featureMechanicBrowse.getScale());
- }
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java
deleted file mode 100644
index 7ed916c0..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser;
-
-
-import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
-import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor;
-import lombok.AllArgsConstructor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-
-import java.awt.*;
-import java.util.function.BiConsumer;
-import java.util.function.Supplier;
-
-@AllArgsConstructor
-public class MechanicBrowserElement extends MPanel {
- private Supplier<String> name;
- private boolean isCategory = false;
- private BiConsumer<MechanicBrowserElement, Point> onClick;
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- if (isCategory || isFocused)
- Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF444444);
- else if (lastAbsClip.contains(absMousex, absMousey))
- Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF555555);
- Minecraft.getMinecraft().fontRendererObj.drawString((String)name.get(), 4, 1, 0xFFEEEEEE);
- }
-
- @Override
- public Dimension getPreferredSize() {
- return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(name.get()) + 8, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT);
- }
-
- @Override
- public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
- if (lastAbsClip.contains(absMouseX, absMouseY) && onClick != null)
- onClick.accept(this, new Point(lastParentPoint.x + bounds.x, lastParentPoint.y + bounds.y));
- }
-
- @Override
- public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
- if (lastAbsClip.contains(absMouseX, absMouseY) && onClick != null)
- setCursor(EnumCursor.POINTING_HAND);
- }
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java
deleted file mode 100644
index 87b100a5..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser;
-
-import kr.syeyoung.dungeonsguide.mod.gui.elements.MList;
-import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip;
-import lombok.Getter;
-import net.minecraft.client.gui.Gui;
-
-import java.awt.*;
-
-public class MechanicBrowserTooltip extends MTooltip {
- @Getter
- private MList mList;
- public MechanicBrowserTooltip() {
- mList = new MList();
- mList.setGap(0);
- add(mList);
- }
-
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Dimension effectiveDim = getEffectiveDimension();
- Gui.drawRect(0, 0, effectiveDim.width, effectiveDim.height, 0xFF444444);
- Gui.drawRect(1, 1, effectiveDim.width - 1, effectiveDim.height - 1, 0xFF262626);
- }
-
- @Override
- public void setBounds(Rectangle bounds) {
- super.setBounds(bounds);
- mList.setBounds(new Rectangle(1,1, getEffectiveDimension().width-2, getEffectiveDimension().height-2));
- mList.realignChildren();
- }
-
- @Override
- public void setScale(double scale) {
- super.setScale(scale);
- mList.setBounds(new Rectangle(1,1, getEffectiveDimension().width-2, getEffectiveDimension().height-2));
- mList.realignChildren();
- }
-
- @Override
- public Dimension getPreferredSize() {
- Dimension dim = mList.getPreferredSize();
- return new Dimension((int) ((dim.width + 2) * getScale()), (int) ((dim.height + 2) * getScale()));
- }
-
- @Override
- public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
- if (!lastAbsClip.contains(absMouseX, absMouseY)) close();
- }
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java
deleted file mode 100644
index c108f117..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser;
-
-
-import kr.syeyoung.dungeonsguide.dungeon.mechanics.*;
-import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
-import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
-import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext;
-import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute;
-import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor;
-import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
-import kr.syeyoung.dungeonsguide.mod.gui.elements.MList;
-import kr.syeyoung.dungeonsguide.mod.gui.elements.MPanelScaledGUI;
-import kr.syeyoung.dungeonsguide.mod.gui.elements.MScrollablePanel;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiChat;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.MathHelper;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-
-import java.awt.*;
-import java.util.List;
-import java.util.*;
-
-public class PanelMechanicBrowser extends MPanelScaledGUI {
- private FeatureMechanicBrowse feature;
- private MScrollablePanel scrollablePanel;
- private MList mList;
- private MechanicBrowserTooltip mechanicBrowserTooltip;
-
- public PanelMechanicBrowser(FeatureMechanicBrowse mechanicBrowse) {
- this.feature = mechanicBrowse;
- this.scrollablePanel = new MScrollablePanel(1);
- add(this.scrollablePanel);
- scrollablePanel.getScrollBarY().setWidth(0);
- mList = new MList() {
- @Override
- public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(0,0,parentWidth,parentHeight));
- Dimension prefSize = getPreferredSize();
- int hei = prefSize.height;
- setBounds(new Rectangle(0,0,parentWidth,hei));
- realignChildren();
- }
- };
- mList.setDrawLine(false); mList.setGap(0);
- scrollablePanel.add(mList);
- }
-
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- toggleTooltip(openGUI());
-
- if(Minecraft.getMinecraft().thePlayer == null) return;
-
-
- Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext())
- .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition()))
- .map(a -> {
-
- return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a);
- });
-
-
- DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null);
- renderTick(dungeonRoom);
- if (dungeonRoom == null) return;
- if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
-
- GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
-
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
-
- Dimension effectiveDim = getEffectiveDimension();
-
- Gui.drawRect(0, 0, effectiveDim.width, fr.FONT_HEIGHT + 4, 0xFF444444);
- Gui.drawRect(1, 1, effectiveDim.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626);
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- fr.drawString("Selected: ", 2,2, 0xFFAAAAAA);
- if (grp.getPath("MECH-BROWSER") == null)
- fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000);
- else {
- ActionRoute route = grp.getPath("MECH-BROWSER");
- fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00);
- }
- fr.drawString("Open Chat to Select Secrets", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA);
-
- if (!openGUI()) return;
-
- Gui.drawRect(0, fr.FONT_HEIGHT + 4, effectiveDim.width, effectiveDim.height, 0xFF444444);
- Gui.drawRect(1, fr.FONT_HEIGHT + 5, effectiveDim.width - 1,effectiveDim.height - 1, 0xFF262626);
- }
-
- private UUID lastRoomUID = null;
- public void renderTick(DungeonRoom dungeonRoom) {
- if (dungeonRoom == null && lastRoomUID != null) {
- lastRoomUID = null;
- for (MPanel childComponent : mList.getChildComponents()) {
- mList.remove(childComponent);
- }
- if (mechanicBrowserTooltip != null) {
- mechanicBrowserTooltip.close();
- mechanicBrowserTooltip = null;
- }
- selectedID = null;
- } else if (dungeonRoom != null && lastRoomUID != dungeonRoom.getDungeonRoomInfo().getUuid()) {
- lastRoomUID = dungeonRoom.getDungeonRoomInfo().getUuid();
- // SETUP THINGS.
- for (MPanel childComponent : mList.getChildComponents()) {
- mList.remove(childComponent);
- }
- if (mechanicBrowserTooltip != null) {
- mechanicBrowserTooltip.close();
- mechanicBrowserTooltip = null;
- }
- selectedID = null;
- mList.add(new MechanicBrowserElement(() -> "§bCancel Current", false, (pt, me) -> cancel(pt)));
-
- boolean found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonFairySoul) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "Fairy Soul", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonSecret) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "Secrets", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonTomb) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "Crypts", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonNPC) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "NPC", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonJournal) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "Journals", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonRoomDoor){
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "Gates", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
- found = false;
- for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) {
- if (value.getValue() instanceof DungeonDoor || value.getValue() instanceof DungeonBreakableWall || value.getValue() instanceof DungeonLever
- || value.getValue() instanceof DungeonOnewayDoor || value.getValue() instanceof DungeonOnewayLever || value.getValue() instanceof DungeonPressurePlate) {
- if (!found) {
- mList.add(new MechanicBrowserElement(() -> "ETC", true, null));
- found = true;
- }
- mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+
- (value.getValue().getRepresentingPoint(dungeonRoom) != null ?
- String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
- +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me)));
- }
- }
-
- scrollablePanel.evalulateContentArea();
-
- }
- }
-
- private int latestTooltipDY;
- @Getter
- private String selectedID = null;
- public void onElementClick(String id, DungeonMechanic dungeonMechanic, Point pt, MechanicBrowserElement mechanicBrowserElement) {
-
- Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext())
- .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition()))
- .map(a -> {
-
- return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a);
- });
- selectedID = id;
-
- DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null);
- if (dungeonRoom == null) return;
- DungeonMechanic dungeonMechanic1 = dungeonRoom.getMechanics().get(id);
- if (dungeonMechanic1 != dungeonMechanic) return;
- Set<String> states = dungeonMechanic1.getPossibleStates(dungeonRoom);
-
-
- if (mechanicBrowserTooltip != null) {
- mechanicBrowserTooltip.close();
- }
-
- latestTooltipDY = (int) (pt.y * getScale() - bounds.y - 1);
-
- mechanicBrowserTooltip = new MechanicBrowserTooltip();
- for (String state : states) {
- mechanicBrowserTooltip.getMList().add(new MechanicBrowserElement(() -> state, false, (m2, pt2) -> {
- if (dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)
- ((GeneralRoomProcessor)dungeonRoom.getRoomProcessor()).pathfind("MECH-BROWSER", id, state, FeatureRegistry.SECRET_LINE_PROPERTIES_SECRET_BROWSER.getRouteProperties());
-// mechanicBrowserTooltip.close();
-// mechanicBrowserTooltip = null;
- }));
- }
- mechanicBrowserTooltip.setScale(getScale());
- Dimension prefSize = mechanicBrowserTooltip.getPreferredSize();
- mechanicBrowserTooltip.setBounds(new Rectangle(bounds.x +
- (bounds.x > Minecraft.getMinecraft().displayWidth/2 ? -prefSize.width : bounds.width), latestTooltipDY + bounds.y, prefSize.width, prefSize.height));
- mechanicBrowserTooltip.open(this);
- }
-
- public void cancel(MechanicBrowserElement mechanicBrowserElement) {
-
- Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext())
- .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition()))
- .map(a -> {
-
- return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a);
- });
- mechanicBrowserElement.setFocused(false);
- if (!dungeonRoomOpt.isPresent()) return;
- DungeonRoom dungeonRoom = dungeonRoomOpt.get();
- if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
- ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).cancel("MECH-BROWSER");
- }
-
- public void toggleTooltip(boolean open) {
- if (mechanicBrowserTooltip != null) {
- if (open) {
- mechanicBrowserTooltip.open(this);
- } else {
- mechanicBrowserTooltip.close();
- }
- }
- }
-
- @Override
- public void setBounds(Rectangle bounds) {
- super.setBounds(bounds);
- Dimension dimension = getEffectiveDimension();
- int y = Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT + 4;
- scrollablePanel.setBounds(new Rectangle(1,y + 1, dimension.width - 2, dimension.height - y - 2));
- scrollablePanel.evalulateContentArea();
- if (mechanicBrowserTooltip != null) {
- Dimension prefSize = mechanicBrowserTooltip.getPreferredSize();
- mechanicBrowserTooltip.setScale(getScale());
- mechanicBrowserTooltip.setBounds(new Rectangle(bounds.x + (bounds.x > Minecraft.getMinecraft().displayWidth/2 ? -prefSize.width: bounds.width), latestTooltipDY + bounds.y, prefSize.width, prefSize.height));
- }
- }
-
- public boolean openGUI() {
- return Minecraft.getMinecraft().currentScreen != null
- && Minecraft.getMinecraft().currentScreen instanceof GuiChat && lastRoomUID != null;
- }
-
- @Override
- public List<MPanel> getChildComponents() {
- return openGUI() ? super.getChildComponents() : Collections.emptyList();
- }
-
- @Override
- public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) {
- selectedID = null;
- if (mechanicBrowserTooltip != null) {
- mechanicBrowserTooltip.close();
- mechanicBrowserTooltip = null;
- }
-
- return super.mouseClicked0(absMouseX, absMouseY, relMouseX0, relMouseY0, mouseButton);
- }
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetCategory.java
new file mode 100644
index 00000000..f87a774d
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetCategory.java
@@ -0,0 +1,61 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2;
+
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+
+public class WidgetCategory extends AnnotatedWidget {
+ @Bind(variableName = "categoryName")
+ public final BindableAttribute<String> categoryName = new BindableAttribute<>(String.class);
+ @Bind(variableName = "visible")
+ public final BindableAttribute<String> visible = new BindableAttribute<>(String.class, "open");
+ @Bind(variableName = "children")
+ public final BindableAttribute children = new BindableAttribute<>(WidgetList.class);
+ public WidgetCategory(String s, DungeonRoom dungeonRoom, Map<String, DungeonMechanic> dungeonMechanics, Consumer<String> onSelect) {
+ super(new ResourceLocation("dungeonsguide:gui/features/mechanicBrowser/category.gui"));
+ categoryName.setValue(s);
+
+ List<Widget> widgets = new ArrayList<>();
+ for (Map.Entry<String, DungeonMechanic> dungeonMechanic : dungeonMechanics.entrySet()) {
+ widgets.add(new WidgetSecret(dungeonMechanic.getKey(), dungeonRoom, dungeonMechanic.getValue(), onSelect));
+ }
+ children.setValue(widgets);
+ }
+
+ @On(functionName = "toggle")
+ public void toggle() {
+ if (visible.getValue().equals("open"))
+ visible.setValue("collapsed");
+ else
+ visible.setValue("open");
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetMechanicBrowser.java
new file mode 100644
index 00000000..06990fad
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetMechanicBrowser.java
@@ -0,0 +1,116 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2;
+
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.*;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor;
+import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Column;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.*;
+
+public class WidgetMechanicBrowser extends AnnotatedWidget {
+ @Bind(variableName = "current")
+ public final BindableAttribute<String> current = new BindableAttribute<>(String.class);
+ @Bind(variableName = "children")
+ public final BindableAttribute children = new BindableAttribute<>(WidgetList.class);
+ @Bind(variableName = "scale")
+ public final BindableAttribute<Double> scale = new BindableAttribute<>(Double.class);
+ @Bind(variableName = "color")
+ public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class);
+
+
+ @Setter @Getter
+ private String selectedId;
+
+ private static final List<String> order = Arrays.asList(
+ "Fairy Soul", "Secrets", "Crypts", "NPC", "Journals", "Gates", "ETC", "Dummy"
+ );
+ private String map(Class t) {
+ if (t == DungeonFairySoul.class) return "Fairy Soul";
+ if (t == DungeonSecret.class) return "Secrets";
+ if (t == DungeonTomb.class) return "Crypts";
+ if (t == DungeonNPC.class) return "NPC";
+ if (t == DungeonJournal.class) return "Journals";
+ if (t == DungeonRoomDoor.class) return "Gates";
+ if (t == DungeonDummy.class) return "Dummy";
+ return "ETC";
+ }
+
+ private DungeonRoom dungeonRoom;
+ public WidgetMechanicBrowser(DungeonRoom dungeonRoom) {
+ super(new ResourceLocation("dungeonsguide:gui/features/mechanicBrowser/browser.gui"));
+ scale.setValue(FeatureRegistry.SECRET_BROWSE.getScale());
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
+ this.dungeonRoom =dungeonRoom;
+ if (grp.getPath("MECH-BROWSER") == null) {
+ current.setValue("Nothing");
+ color.setValue(0xFFAA0000);
+ } else {
+ ActionRoute route = grp.getPath("MECH-BROWSER");
+ current.setValue(route.getMechanic()+" -> "+route.getState());
+ color.setValue(0xFFFFFF00);
+ }
+ Map<String, Map<String, DungeonMechanic>> map = new HashMap<>();
+ for (Map.Entry<String, DungeonMechanic> stringDungeonMechanicEntry : dungeonRoom.getMechanics().entrySet()) {
+ String name = map(stringDungeonMechanicEntry.getValue().getClass());
+ if (!map.containsKey(name))
+ map.put(name, new HashMap<>());
+ map.get(name).put(stringDungeonMechanicEntry.getKey(), stringDungeonMechanicEntry.getValue());
+ }
+
+ List<Widget> widgets = new ArrayList<>();
+ for (String s : order) {
+ if (!FeatureRegistry.DEBUG.isEnabled() && s.equals("Dummy")) continue;
+ if (map.containsKey(s))
+ widgets.add(new WidgetCategory(s, dungeonRoom, map.get(s), this::setSelectedId));
+ }
+ children.setValue(widgets);
+ }
+
+ public void update() {
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
+ if (grp.getPath("MECH-BROWSER") == null) {
+ current.setValue("Nothing");
+ color.setValue(0xFFAA0000);
+ } else {
+ ActionRoute route = grp.getPath("MECH-BROWSER");
+ current.setValue(route.getMechanic()+" -> "+route.getState());
+ color.setValue(0xFFFFFF00);
+ }
+ }
+
+ @On(functionName = "cancel")
+ public void cancel() {
+ GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor();
+ grp.cancel("MECH-BROWSER");
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetSecret.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetSecret.java
new file mode 100644
index 00000000..e0334b4c
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetSecret.java
@@ -0,0 +1,87 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2;
+
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.LocationedPopup;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayType;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.function.Consumer;
+
+public class WidgetSecret extends AnnotatedWidget {
+
+ @Bind(variableName = "secretName")
+ public final BindableAttribute<String> secretName = new BindableAttribute<>(String.class);
+
+ private String id;
+ private DungeonRoom room;
+ private DungeonMechanic mechanic;
+ private Consumer<String> onSelect;
+ public WidgetSecret(String name, DungeonRoom room, DungeonMechanic dungeonMechanic, Consumer<String> selectedId) {
+ super(new ResourceLocation("dungeonsguide:gui/features/mechanicBrowser/secret.gui"));
+ secretName.setValue(name+" §7("+ dungeonMechanic.getCurrentState(room) +", "+
+ (dungeonMechanic.getRepresentingPoint(room) != null ?
+ String.format("%.1f", MathHelper.sqrt_double(dungeonMechanic.getRepresentingPoint(room).getBlockPos(room).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
+ +"m)");
+ this.id = name;
+ this.mechanic = dungeonMechanic;
+ this.room = room;
+ this.onSelect = selectedId;
+ }
+
+ private LocationedPopup popup;
+ @On(functionName = "toggleStates")
+ public void openStates() {
+ Rect abs = getDomElement().getAbsBounds();
+ double x = abs.getX() + abs.getWidth();
+ double y = abs.getY();
+
+ if (x + 120 > Minecraft.getMinecraft().displayWidth)
+ x = abs.getX() - 120;
+
+
+ onSelect.accept(id);
+
+ PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement());
+ popupMgr.openPopup(popup = new LocationedPopup(x, y, new WidgetStateTooltip(room, mechanic, id)), (val) -> {
+ if (val == null)
+ onSelect.accept(null);
+ popup = null;
+ });
+ }
+
+ @Override
+ public void onUnmount() {
+ PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement());
+ if (popup != null)
+ popupMgr.closePopup(popup, "a");
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetState.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetState.java
new file mode 100644
index 00000000..cf65849c
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetState.java
@@ -0,0 +1,53 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2;
+
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor;
+import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import net.minecraft.util.ResourceLocation;
+
+public class WidgetState extends AnnotatedWidget {
+
+ @Bind(variableName = "state")
+ public final BindableAttribute<String> state = new BindableAttribute<>(String.class);
+
+ private DungeonRoom dungeonRoom;
+ private String mechanic;
+ private String s;
+
+ public WidgetState(DungeonRoom dungeonRoom, String mechanic, String s) {
+ super(new ResourceLocation("dungeonsguide:gui/features/mechanicBrowser/state.gui"));
+ state.setValue(s);
+ this.dungeonRoom = dungeonRoom;
+ this.mechanic = mechanic;
+ this.s = s;
+ }
+
+ @On(functionName = "navigate")
+ public void navigate() {
+ if (dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)
+ ((GeneralRoomProcessor)dungeonRoom.getRoomProcessor()).pathfind("MECH-BROWSER", mechanic, s, FeatureRegistry.SECRET_LINE_PROPERTIES_SECRET_BROWSER.getRouteProperties());
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetStateTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetStateTooltip.java
new file mode 100644
index 00000000..aa0eb05b
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/v2/WidgetStateTooltip.java
@@ -0,0 +1,54 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.v2;
+
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class WidgetStateTooltip extends AnnotatedWidget {
+
+ @Bind(variableName = "children")
+ public final BindableAttribute children = new BindableAttribute(WidgetList.class);
+ @Bind(variableName = "scale")
+ public final BindableAttribute<Double> scale = new BindableAttribute<>(Double.class);
+ private DungeonMechanic mechanic;
+ public WidgetStateTooltip(DungeonRoom dungeonRoom, DungeonMechanic mechanic, String mechanicId) {
+ super(new ResourceLocation("dungeonsguide:gui/features/mechanicBrowser/tooltip.gui"));
+ scale.setValue(FeatureRegistry.SECRET_BROWSE.getScale());
+ this.mechanic = mechanic;
+
+ Set<String> state = mechanic.getPossibleStates(dungeonRoom);
+ List<Widget> widgetList = new ArrayList<>();
+ for (String s : state) {
+ widgetList.add(new WidgetState(dungeonRoom, mechanicId, s));
+ }
+ children.setValue(widgetList);
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AbsXY.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AbsXY.java
index ecfb9883..75db0973 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AbsXY.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AbsXY.java
@@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.List;
public class AbsXY extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
@Export(attributeName = "x")
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Align.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Align.java
index 921ad522..34299f85 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Align.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Align.java
@@ -37,7 +37,7 @@ public class Align extends AnnotatedExportOnlyWidget implements Layouter {
@Export(attributeName = "vAlign")
public final BindableAttribute<Alignment> vAlign = new BindableAttribute<>(Alignment.class, Alignment.CENTER);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
public static enum Alignment {
START, CENTER, END
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AspectRatioFitter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AspectRatioFitter.java
index 873c0640..acc21f75 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AspectRatioFitter.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/AspectRatioFitter.java
@@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.List;
public class AspectRatioFitter extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Export(attributeName = "width")
public final BindableAttribute<Integer> width = new BindableAttribute<>(Integer.class, 1);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Background.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Background.java
index e808f2fd..43ab3c14 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Background.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Background.java
@@ -36,7 +36,7 @@ public class Background extends AnnotatedExportOnlyWidget {
@Export(attributeName = "backgroundColor")
public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class, 0xFFFFFFFF);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Border.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Border.java
index e4ce27ea..c0ccee02 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Border.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Border.java
@@ -38,15 +38,15 @@ import java.util.LinkedList;
import java.util.List;
public class Border extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$left")
+ @Export(attributeName = "_left")
public final BindableAttribute<Widget> left = new BindableAttribute<>(Widget.class);
- @Export(attributeName = "$right")
+ @Export(attributeName = "_right")
public final BindableAttribute<Widget> right = new BindableAttribute<>(Widget.class);
- @Export(attributeName = "$top")
+ @Export(attributeName = "_top")
public final BindableAttribute<Widget> top = new BindableAttribute<>(Widget.class);
- @Export(attributeName = "$bottom")
+ @Export(attributeName = "_bottom")
public final BindableAttribute<Widget> bottom = new BindableAttribute<>(Widget.class);
- @Export(attributeName = "$content")
+ @Export(attributeName = "_content")
public final BindableAttribute<Widget> content = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Button.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Button.java
index d020967e..1dc1a330 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Button.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Button.java
@@ -33,10 +33,10 @@ import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
-@Passthrough(exportName = "$", bindName = "wgtNormal", type = Widget.class)
-@Passthrough(exportName = "$hovered", bindName = "wgtHover", type = Widget.class)
-@Passthrough(exportName = "$pressed", bindName = "wgtPressed", type = Widget.class)
-@Passthrough(exportName = "$disabled", bindName = "wgtDisabled", type = Widget.class)
+@Passthrough(exportName = "_", bindName = "wgtNormal", type = Widget.class)
+@Passthrough(exportName = "_hovered", bindName = "wgtHover", type = Widget.class)
+@Passthrough(exportName = "_pressed", bindName = "wgtPressed", type = Widget.class)
+@Passthrough(exportName = "_disabled", bindName = "wgtDisabled", type = Widget.class)
public class Button extends AnnotatedWidget implements Renderer {
@Bind(variableName = "refDisabled")
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Clip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Clip.java
index 42ff1c7a..1e627d27 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Clip.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Clip.java
@@ -62,7 +62,7 @@ public class Clip extends AnnotatedExportOnlyWidget implements Renderer {
context.popClip();
}
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java
index dc4155b1..ea44a13a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java
@@ -51,7 +51,7 @@ public class Column extends AnnotatedExportOnlyWidget implements Layouter {
@Export(attributeName = "mainAlign")
public final BindableAttribute<MainAxisAlignment> vAlign = new BindableAttribute<>(MainAxisAlignment.class, MainAxisAlignment.START);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<WidgetList> widgets = new BindableAttribute<>(WidgetList.class);
@Export(attributeName = "api")
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ConstrainedBox.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ConstrainedBox.java
index a7604fcb..d1259f05 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ConstrainedBox.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ConstrainedBox.java
@@ -42,7 +42,7 @@ public class ConstrainedBox extends AnnotatedExportOnlyWidget implements Layoute
public final BindableAttribute<Double> maxHeight = new BindableAttribute<>(Double.class, Double.POSITIVE_INFINITY);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Flexible.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Flexible.java
index 4783b426..450c410a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Flexible.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Flexible.java
@@ -37,7 +37,7 @@ import java.util.Optional;
// yes it's that flexible from flutter
public class Flexible extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Export(attributeName = "flex")
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicHeight.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicHeight.java
index f821de54..acdac07e 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicHeight.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicHeight.java
@@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.List;
public class IntrinsicHeight extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicWidth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicWidth.java
index 306d366b..4c1c8f6c 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicWidth.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/IntrinsicWidth.java
@@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.List;
public class IntrinsicWidth extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Line.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Line.java
index 32bd97e0..007844c3 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Line.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Line.java
@@ -106,7 +106,12 @@ public class Line extends AnnotatedExportOnlyWidget implements Layouter, Rendere
GlStateManager.color(r,g,b,a);
GlStateManager.disableTexture2D();
- GL11.glLineWidth(thickness.getValue());
+ GL11.glLineWidth((float) (thickness.getValue() *
+ Double.max(
+ buildContext.getAbsBounds().getHeight() / buildContext.getSize().getHeight(),
+ buildContext.getAbsBounds().getWidth()/buildContext.getSize().getWidth()
+ ))
+ );
Short pattern = this.pattern.getValue();
if (pattern != null) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/LocationedPopup.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/LocationedPopup.java
new file mode 100644
index 00000000..2ed260ab
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/LocationedPopup.java
@@ -0,0 +1,51 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.guiv2.elements;
+
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import net.minecraft.util.ResourceLocation;
+
+public class LocationedPopup extends AnnotatedWidget {
+ @Bind(variableName = "x")
+ public final BindableAttribute<Double> x = new BindableAttribute<>(Double.class);
+ @Bind(variableName = "y")
+ public final BindableAttribute<Double> y = new BindableAttribute<>(Double.class);;
+ @Bind(variableName = "ref")
+ public final BindableAttribute<DomElement> ref = new BindableAttribute<>(DomElement.class);
+ @Bind(variableName = "child")
+ public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
+ public LocationedPopup(double x, double y, Widget child) {
+ super(new ResourceLocation("dungeonsguide:gui/elements/locationedPopup.gui"));
+ this.x.setValue(x);
+ this.y.setValue(y);
+ this.child.setValue(child);
+ }
+
+ @Override
+ public boolean mouseClicked(int absMouseX, int absMouseY, double relMouseX, double relMouseY, int mouseButton) {
+ if (!ref.getValue().getAbsBounds().contains(absMouseX, absMouseY)) {
+ PopupMgr.getPopupMgr(getDomElement()).closePopup(this,null);
+ }
+ return false;
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Measure.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Measure.java
index a3b3af7f..121ac8b2 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Measure.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Measure.java
@@ -56,7 +56,7 @@ public class Measure extends AnnotatedExportOnlyWidget implements Layouter {
return buildContext.getChildren().isEmpty() ? 0 : buildContext.getChildren().get(0).getLayouter().getMaxIntrinsicHeight(buildContext.getChildren().get(0), width);
}
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Export(attributeName = "size")
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Padding.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Padding.java
index 9814b038..8e1ab363 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Padding.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Padding.java
@@ -39,7 +39,7 @@ public class Padding extends AnnotatedExportOnlyWidget implements Layouter {
public final BindableAttribute<Double> top = new BindableAttribute<>(Double.class, 0.0);
@Export(attributeName = "bottom")
public final BindableAttribute<Double> bottom = new BindableAttribute<>(Double.class, 0.0);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
public Padding() {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/PopupMgr.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/PopupMgr.java
index d87b588e..7be3156d 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/PopupMgr.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/PopupMgr.java
@@ -25,6 +25,10 @@ import kr.syeyoung.dungeonsguide.mod.guiv2.xml.DomElementRegistry;
import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Export;
import net.minecraft.util.ResourceLocation;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
public class PopupMgr extends AnnotatedWidget {
public PopupMgr() {
super(new ResourceLocation("dungeonsguide:gui/elements/popupmgr.gui"));
@@ -35,8 +39,8 @@ public class PopupMgr extends AnnotatedWidget {
public final BindableAttribute<DomElement> domElementBindableAttribute = new BindableAttribute<>(DomElement.class);
- @Export(attributeName = "$")
- @Bind(variableName = "$")
+ @Export(attributeName = "_")
+ @Bind(variableName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
@@ -56,13 +60,30 @@ public class PopupMgr extends AnnotatedWidget {
return buildContext.getContext().getValue(PopupMgr.class, "popup");
}
- public void openPopup(Widget element) {
- domElementBindableAttribute.getValue().addElementFirst(element.createDomElement(getDomElement()));
+
+ private Map<DomElement, Consumer<Object>> callbacks = new HashMap<>();
+ public void openPopup(Widget element, Consumer<Object> callback) {
+ DomElement domElement = element.createDomElement(getDomElement());
+ domElementBindableAttribute.getValue().addElementFirst(domElement);
+ callbacks.put(domElement, callback);
}
- public void closePopup() {
+ public void closePopup(Object value) {
+ DomElement target = domElementBindableAttribute.getValue().getChildren().get(0);
domElementBindableAttribute.getValue().removeElement(
- domElementBindableAttribute.getValue().getChildren().get(0)
+ target
);
+
+ Consumer<Object> callback = callbacks.remove(target);
+ if (callback != null)
+ callback.accept(value);
+ }
+
+ public void closePopup(Widget widget, Object value) {
+ domElementBindableAttribute.getValue().removeElement(widget.getDomElement());
+
+ Consumer<Object> callback = callbacks.get(widget.getDomElement());
+ if (callback != null)
+ callback.accept(value);
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java
index 9843418e..3f889500 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java
@@ -50,7 +50,7 @@ public class Row extends AnnotatedExportOnlyWidget implements Layouter {
@Export(attributeName = "mainAlign")
public final BindableAttribute<MainAxisAlignment> hAlign = new BindableAttribute<>(MainAxisAlignment.class, MainAxisAlignment.START);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<WidgetList> children = new BindableAttribute<>(WidgetList.class);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scaler.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scaler.java
index ccb5e94e..38b9ac61 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scaler.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scaler.java
@@ -39,7 +39,7 @@ public class Scaler extends AnnotatedExportOnlyWidget implements Layouter, Rende
public final BindableAttribute<Double> scale = new BindableAttribute<>(Double.class, 1.0);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ScrollablePanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ScrollablePanel.java
index 97be0b0c..c13a01a0 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ScrollablePanel.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/ScrollablePanel.java
@@ -31,7 +31,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.util.ResourceLocation;
-@Passthrough(exportName = "$", bindName = "$", type = Widget.class)
+@Passthrough(exportName = "_", bindName = "_", type = Widget.class)
public class ScrollablePanel extends AnnotatedWidget {
@Bind(variableName = "contentX")
public final BindableAttribute<Double> contentX = new BindableAttribute<>(Double.class);
@@ -85,15 +85,15 @@ public class ScrollablePanel extends AnnotatedWidget {
super(new ResourceLocation("dungeonsguide:gui/elements/scrollablePanel.gui"));
contentSize.addOnUpdate((old, neu) -> {
- contentWidth.setValue(neu.getWidth() - viewportWidth.getValue());
- contentHeight.setValue(neu.getHeight() - viewportHeight.getValue());
+ contentWidth.setValue(Math.max(0, neu.getWidth() - viewportWidth.getValue()));
+ contentHeight.setValue(Math.max(0, neu.getHeight() - viewportHeight.getValue()));
});
viewportSize.addOnUpdate((old, neu) -> {
viewportWidth.setValue(neu.getWidth());
viewportHeight.setValue(neu.getHeight());
- contentWidth.setValue(contentSize.getValue().getWidth() - viewportWidth.getValue());
- contentHeight.setValue(contentSize.getValue().getHeight() - viewportHeight.getValue());
+ contentWidth.setValue(Math.max(0, contentSize.getValue().getWidth() - viewportWidth.getValue()));
+ contentHeight.setValue(Math.max(0, contentSize.getValue().getHeight() - viewportHeight.getValue()));
});
x.addOnUpdate((old, neu) -> {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scrollbar.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scrollbar.java
index 42bc1824..629b387e 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scrollbar.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Scrollbar.java
@@ -30,8 +30,8 @@ import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Export;
import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Passthrough;
import net.minecraft.util.ResourceLocation;
-@Passthrough(exportName = "$track", bindName = "track", type = Widget.class)
-@Passthrough(exportName = "$thumb", bindName = "thumb", type = Widget.class)
+@Passthrough(exportName = "_track", bindName = "track", type = Widget.class)
+@Passthrough(exportName = "_thumb", bindName = "thumb", type = Widget.class)
public class Scrollbar extends AnnotatedWidget {
// to set location and stuff
@Bind(variableName = "x")
@@ -148,7 +148,6 @@ public class Scrollbar extends AnnotatedWidget {
@Override
public void mouseReleased(int absMouseX, int absMouseY, double relMouseX, double relMouseY, int state) {
moving = false;
- System.out.println(getDomElement().isFocused());
}
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java
index c9cdcd10..893865cb 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java
@@ -40,7 +40,7 @@ public class SelectiveContainer extends AnnotatedExportOnlyWidget {
if (getDomElement().getChildren().size() > 0)
getDomElement().removeElement(getDomElement().getChildren().get(0));
if (getDomElement().getParent() != null) {
- Widget widget = widgetMap.get("$"+visibleChild.getValue()).getValue();
+ Widget widget = widgetMap.get("_"+visibleChild.getValue()).getValue();
getDomElement().addElement(widget.createDomElement(getDomElement()));
}
});
@@ -48,13 +48,13 @@ public class SelectiveContainer extends AnnotatedExportOnlyWidget {
@Override
public List<Widget> build(DomElement buildContext) {
- return Collections.singletonList(widgetMap.get("$"+visibleChild.getValue()).getValue());
+ return Collections.singletonList(widgetMap.get("_"+visibleChild.getValue()).getValue());
}
@Override
public <T> BindableAttribute<T> getExportedAttribute(String attributeName) {
BindableAttribute<T> bindableAttribute = super.getExportedAttribute(attributeName);
- if (bindableAttribute == null && attributeName.startsWith("$")) {
+ if (bindableAttribute == null && attributeName.startsWith("_")) {
BindableAttribute attribute = new BindableAttribute(Widget.class);
widgetMap.put(attributeName, attribute);
return attribute;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
index 0b81262c..950355a7 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
@@ -31,7 +31,7 @@ import java.util.List;
public class Slot extends AnnotatedExportOnlyWidget {
@Export(attributeName = "child")
public final BindableAttribute<Widget> replacement = new BindableAttribute<>(Widget.class);
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> original = new BindableAttribute<>(Widget.class);
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Stack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Stack.java
index 69060878..f849261f 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Stack.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Stack.java
@@ -103,7 +103,7 @@ public class Stack extends AnnotatedExportOnlyWidget implements Renderer {
}
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<WidgetList> widgets = new BindableAttribute<>(WidgetList.class);
@Override
public List<Widget> build(DomElement buildContext) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
index ce12d105..8ba84128 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
@@ -226,6 +226,102 @@ public class Text extends AnnotatedExportOnlyWidget implements Layouter, Rendere
// TODO: maybe turn into rich text?
@Override
public double getMaxIntrinsicHeight(DomElement buildContext, double width) {
- return this.text.getValue().split("\n").length * (fr.FONT_HEIGHT * lineSpacing.getValue());
+ List<WrappedTextData> wrappedTexts = new ArrayList<>();
+ FontRenderer fr = fontRenderer.getValue();
+ String text = this.text.getValue();
+
+ boolean hadToWrap = false;
+ int maxWidth2 = 0;
+
+
+ WordBreak wordBreak = this.wordBreak.getValue();
+
+ String[] splitByLine = text.split("\n");
+ for (String line : splitByLine) {
+ String[] splitByWord = line.split(" ");
+ double maxWidth = width;
+ int currentWidth = 0;
+ boolean added = false;
+ StringBuilder currentLine = new StringBuilder();
+ for (String s : splitByWord) {
+ int strWidth = fr.getStringWidth((added ? " " : "") +s);
+ if (strWidth + currentWidth <= maxWidth) {
+ if (added) currentLine.append(" ");
+ currentLine.append(s);
+ added = true;
+ currentWidth += strWidth;
+ } else {
+ hadToWrap = true;
+ // need to break word.
+ if (wordBreak == WordBreak.WORD) {
+ String current = s;
+ if (fr.getStringWidth(s) > maxWidth) {
+ // there is no hope. just continue.
+ current = currentLine.toString()+ " "+s;
+ } else {
+ wrappedTexts.add(new WrappedTextData(currentWidth, currentLine.toString()));
+ current = s;
+ }
+
+ // binary search unsplittable.
+ while (fr.getStringWidth(current) > maxWidth) {
+ currentLine = new StringBuilder("");
+ String remaining = "";
+ currentWidth = 0;
+ double remainingWidth = maxWidth - currentWidth;
+ while(current.length() > 1 && remainingWidth > 4) {
+ String query = current.substring(0, current.length()/2);
+ int len = fr.getStringWidth(query);
+ if (len <= remainingWidth) {
+ currentLine.append(query);
+ remainingWidth -= len;
+ current = current.substring(current.length() / 2);
+ } else {
+ remaining = current.substring(current.length() / 2) + remaining;
+ current = query;
+ }
+ }
+ remaining = current + remaining;
+
+ wrappedTexts.add(new WrappedTextData((int) (maxWidth - remainingWidth), currentLine.toString()));
+
+ current = remaining;
+ }
+ currentLine = new StringBuilder(current);
+ currentWidth = fr.getStringWidth(current);
+ } else if (wordBreak == WordBreak.NEVER) {
+ currentLine.append(" ").append(s);
+ currentWidth += strWidth;
+ break;
+ } else {
+ // binary search correct length-
+ String current = " "+s;
+ double remainingWidth = maxWidth - currentWidth;
+ String remaining = "";
+ while(current.length() > 1 && remainingWidth > 4) {
+ String query = current.substring(0, current.length()/2);
+ int len = fr.getStringWidth(query);
+ if (len <= remainingWidth) {
+ currentLine.append(query);
+ remainingWidth -= len;
+ current = current.substring(current.length() / 2);
+ } else {
+ remaining = current.substring(current.length() / 2) + remaining;
+ current = query;
+ }
+ }
+ remaining = current + remaining;
+
+ wrappedTexts.add(new WrappedTextData((int) (maxWidth - remainingWidth), currentLine.toString()));
+ currentLine = new StringBuilder(remaining);
+ currentWidth = fr.getStringWidth(remaining);
+ }
+ }
+ }
+ if (currentWidth > maxWidth2) maxWidth2 = currentWidth;
+ wrappedTexts.add(new WrappedTextData(currentWidth, currentLine.toString()));
+ }
+
+ return (fr.FONT_HEIGHT * lineSpacing.getValue()) * wrappedTexts.size();
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/UnconstrainedBox.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/UnconstrainedBox.java
index b3a2db56..ab379465 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/UnconstrainedBox.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/UnconstrainedBox.java
@@ -34,7 +34,7 @@ import java.util.List;
public class UnconstrainedBox extends AnnotatedExportOnlyWidget implements Layouter {
- @Export(attributeName = "$")
+ @Export(attributeName = "_")
public final BindableAttribute<Widget> widget = new BindableAttribute<>(Widget.class);
@Export(attributeName = "direction")
public final BindableAttribute<ScrollablePanel.Direction> direction = new BindableAttribute<>(ScrollablePanel.Direction.class, ScrollablePanel.Direction.BOTH);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestPopup.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestPopup.java
index 977246f4..6b0bad21 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestPopup.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestPopup.java
@@ -33,6 +33,6 @@ public class TestPopup extends AnnotatedImportOnlyWidget {
@On(functionName = "close")
public void onClick() {
- PopupMgr.getPopupMgr(getDomElement()).closePopup();
+ PopupMgr.getPopupMgr(getDomElement()).closePopup(null);
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestView.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestView.java
index 2325a3f8..3bd37431 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestView.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/view/TestView.java
@@ -46,6 +46,6 @@ public class TestView extends AnnotatedImportOnlyWidget {
@On(functionName = "buttonClick")
public void onClick() {
- PopupMgr.getPopupMgr(getDomElement()).openPopup(new TestPopup());
+ PopupMgr.getPopupMgr(getDomElement()).openPopup(new TestPopup(), null);
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/DomElementRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/DomElementRegistry.java
index eb0f9eb8..cd745711 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/DomElementRegistry.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/DomElementRegistry.java
@@ -41,6 +41,8 @@ public class DomElementRegistry {
}
public static <T extends Widget, R extends Widget & ImportingWidget> ParsedWidgetConverter<T, R> obtainConverter(String name) {
+ if (!converters.containsKey(name))
+ System.out.println("Try to get nonexistant widget "+name);
return converters.get(name);
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java
index c5290eea..4ba64810 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java
@@ -30,10 +30,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
public abstract class PropByPropParsedWidgetConverter<W extends Widget, R extends Widget & ImportingWidget> implements ParsedWidgetConverter<W, R> {
@@ -46,10 +43,13 @@ public abstract class PropByPropParsedWidgetConverter<W extends Widget, R extend
public W convert(R rootWidget, ParserElement element) {
W partial = instantiateWidget();
+ Set<String> boundSlots = new HashSet<>();
for (String attribute : element.getAttributes()) {
if (attribute.startsWith("bind:")) {
String name = attribute.substring(5);
String variable = element.getAttributeValue(attribute);
+ if (name.startsWith("_"))
+ boundSlots.add(name);
BindableAttribute exported = getExportedAttribute(partial, name);
if (exported == null) throw new IllegalStateException("No exported variable found named "+name+"!");
@@ -107,7 +107,8 @@ public abstract class PropByPropParsedWidgetConverter<W extends Widget, R extend
}
for (Map.Entry<String, List<ParserElement>> stringListEntry : children.entrySet()) {
- BindableAttribute attribute = getExportedAttribute(partial, "$"+stringListEntry.getKey());
+ if (boundSlots.contains("_"+stringListEntry.getKey())) continue;
+ BindableAttribute attribute = getExportedAttribute(partial, "_"+stringListEntry.getKey());
if (attribute == null) {
// ???
} else {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/StringConversions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/StringConversions.java
index 6e9138a1..5f76441f 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/StringConversions.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/StringConversions.java
@@ -46,6 +46,6 @@ public final class StringConversions {
} else if (clazz== Boolean.class) {
return (T) Boolean.valueOf(val);
}
- throw new UnsupportedOperationException("cant convert to "+clazz.getName());
+ throw new UnsupportedOperationException("cant convert to "+clazz.getName()+": "+val);
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
index 09f47fef..111a24bc 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.mod.overlay;
import kr.syeyoung.dungeonsguide.mod.guiv2.RootDom;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
@@ -63,39 +64,53 @@ public class OverlayManager {
private OverlayManager() {
this.mc = Minecraft.getMinecraft();
- view = new RootDom(root);
+ PopupMgr popupMgr = new PopupMgr();
+ popupMgr.child.setValue(root);
+ view = new RootDom(popupMgr);
guiResize(null);
view.setMounted(true);
}
@SubscribeEvent()
public void guiResize(GuiScreenEvent.InitGuiEvent.Post post){
- view.setRelativeBound(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
- view.setAbsBounds(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
- view.setSize(new Size(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
- view.getLayouter().layout(view, new ConstraintBox(
- Minecraft.getMinecraft().displayWidth,
- Minecraft.getMinecraft().displayWidth,
- Minecraft.getMinecraft().displayHeight,
- Minecraft.getMinecraft().displayHeight
+ try {
+ view.setRelativeBound(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
+ view.setAbsBounds(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
+ view.setSize(new Size(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
+ view.getLayouter().layout(view, new ConstraintBox(
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayHeight,
+ Minecraft.getMinecraft().displayHeight
));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post postRender) {
- if (!(postRender.type == RenderGameOverlayEvent.ElementType.ALL))
- return;
- view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.UNDER_CHAT);
- drawScreen(postRender.partialTicks);
+ try {
+ if (!(postRender.type == RenderGameOverlayEvent.ElementType.ALL))
+ return;
+ view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.UNDER_CHAT);
+ drawScreen(postRender.partialTicks);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@SubscribeEvent
public void renderGui(GuiScreenEvent.DrawScreenEvent.Post postRender) {
- if (postRender.gui instanceof GuiChat)
- view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.OVER_CHAT);
- else
- view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.OVER_ANY);
- drawScreen(postRender.renderPartialTicks);
+ try {
+ if (postRender.gui instanceof GuiChat)
+ view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.OVER_CHAT);
+ else
+ view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.OVER_ANY);
+ drawScreen(postRender.renderPartialTicks);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@@ -103,6 +118,14 @@ public class OverlayManager {
int i = Mouse.getEventX();
int j = this.mc.displayHeight - Mouse.getEventY();
+ if (view.isRelayoutRequested()) {
+ view.getLayouter().layout(view, new ConstraintBox(
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayHeight,
+ Minecraft.getMinecraft().displayHeight
+ ));
+ }
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
GlStateManager.pushMatrix();
GlStateManager.translate(0,0,50);
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/elements/locationedPopup.gui b/mod/src/main/resources/assets/dungeonsguide/gui/elements/locationedPopup.gui
new file mode 100644
index 00000000..9d56c62c
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/elements/locationedPopup.gui
@@ -0,0 +1,20 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+ <absXY bind:x="x" bind:y="y">
+ <slot bind:child="child" bind:ref="ref"/>
+ </absXY> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/elements/popupmgr.gui b/mod/src/main/resources/assets/dungeonsguide/gui/elements/popupmgr.gui
index 899d87ce..ed207851 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/elements/popupmgr.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/elements/popupmgr.gui
@@ -1,3 +1,3 @@
<stack bind:ref="stackRef">
- <slot bind:child="$"/>
+ <slot bind:child="_"/>
</stack> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/elements/scrollablePanel.gui b/mod/src/main/resources/assets/dungeonsguide/gui/elements/scrollablePanel.gui
index 9047865c..7efaccc7 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/elements/scrollablePanel.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/elements/scrollablePanel.gui
@@ -25,7 +25,7 @@
<absXY bind:x="contentX" bind:y="contentY">
<UnconstrainedBox bind:direction="direction">
<measure bind:size="contentSize">
- <slot bind:child="$"/>
+ <slot bind:child="_"/>
</measure>
</UnconstrainedBox>
</absXY>
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/elements/simpleButton.gui b/mod/src/main/resources/assets/dungeonsguide/gui/elements/simpleButton.gui
index ac96297c..72c689b1 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/elements/simpleButton.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/elements/simpleButton.gui
@@ -15,26 +15,34 @@
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
-<wrapper disabled="false">
+<wrapper disabled="false" crossAlign="CENTER" textAlign="CENTER" hPadding="0">
<AbstractButton bind:click="click" bind:disabled="disabled">
<bgcolor bind:backgroundColor="backgroundColor">
- <col mainAlign="CENTER">
- <Text bind:text="text" bind:color="textColor" align="CENTER"/>
+ <col mainAlign="CENTER" bind:crossAlign="crossAlign">
+ <padding bind:left="hPadding" bind:right="hPadding">
+ <Text bind:text="text" bind:color="textColor" bind:align="textAlign"/>
+ </padding>
</col>
</bgcolor>
<bgcolor slot="hovered" bind:backgroundColor="hoveredBackgroundColor">
- <col mainAlign="CENTER">
- <Text bind:text="text" bind:color="hoveredTextColor" align="CENTER"/>
+ <col mainAlign="CENTER" bind:crossAlign="crossAlign">
+ <padding bind:left="hPadding" bind:right="hPadding">
+ <Text bind:text="text" bind:color="hoveredTextColor" bind:align="textAlign"/>
+ </padding>
</col>
</bgcolor>
<bgcolor slot="disabled" bind:backgroundColor="disabledBackgroundColor">
- <col mainAlign="CENTER">
- <Text bind:text="text" bind:color="disabledTextColor" align="CENTER"/>
+ <col mainAlign="CENTER" bind:crossAlign="crossAlign">
+ <padding bind:left="hPadding" bind:right="hPadding">
+ <Text bind:text="text" bind:color="disabledTextColor" bind:align="textAlign"/>
+ </padding>
</col>
</bgcolor>
<bgcolor slot="pressed" bind:backgroundColor="pressedBackgroundColor">
- <col mainAlign="CENTER">
- <Text bind:text="text" bind:color="pressedTextColor" align="CENTER"/>
+ <col mainAlign="CENTER" bind:crossAlign="crossAlign">
+ <padding bind:left="hPadding" bind:right="hPadding">
+ <Text bind:text="text" bind:color="pressedTextColor" bind:align="textAlign"/>
+ </padding>
</col>
</bgcolor>
</AbstractButton>
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/elements/size.gui b/mod/src/main/resources/assets/dungeonsguide/gui/elements/size.gui
index 6f326058..fd292d11 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/elements/size.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/elements/size.gui
@@ -18,6 +18,6 @@
<wrapper width="+Infinity" height="+Infinity">
<ConstrainedBox bind:minWidth="width" bind:maxWidth="width" bind:minHeight="height" bind:maxHeight="height">
- <slot bind:child="$"/>
+ <slot bind:child="_"/>
</ConstrainedBox>
</wrapper> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/browser.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/browser.gui
new file mode 100644
index 00000000..fbcbd6b3
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/browser.gui
@@ -0,0 +1,55 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+<scaler bind:scale="scale">
+ <border>
+ <line slot="left" dir="VERTICAL" thickness="1.0" color="#FF444444"/>
+ <line slot="top" dir="HORIZONTAL" thickness="1.0" color="#FF444444"/>
+ <line slot="bottom" dir="HORIZONTAL" thickness="1.0" color="#FF444444"/>
+ <line slot="right" dir="VERTICAL" thickness="1.0" color="#FF444444"/>
+ <bgcolor slot="content" backgroundColor="#FF262626">
+ <col crossAlign="STRETCH">
+ <padding left="1" top="1" bottom="1">
+ <clip>
+ <row>
+ <Text text="Selected: " color="#FFAAAAAA"/>
+ <size width="4" height="0"/>
+ <Text bind:text="current" bind:color="color"/>
+ </row>>
+ </clip>
+ </padding>
+ <line slot="bottom" dir="HORIZONTAL" thickness="1.0" color="#FF444444"/>
+ <flexible>
+ <ScrollablePanel direction="VERTICAL">
+ <col crossAlign="STRETCH">
+ <ColorButton on:click="cancel" hPadding="1"
+ backgroundColor="#FF555555" textColor="#FFEEEEEE"
+ hoveredBackgroundColor="#FF636363" hoveredTextColor="#FFEEEEEE"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF707070" pressedTextColor="#FFEEEEEE"
+ text="§bCancel Current"
+ />
+ <col bind:_="children" crossAlign="START">
+ </col>
+ </col>
+ </ScrollablePanel>
+ </flexible>
+ </col>
+ </bgcolor>
+ </border>
+</scaler>
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/category.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/category.gui
index ff341ff1..98d2702d 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/category.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/category.gui
@@ -16,11 +16,19 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
-<col>
- <size height="10">
- <bgcolor backgroundColor="#FF000000">
- <Text bind:value="categoryName"/>
- </bgcolor>
+<col crossAlign="START">
+ <size height="11">
+ <ColorButton on:click="toggle"
+ backgroundColor="#FF444444" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF505050" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF555555" pressedTextColor="#FFFFFFFF"
+ bind:text="categoryName"
+ />
</size>
-
+ <SelectiveContainer bind:visible="visible">
+ <size width="0" height="0" slot="collapsed"></size>
+ <col bind:_="children" crossAlign="START" slot="open">
+ </col>
+ </SelectiveContainer>
</col> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/secret.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/secret.gui
new file mode 100644
index 00000000..2e2e8bdb
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/secret.gui
@@ -0,0 +1,25 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+ <ColorButton on:click="toggleStates" crossAlign="START" textAlign="LEFT" hPadding="1"
+ backgroundColor="#FF555555" textColor="#FFEEEEEE"
+ hoveredBackgroundColor="#FF636363" hoveredTextColor="#FFEEEEEE"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF707070" pressedTextColor="#FFEEEEEE"
+ bind:text="secretName"
+ /> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/state.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/state.gui
new file mode 100644
index 00000000..3dc588ce
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/state.gui
@@ -0,0 +1,25 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+ <ColorButton on:click="navigate" crossAlign="START" textAlign="LEFT" hPadding="1"
+ backgroundColor="#FF555555" textColor="#FFEEEEEE"
+ hoveredBackgroundColor="#FF636363" hoveredTextColor="#FFEEEEEE"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF707070" pressedTextColor="#FFEEEEEE"
+ bind:text="state"
+ /> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui
new file mode 100644
index 00000000..d948c9cf
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui
@@ -0,0 +1,34 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+<UnconstrainedBox>
+ <size width="120">
+ <scaler bind:scale="scale">
+ <border>
+ <line slot="left" dir="VERTICAL" thickness="1.0" color="#FF444444"/>
+ <line slot="top" dir="HORIZONTAL" thickness="1.0" color="#FF444444"/>
+ <line slot="bottom" dir="HORIZONTAL" thickness="1.0" color="#FF444444"/>
+ <line slot="right" dir="VERTICAL" thickness="1.0" color="#FF444444"/>
+ <bgcolor slot="content" backgroundColor="#FF262626">
+ <col bind:_="children">
+ </col>
+ </bgcolor>
+ </border>
+ </scaler>
+ </size>
+</UnconstrainedBox> \ No newline at end of file