diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-07 23:47:57 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-07 23:47:57 +0900 |
commit | 9ea4e7e3521af59b524aa629e90daec56a25aa02 (patch) | |
tree | 14a9ad451a822e4aec920c6f67a305bfaacb7358 /mod/src/main | |
parent | e0c1d208663c943fc63dbea6e8860df56135ea5e (diff) | |
download | Skyblock-Dungeons-Guide-9ea4e7e3521af59b524aa629e90daec56a25aa02.tar.gz Skyblock-Dungeons-Guide-9ea4e7e3521af59b524aa629e90daec56a25aa02.tar.bz2 Skyblock-Dungeons-Guide-9ea4e7e3521af59b524aa629e90daec56a25aa02.zip |
- Fix profile viewer
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main')
5 files changed, 164 insertions, 33 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java index 51f9a8b4..ea1972b2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java @@ -89,28 +89,7 @@ public abstract class AbstractHUDFeature extends AbstractGuiFeature { public Double getKeepRatio() {return null;} - public abstract void drawDemo(float partialTicks); - - public class WidgetFeatureWrapper extends Widget implements Renderer, Layouter { - @Override - public List<Widget> build(DomElement buildContext) { - return Collections.emptyList(); - } - - @Override - public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) { - drawDemo(partialTicks); - } - - @Override - public Size layout(DomElement buildContext, ConstraintBox constraintBox) { - return new Size(constraintBox.getMaxWidth(), constraintBox.getMaxHeight()); - } - } - - public Widget instantiateDemoWidget() { - return new WidgetFeatureWrapper(); - } + public abstract Widget instantiateDemoWidget(); @Override public void loadConfig(JsonObject jsonObject) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultingDelegatingTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultingDelegatingTextStyle.java new file mode 100644 index 00000000..3c6915be --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultingDelegatingTextStyle.java @@ -0,0 +1,159 @@ +/* + * 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.text; + +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.DefaultFontRenderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.FontRenderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.shaders.Shader; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.shaders.SingleColorShader; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ITextStyle; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Setter @Accessors(chain = true) +public class DefaultingDelegatingTextStyle implements ITextStyle { + public Double size; + public Double topAscent; + public Double bottomAscent; + + + + public Boolean bold; + public Boolean italics; + public Boolean strikeThrough; + public Boolean underline; + public Boolean outline; + public Boolean shadow; + + public Shader backgroundShader; + public Shader textShader; + public Shader strikeThroughShader; + public Shader underlineShader; + public Shader outlineShader; + public Shader shadowShader; + + + @Getter @Setter + public DefaultingDelegatingTextStyle parent; + public FontRenderer fontRenderer; + + public static DefaultingDelegatingTextStyle ofDefault() { + DefaultingDelegatingTextStyle parentDelegatingTextStyle = new DefaultingDelegatingTextStyle(); + parentDelegatingTextStyle.size = 8.0; + parentDelegatingTextStyle.topAscent = 0.0; + parentDelegatingTextStyle.bottomAscent = 1 / 8.0; + parentDelegatingTextStyle.bold = false; + parentDelegatingTextStyle.italics = false; + parentDelegatingTextStyle.strikeThrough = false; + parentDelegatingTextStyle.underline = false; + parentDelegatingTextStyle.shadow = false; + parentDelegatingTextStyle.outline = false; + + parentDelegatingTextStyle.backgroundShader = new SingleColorShader(0x00FFFFFF); + parentDelegatingTextStyle.textShader = new SingleColorShader(0xFFFFFFFF); + parentDelegatingTextStyle.strikeThroughShader = new SingleColorShader(0xFF000000); + parentDelegatingTextStyle.underlineShader = new SingleColorShader(0xFF000000); + parentDelegatingTextStyle.outlineShader = new SingleColorShader(0xFF000000); + parentDelegatingTextStyle.shadowShader = new SingleColorShader(0xFF000000); + + parentDelegatingTextStyle.fontRenderer = DefaultFontRenderer.DEFAULT_RENDERER; + return parentDelegatingTextStyle; + } + + @Override + public Double getSize() { + return parent != null && size == null ? parent.getSize() : size; + } + + @Override + public Double getTopAscent() { + return parent != null && topAscent == null ? parent.getTopAscent() : topAscent; + } + + @Override + public Double getBottomAscent() { + return parent != null && bottomAscent == null ? parent.getBottomAscent() : bottomAscent; + } + + @Override + public Boolean isBold() { + return parent != null && bold == null ? parent.isBold() : bold; + } + + @Override + public Boolean isItalics() { + return parent != null && italics == null ? parent.isItalics() : italics; + } + + @Override + public Boolean isOutline() { + return parent != null && outline == null ? parent.isOutline() : outline; + } + + @Override + public Boolean isShadow() { + return parent != null && shadow == null ? parent.isShadow() : shadow; + } + + @Override + public Boolean isStrikeThrough() { + return parent != null && strikeThrough == null ? parent.isStrikeThrough() : strikeThrough; + } + + @Override + public Boolean isUnderline() { + return parent != null && underline == null ? parent.isUnderline() : underline; + } + + @Override + public FontRenderer getFontRenderer() { + return parent != null && fontRenderer == null ? parent.getFontRenderer() : fontRenderer; + } + + @Override + public Shader getShadowShader() { + return parent != null && shadowShader == null ? parent.getShadowShader() : shadowShader; + } + + @Override + public Shader getBackgroundShader() { + return parent != null && backgroundShader == null ? parent.getBackgroundShader() : backgroundShader; + } + + @Override + public Shader getOutlineShader() { + return parent != null && outlineShader == null ? parent.getOutlineShader() : outlineShader; + } + + @Override + public Shader getStrikeThroughShader() { + return parent != null && strikeThroughShader == null ? parent.getStrikeThroughShader() : strikeThroughShader; + } + + @Override + public Shader getTextShader() { + return parent != null && textShader == null ? parent.getTextShader() : textShader; + } + + @Override + public Shader getUnderlineShader() { + return parent != null && underlineShader == null ? parent.getUnderlineShader() : underlineShader; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java index 5c2ff8ff..179a21f0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java @@ -99,16 +99,6 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style return Minecraft.getMinecraft().fontRendererObj; } - @Override - public void drawDemo(float partialTicks) { - List<StyledText> asd = getDummyText(); - double scale = this.<Double>getParameter("scale").getValue(); - GlStateManager.scale(scale, scale, 0); - - StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, 100, getStylesMap(), - StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<RichText.TextAlign>getParameter("alignment").getValue().name())); - } - @RequiredArgsConstructor public static class TextHUDDemo extends Widget implements MarkerProvider { public final TextHUDFeature hudFeature; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/AbsLocationPopup.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/AbsLocationPopup.java index 29bc4614..4f816455 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/AbsLocationPopup.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/AbsLocationPopup.java @@ -93,8 +93,10 @@ public class AbsLocationPopup extends AnnotatedImportOnlyWidget { return false; } + protected boolean cursorPassthrough = true; + @Override public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX0, double relMouseY0) { - return true; + return cursorPassthrough; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/MouseTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/MouseTooltip.java index 7a9c2f37..1062dd39 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/MouseTooltip.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/popups/MouseTooltip.java @@ -37,6 +37,7 @@ public class MouseTooltip extends Widget { public MouseTooltip(Widget content) { absLocationPopup = new AbsLocationPopup(x,y, content, false); + absLocationPopup.cursorPassthrough = false; } @Override public List<Widget> build(DomElement buildContext) { |