diff options
Diffstat (limited to 'mod/src/main/java')
64 files changed, 1733 insertions, 330 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java index c082eb2a..232b6ccb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/FeatureItem.java @@ -23,7 +23,6 @@ import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; -import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Navigator; import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; @@ -33,8 +32,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.util.ResourceLocation; -import java.util.function.Supplier; - public class FeatureItem extends AnnotatedImportOnlyWidget { @Bind(variableName = "name") @@ -69,7 +66,7 @@ public class FeatureItem extends AnnotatedImportOnlyWidget { guiRelocateShow.setValue(feature instanceof AbstractHUDFeature ? "show" : "hide"); configureShow.setValue(feature.getConfigureWidget() != null ? "show" : "hide"); - enableShow.setValue(feature.isDisyllable() ? "show" : "hide"); + enableShow.setValue(feature.isDisableable() ? "show" : "hide"); enabled.setValue(feature.isEnabled()); enabled.addOnUpdate((old, neu) -> { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDConfigRootWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDConfigRootWidget.java index 4d94ca3c..f68c5089 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDConfigRootWidget.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDConfigRootWidget.java @@ -29,14 +29,9 @@ import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Position; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size; -import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.OnlyChildrenRenderer; import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; -import kr.syeyoung.dungeonsguide.mod.overlay.GUIRectPositioner; -import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget; -import kr.syeyoung.dungeonsguide.mod.overlay.Positioner; import lombok.Getter; -import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import java.util.*; @@ -103,7 +98,7 @@ public class HUDConfigRootWidget extends Widget implements Layouter, Renderer { widgets.add(new EventListenerWidget()); for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (!(abstractFeature instanceof AbstractHUDFeature)) continue; - if (!abstractFeature.isEnabled() && abstractFeature.isDisyllable()) continue; + if (!abstractFeature.isEnabled() && abstractFeature.isDisableable()) continue; HUDWidgetWrapper widgetWrapper = new HUDWidgetWrapper((AbstractHUDFeature) abstractFeature, this, filter == null || abstractFeature == filter); widgets.add(widgetWrapper); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCOptAColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCOptAColor.java new file mode 100644 index 00000000..4fd3a076 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCOptAColor.java @@ -0,0 +1,76 @@ +/* + * 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.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.ParameterItem; +import kr.syeyoung.dungeonsguide.mod.config.types.coloredit.ColorEditPopup; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +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.elements.popups.AbsLocationPopup; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; + +import java.util.Optional; + +public class TCOptAColor implements FeatureTypeHandler<Optional<AColor>> { + public static final TCOptAColor INSTANCE = new TCOptAColor(); + @Override + public Optional<AColor> deserialize(JsonElement element) { + if (element instanceof JsonPrimitive) + return Optional.of(new AColor(element.getAsInt(), true)); + + JsonObject object = element.getAsJsonObject(); + if (object.has("present") && !object.get("present").isJsonNull() && object.get("present").getAsBoolean()) { + AColor color = new AColor(object.get("color").getAsInt(), true); + color.setChroma(object.get("chroma").getAsBoolean()); + color.setChromaSpeed(object.get("chromaSpeed").getAsFloat()); + return Optional.of(color); + } else { + return Optional.empty(); + } + } + + @Override + public JsonElement serialize(Optional<AColor> element) { + JsonObject object = new JsonObject(); + if (element.isPresent()) { + object.addProperty("present", true); + object.addProperty("color", element.get().getRGB()); + object.addProperty("chroma", element.get().isChroma()); + object.addProperty("chromaSpeed", element.get().getChromaSpeed()); + } else { + object.addProperty("present", false); + } + return object; + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyle.java index 9d1d099b..60db32dc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyle.java @@ -18,11 +18,9 @@ package kr.syeyoung.dungeonsguide.mod.config.types; -import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; public class TCRTextStyle implements FeatureTypeHandler<DefaultingDelegatingTextStyle> { @@ -43,10 +41,10 @@ public class TCRTextStyle implements FeatureTypeHandler<DefaultingDelegatingText textStyle.setShadow(object.has("shadow") && !object.get("shadow").isJsonNull()? object.get("shadow").getAsBoolean() : null); textStyle.setBackgroundShader(object.has("backgroundColor") && !object.get("backgroundColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("backgroundColor")) : null); textStyle.setTextShader(object.has("textColor") && !object.get("textColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("textColor")) : null); - textStyle.setStrikeThroughShader(object.has("strikethroughColor") && !object.get("strikethroughColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("strikethroughColor")) : null); - textStyle.setUnderlineShader(object.has("underlineColor") && !object.get("underlineColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("underlineColor")) : null); - textStyle.setOutlineShader(object.has("outlineColor") && !object.get("outlineColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("outlineColor")) : null); - textStyle.setShadowShader(object.has("shadowColor") && !object.get("shadowColor").isJsonNull()? TCAColor.INSTANCE.deserialize(object.get("shadowColor")) : null); + textStyle.setStrikeThroughShader(object.has("strikethroughColor") && !object.get("strikethroughColor").isJsonNull()? TCOptAColor.INSTANCE.deserialize(object.get("strikethroughColor")) : null); + textStyle.setUnderlineShader(object.has("underlineColor") && !object.get("underlineColor").isJsonNull()? TCOptAColor.INSTANCE.deserialize(object.get("underlineColor")) : null); + textStyle.setOutlineShader(object.has("outlineColor") && !object.get("outlineColor").isJsonNull()? TCOptAColor.INSTANCE.deserialize(object.get("outlineColor")) : null); + textStyle.setShadowShader(object.has("shadowColor") && !object.get("shadowColor").isJsonNull()? TCOptAColor.INSTANCE.deserialize(object.get("shadowColor")) : null); return textStyle; } @@ -64,10 +62,10 @@ public class TCRTextStyle implements FeatureTypeHandler<DefaultingDelegatingText jsonObject.addProperty("shadow", element.shadow); jsonObject.add("backgroundColor", element.backgroundShader == null ? null : TCAColor.INSTANCE.serialize(element.backgroundShader)); jsonObject.add("textColor", element.textShader == null ? null : TCAColor.INSTANCE.serialize(element.textShader)); - jsonObject.add("strikethroughColor", element.strikeThroughShader == null ? null : TCAColor.INSTANCE.serialize(element.strikeThroughShader)); - jsonObject.add("underlineColor", element.underlineShader == null ? null : TCAColor.INSTANCE.serialize(element.underlineShader)); - jsonObject.add("outlineColor", element.outlineShader == null ? null : TCAColor.INSTANCE.serialize(element.outlineShader)); - jsonObject.add("shadowColor", element.shadowShader == null ? null : TCAColor.INSTANCE.serialize(element.shadowShader)); + jsonObject.add("strikethroughColor", element.strikeThroughShader == null ? null : TCOptAColor.INSTANCE.serialize(element.strikeThroughShader)); + jsonObject.add("underlineColor", element.underlineShader == null ? null : TCOptAColor.INSTANCE.serialize(element.underlineShader)); + jsonObject.add("outlineColor", element.outlineShader == null ? null : TCOptAColor.INSTANCE.serialize(element.outlineShader)); + jsonObject.add("shadowColor", element.shadowShader == null ? null : TCOptAColor.INSTANCE.serialize(element.shadowShader)); return jsonObject; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyleMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyleMap.java index 9311ff2b..d12ab3f5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyleMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRTextStyleMap.java @@ -20,7 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; import java.util.HashMap; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorEditPopup.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorEditPopup.java index df921580..f351e2cf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorEditPopup.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorEditPopup.java @@ -58,7 +58,6 @@ public class ColorEditPopup extends AnnotatedImportOnlyWidget { color.addOnUpdate((old, neu) -> { try { - System.out.println(neu); AColor color1 = new AColor(Integer.parseUnsignedInt(neu.substring(1),16), true); color1.setChromaSpeed(aColorBindableAttribute.getValue().getChromaSpeed()); color1.setChroma(aColorBindableAttribute.getValue().isChroma()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java index 28650192..5e436518 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java @@ -109,7 +109,7 @@ public abstract class AbstractFeature implements IFeature { public void onParameterReset() {} - public boolean isDisyllable() { + public boolean isDisableable() { return true; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index 03cf914f..c48b8691 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -42,7 +42,7 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureVi import kr.syeyoung.dungeonsguide.mod.features.impl.secret.*; import kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse; import kr.syeyoung.dungeonsguide.mod.features.impl.solvers.*; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager; import lombok.Getter; import org.lwjgl.input.Keyboard; @@ -159,7 +159,7 @@ public class FeatureRegistry { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } }); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java index e9e4cd4c..905500fa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java @@ -20,12 +20,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -37,8 +36,8 @@ import java.util.List; public class FeatureDebugTrap extends TextHUDFeature { public FeatureDebugTrap() { super("Debug", "Display the current amount of bat entities", "", "advanced.bat"); - registerDefaultStyle("base", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("batsamm", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("base", DefaultingDelegatingTextStyle.derive("Feature Default - Base", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("batsamm", DefaultingDelegatingTextStyle.derive("Feature Default - Batsamm", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java index 13492c81..9c66a960 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java @@ -26,10 +26,10 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -41,7 +41,7 @@ public class FeatureRoomCoordDisplay extends TextHUDFeature { public FeatureRoomCoordDisplay() { super("Debug", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords"); this.setEnabled(false); - registerDefaultStyle("coord", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("coord", DefaultingDelegatingTextStyle.derive("Feature Default - Coord", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(Color.yellow.getRGB(),true))); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java index d02d863c..53fe52b6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java @@ -24,10 +24,10 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -40,7 +40,7 @@ public class FeatureRoomDebugInfo extends TextHUDFeature { public FeatureRoomDebugInfo() { super("Debug", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo"); this.setEnabled(false); - registerDefaultStyle("info", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("info", DefaultingDelegatingTextStyle.derive("Feature Default - Info", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(Color.white.getRGB(),true))); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java index 0d5e1f56..b28b0951 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java @@ -21,15 +21,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCBoolean; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.HealthData; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; @@ -43,11 +42,11 @@ public class FeatureBossHealth extends TextHUDFeature { addParameter("formatHealth", new FeatureParameter<Boolean>("formatHealth", "format health", "1234568 -> 1m", true, TCBoolean.INSTANCE, nval -> formatHealth = nval)); addParameter("ignoreInattackable", new FeatureParameter<Boolean>("ignoreInattackable", "Don't show health of in-attackable enemy", "For example, do not show guardians health when they're not attackable", false, TCBoolean.INSTANCE, nval -> ignoreInattackable = nval)); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("health", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); - registerDefaultStyle("maxHealth", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("health", DefaultingDelegatingTextStyle.derive("Feature Default - Health", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive("Feature Default - Separator2", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); + registerDefaultStyle("maxHealth", DefaultingDelegatingTextStyle.derive("Feature Default - MaxHealth", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java index cff44c8a..92544466 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java @@ -21,21 +21,20 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; public class FeatureCurrentPhase extends TextHUDFeature { public FeatureCurrentPhase() { super("Dungeon.Bossfight", "Display Current Phase", "Displays the current phase of bossfight", "bossfight.phasedisplay"); this.setEnabled(true); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("phase", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("phase", DefaultingDelegatingTextStyle.derive("Feature Default - Phase", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java index f2b95a98..2dc313a8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java @@ -21,13 +21,12 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorSadan; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.entity.boss.BossStatus; @@ -36,9 +35,9 @@ public class FeatureTerracotaTimer extends TextHUDFeature { public FeatureTerracotaTimer() { super("Dungeon.Bossfight.Floor 6", "Display Terracotta phase timer", "Displays Terracotta phase timer", "bossfight.terracota"); this.setEnabled(true); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("time", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("time", DefaultingDelegatingTextStyle.derive("Feature Default - Time", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java index 71a728ec..7edd6c1a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java @@ -21,23 +21,22 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; public class FeatureThornBearPercentage extends TextHUDFeature { public FeatureThornBearPercentage() { super("Dungeon.Bossfight.Floor 4", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear"); this.setEnabled(true); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("unit", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("unit", DefaultingDelegatingTextStyle.derive("Feature Default - Unit", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java index 92e568b2..bf9e99cc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java @@ -21,15 +21,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.TitleEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -37,9 +36,9 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; public class FeatureThornSpiritBowTimer extends TextHUDFeature { public FeatureThornSpiritBowTimer() { super("Dungeon.Bossfight.Floor 4", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay"); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("time", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("time", DefaultingDelegatingTextStyle.derive("Feature Default - Time", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java index bbf0129e..1d8af9dc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java @@ -40,7 +40,7 @@ public class FeatureNicknameColor extends SimpleFeature { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java index fde0a86b..52ef5396 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java @@ -43,7 +43,7 @@ public class FeatureNicknamePrefix extends SimpleFeature { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java index a0d796e9..2073ca3d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java @@ -50,7 +50,7 @@ public class PartyInviteViewer extends AbstractGuiFeature { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java index df1492f3..502707bf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java @@ -21,13 +21,12 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -35,11 +34,11 @@ public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature { public FeatureDungeonCurrentRoomSecrets() { super("Dungeon.HUDs", "Display # Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("currentSecrets", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); - registerDefaultStyle("totalSecrets", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("currentSecrets", DefaultingDelegatingTextStyle.derive("Feature Default - CurrentSecrets", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive("Feature Default - Separator2", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); + registerDefaultStyle("totalSecrets", DefaultingDelegatingTextStyle.derive("Feature Default - TotalSecrets", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java index 82eb48de..9adaf594 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java @@ -22,16 +22,15 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonDeathEvent; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabListEntry; @@ -50,11 +49,11 @@ public class FeatureDungeonDeaths extends TextHUDFeature { public FeatureDungeonDeaths() { super("Dungeon.HUDs", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths"); this.setEnabled(false); - registerDefaultStyle("username", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("total", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("deaths", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("totalDeaths", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("username", DefaultingDelegatingTextStyle.derive("Feature Default - Username", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("total", DefaultingDelegatingTextStyle.derive("Feature Default - Total", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("deaths", DefaultingDelegatingTextStyle.derive("Feature Default - Deaths", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("totalDeaths", DefaultingDelegatingTextStyle.derive("Feature Default - TotalDeaths", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java index 2137d57b..6845a281 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java @@ -22,15 +22,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabListEntry; @@ -47,9 +46,9 @@ public class FeatureDungeonMilestone extends TextHUDFeature { public FeatureDungeonMilestone() { super("Dungeon.HUDs", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java index d45f0276..2912a8c5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java @@ -19,15 +19,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; @@ -35,10 +34,10 @@ public class FeatureDungeonRealTime extends TextHUDFeature { public FeatureDungeonRealTime() { super("Dungeon.HUDs", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("discriminator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("discriminator", DefaultingDelegatingTextStyle.derive("Feature Default - Discriminator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } private long started = -1; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java index 8aec7ab0..0fc877a7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java @@ -21,14 +21,13 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -38,8 +37,8 @@ import java.awt.*; public class FeatureDungeonRoomName extends TextHUDFeature { public FeatureDungeonRoomName() { super("Dungeon.HUDs", "Display name of the room you are in", "Display name of the room you are in", "dungeon.roomname"); - registerDefaultStyle("in", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("roomname", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("in", DefaultingDelegatingTextStyle.derive("Feature Default - In", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("roomname", DefaultingDelegatingTextStyle.derive("Feature Default - Roomname", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java index 7265b20d..9445549e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java @@ -20,12 +20,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; @@ -43,10 +42,10 @@ public class FeatureDungeonSBTime extends TextHUDFeature { public FeatureDungeonSBTime() { super("Dungeon.HUDs", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("discriminator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("discriminator", DefaultingDelegatingTextStyle.derive("Feature Default - Discriminator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } public int getTimeElapsed() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java index cd37a1a6..8fcd15c3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java @@ -28,10 +28,10 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.map.DungeonRoomScaffoldParser; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabListEntry; @@ -52,17 +52,17 @@ public class FeatureDungeonScore extends TextHUDFeature { this.setEnabled(false); addParameter("verbose", new FeatureParameter<Boolean>("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, TCBoolean.INSTANCE)); - registerDefaultStyle("scorename", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("score", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("brackets", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.BRACKET))); - registerDefaultStyle("etc", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); - registerDefaultStyle("currentScore", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("scorename", DefaultingDelegatingTextStyle.derive("Feature Default - Scorename", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("score", DefaultingDelegatingTextStyle.derive("Feature Default - Score", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("brackets", DefaultingDelegatingTextStyle.derive("Feature Default - Brackets", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.BRACKET))); + registerDefaultStyle("etc", DefaultingDelegatingTextStyle.derive("Feature Default - Etc", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("currentScore", DefaultingDelegatingTextStyle.derive("Feature Default - CurrentScore", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0xFF, 0xAA,0x00,255)).setBackgroundShader(new AColor(0, 0,0,0))); - registerDefaultStyle("arrow", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); - registerDefaultStyle("nextScore", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("arrow", DefaultingDelegatingTextStyle.derive("Feature Default - Arrow", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("nextScore", DefaultingDelegatingTextStyle.derive("Feature Default - NextScore", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0xFF, 0xAA,0x00,255)).setBackgroundShader(new AColor(0, 0,0,0))); - registerDefaultStyle("required", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("required", DefaultingDelegatingTextStyle.derive("Feature Default - Required", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java index 93622f2f..e0efd82c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java @@ -25,10 +25,10 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabListEntry; @@ -38,12 +38,12 @@ public class FeatureDungeonSecrets extends TextHUDFeature { public FeatureDungeonSecrets() { super("Dungeon.HUDs", "Display Total # of Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("currentSecrets", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); - registerDefaultStyle("totalSecrets", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); - registerDefaultStyle("unknown", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("currentSecrets", DefaultingDelegatingTextStyle.derive("Feature Default - CurrentSecrets", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("separator2", DefaultingDelegatingTextStyle.derive("Feature Default - Separator2", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.FRACTION))); + registerDefaultStyle("totalSecrets", DefaultingDelegatingTextStyle.derive("Feature Default - TotalSecrets", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.TOTAL))); + registerDefaultStyle("unknown", DefaultingDelegatingTextStyle.derive("Feature Default - Unknown", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0xFF, 0xFF,0x55,255))); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java index 148f8347..f63124d4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java @@ -21,12 +21,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabListEntry; @@ -36,9 +35,9 @@ public class FeatureDungeonTombs extends TextHUDFeature { public FeatureDungeonTombs() { super("Dungeon.HUDs", "Display # of Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs"); this.setEnabled(false); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java index 3e6d17d8..a39a641d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java @@ -25,10 +25,10 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCInteger; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.scoreboard.Objective; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.scoreboard.Score; @@ -40,9 +40,9 @@ public class FeatureWarnLowHealth extends TextHUDFeature { public FeatureWarnLowHealth() { super("Dungeon.Teammates", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn"); addParameter("threshold", new FeatureParameter<Integer>("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, TCInteger.INSTANCE)); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0xFF, 0x55,0x55,255))); setEnabled(false); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java index 8371c751..7dad610b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java @@ -21,15 +21,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -39,7 +38,7 @@ public class FeatureWatcherWarning extends TextHUDFeature { public FeatureWatcherWarning() { super("Dungeon.Blood Room","Watcher Spawn Alert", "Alert when watcher says 'That will be enough for now'", "dungen.watcherwarn"); - registerDefaultStyle("warning", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); + registerDefaultStyle("warning", DefaultingDelegatingTextStyle.derive("Feature Default - Warning", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); setEnabled(false); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java index c29cf57f..526c618a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java @@ -19,14 +19,13 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.inventory.ContainerChest; @@ -35,9 +34,9 @@ import net.minecraftforge.client.event.GuiOpenEvent; public class FeatureCooldownCounter extends TextHUDFeature { public FeatureCooldownCounter() { super("Dungeon", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown"); - registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("title", DefaultingDelegatingTextStyle.derive("Feature Default - Title", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); } private long leftDungeonTime = 0L; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java index ef5151c3..b49e8da7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java @@ -20,17 +20,16 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCBoolean; import kr.syeyoung.dungeonsguide.mod.config.types.TCInteger; 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.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; @@ -48,11 +47,11 @@ public class FeatureAbilityCooldown extends TextHUDFeature { public FeatureAbilityCooldown() { super("Misc", "View Ability Cooldowns", "A handy hud for viewing cooldown abilities", "etc.abilitycd2"); - registerDefaultStyle("abilityname", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("unit",DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("ready",DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); // kinda warning + registerDefaultStyle("abilityname", DefaultingDelegatingTextStyle.derive("Feature Default - Abilityname", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("unit",DefaultingDelegatingTextStyle.derive("Feature Default", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("ready",DefaultingDelegatingTextStyle.derive("Feature Default", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); // kinda warning addParameter("disable", new FeatureParameter<Boolean>("disable", "Disable outside of dungeon", "Disable the feature when out of dungeon", false, TCBoolean.INSTANCE)); addParameter("decimal", new FeatureParameter<Integer>("decimal", "Decimal places", "ex) 2 -> Cooldown: 3.21 3-> Cooldown: 3.210", 0, TCInteger.INSTANCE)); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java index 9fec17be..6101bae3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java @@ -52,7 +52,7 @@ public class APIKey extends SimpleFeature { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java index f888828b..f83de2eb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java @@ -19,12 +19,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.party.PartyContext; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; @@ -32,10 +31,10 @@ import kr.syeyoung.dungeonsguide.mod.party.PartyManager; public class FeaturePartyList extends TextHUDFeature { public FeaturePartyList() { super("Party","Party List", "Party List as GUI", "party.list"); - registerDefaultStyle("name", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("player", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("allinvite", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("name", DefaultingDelegatingTextStyle.derive("Feature Default - Name", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("player", DefaultingDelegatingTextStyle.derive("Feature Default - Player", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("allinvite", DefaultingDelegatingTextStyle.derive("Feature Default - Allinvite", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); setEnabled(false); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java index 3294fe84..37d41254 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java @@ -24,10 +24,10 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.party.PartyContext; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; @@ -39,13 +39,13 @@ import java.util.*; public class FeaturePartyReady extends TextHUDFeature { public FeaturePartyReady() { super("Party","Party Ready List", "Check if your party member have said r or not", "party.readylist"); - registerDefaultStyle("player", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("ready", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("player", DefaultingDelegatingTextStyle.derive("Feature Default - Player", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("ready", DefaultingDelegatingTextStyle.derive("Feature Default - Ready", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0x55, 0xFF,0xFF,255))); - registerDefaultStyle("notready", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("notready", DefaultingDelegatingTextStyle.derive("Feature Default - Notready", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0xFF, 0x55,0x55,255))); - registerDefaultStyle("terminal", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("terminal", DefaultingDelegatingTextStyle.derive("Feature Default - Terminal", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); setEnabled(true); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java index 8cd2ca55..07c4d775 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java @@ -28,10 +28,10 @@ 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.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.NullTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.NullTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -42,17 +42,17 @@ public class FeatureActions extends TextHUDFeature { public FeatureActions() { super("Dungeon.Secrets", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview"); - registerDefaultStyle("pathfinding", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("mechanic", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) + registerDefaultStyle("pathfinding", DefaultingDelegatingTextStyle.derive("Feature Default - Pathfinding", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("mechanic", DefaultingDelegatingTextStyle.derive("Feature Default - Mechanic", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.DEFAULT)) .setTextShader(new AColor(0x55, 0xFF,0x55,255))); - registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("state", DefaultingDelegatingTextStyle.derive(() -> getStyle("mechanic")) + registerDefaultStyle("separator", DefaultingDelegatingTextStyle.derive("Feature Default - Separator", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("state", DefaultingDelegatingTextStyle.derive("Feature Default - State", () -> getStyle("mechanic")) .setTextShader(new AColor(0x55, 0xFF,0x55,255))); - registerDefaultStyle("current", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); - registerDefaultStyle("dot", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); - registerDefaultStyle("action", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); - registerDefaultStyle("afterline", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); + registerDefaultStyle("current", DefaultingDelegatingTextStyle.derive("Feature Default - Current", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("number", DefaultingDelegatingTextStyle.derive("Feature Default - Number", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.NAME))); + registerDefaultStyle("dot", DefaultingDelegatingTextStyle.derive("Feature Default - Dot", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.SEPARATOR))); + registerDefaultStyle("action", DefaultingDelegatingTextStyle.derive("Feature Default - Action", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.VALUE))); + registerDefaultStyle("afterline", DefaultingDelegatingTextStyle.derive("Feature Default - Afterline", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.EXTRA_INFO))); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java index f1d23150..64e8cbc7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java @@ -33,7 +33,7 @@ public class FeaturePathfindStrategy extends SimpleFeature { } @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java index ad5c6b91..3e49d4f6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java @@ -23,7 +23,6 @@ import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCStringList; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; @@ -33,9 +32,9 @@ 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.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultTextHUDFeatureStyleFeature; -import kr.syeyoung.dungeonsguide.mod.features.text.DefaultingDelegatingTextStyle; -import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultTextHUDFeatureStyleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.features.richtext.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; @@ -55,7 +54,7 @@ public class FeatureSoulRoomWarning extends TextHUDFeature { public FeatureSoulRoomWarning() { super("Dungeon.HUDs","Secret Soul Alert", "Alert if there is an fairy soul in the room", "secret.fairysoulwarn"); - registerDefaultStyle("warning", DefaultingDelegatingTextStyle.derive(() -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); + registerDefaultStyle("warning", DefaultingDelegatingTextStyle.derive("Feature Default - Warning", () -> FeatureRegistry.DEFAULT_STYLE.getStyle(DefaultTextHUDFeatureStyleFeature.Styles.WARNING))); addParameter("roomuids", new FeatureParameter<>("roomuids", "Disabled room Names", "Disable for these rooms", new ArrayList<>(), TCStringList.INSTANCE) .setWidgetGenerator(RoomConfiguration::new)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java index 7afe42a3..e3bbe100 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java @@ -46,7 +46,7 @@ public class PathfindLineProperties extends SimpleFeature { @Override - public boolean isDisyllable() { + public boolean isDisableable() { return false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultTextHUDFeatureStyleFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/DefaultTextHUDFeatureStyleFeature.java index 23b31cc9..87ebef35 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultTextHUDFeatureStyleFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/DefaultTextHUDFeatureStyleFeature.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.text; +package kr.syeyoung.dungeonsguide.mod.features.richtext; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.config.types.TCRTextStyleMap; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.richtext.config.WidgetTextStyleConfig; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; import java.util.HashMap; import java.util.HashSet; @@ -36,17 +38,34 @@ public class DefaultTextHUDFeatureStyleFeature extends SimpleFeature { public DefaultTextHUDFeatureStyleFeature() { super("Misc", "Quick HUD Style Settings", "Configure the default hud style", "misc.defaulthud"); - registerDefaultStyle(Styles.DEFAULT, DefaultingDelegatingTextStyle.ofDefault()); - registerDefaultStyle(Styles.NAME, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x00, 0xAA,0xAA,255))); - registerDefaultStyle(Styles.VALUE, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0xFF,0xFF,255))); - registerDefaultStyle(Styles.SEPARATOR, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0x55,0x55,255))); - registerDefaultStyle(Styles.EXTRA_INFO, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0xAA,0xAA,0xAA,255))); - registerDefaultStyle(Styles.BRACKET, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0x55,0x55,255))); - registerDefaultStyle(Styles.WARNING, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0xFF, 0x69,0x17,255))); + registerDefaultStyle(Styles.DEFAULT, DefaultingDelegatingTextStyle.ofDefault("Global Text")); + registerDefaultStyle(Styles.NAME, DefaultingDelegatingTextStyle.derive("Global Default - Name", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x00, 0xAA,0xAA,255))); + registerDefaultStyle(Styles.VALUE, DefaultingDelegatingTextStyle.derive("Global Default - Value", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0xFF,0xFF,255))); + registerDefaultStyle(Styles.SEPARATOR, DefaultingDelegatingTextStyle.derive("Global Default - Separator", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0x55,0x55,255))); + registerDefaultStyle(Styles.EXTRA_INFO, DefaultingDelegatingTextStyle.derive("Global Default - Extra Info", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0xAA,0xAA,0xAA,255))); + registerDefaultStyle(Styles.BRACKET, DefaultingDelegatingTextStyle.derive("Global Default - Bracket", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0x55, 0x55,0x55,255))); + registerDefaultStyle(Styles.WARNING, DefaultingDelegatingTextStyle.derive("Global Default - Warning", () -> getStyle(Styles.DEFAULT)).setTextShader(new AColor(0xFF, 0x69,0x17,255))); - registerDefaultStyle(Styles.FRACTION, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.SEPARATOR))); - registerDefaultStyle(Styles.TOTAL, DefaultingDelegatingTextStyle.derive(() -> getStyle(Styles.VALUE))); - addParameter("newstyle", new FeatureParameter<>("newstyle", "TextStyle", "", styleMap, new TCRTextStyleMap(), this::updateStyle)); + registerDefaultStyle(Styles.FRACTION, DefaultingDelegatingTextStyle.derive("Global Default - Fraction", () -> getStyle(Styles.SEPARATOR))); + registerDefaultStyle(Styles.TOTAL, DefaultingDelegatingTextStyle.derive("Global Default - Total", () -> getStyle(Styles.VALUE))); + addParameter("newstyle", new FeatureParameter<>("newstyle", "TextStyle", "", styleMap, new TCRTextStyleMap(), this::updateStyle) + .setWidgetGenerator((param) -> new WidgetTextStyleConfig(getDummyText(), styleMap))); + } + + public TextSpan getDummyText() { + TextSpan rootSpan = new TextSpan(new NullTextStyle(), ""); + rootSpan.addChild(new TextSpan(getStyle(Styles.DEFAULT), "Default\n")); + rootSpan.addChild(new TextSpan(getStyle(Styles.NAME), "Name")); + rootSpan.addChild(new TextSpan(getStyle(Styles.SEPARATOR), ": ")); + rootSpan.addChild(new TextSpan(getStyle(Styles.VALUE), "Value")); + rootSpan.addChild(new TextSpan(getStyle(Styles.FRACTION), "/")); + rootSpan.addChild(new TextSpan(getStyle(Styles.TOTAL), "Total ")); + rootSpan.addChild(new TextSpan(getStyle(Styles.BRACKET), "(")); + rootSpan.addChild(new TextSpan(getStyle(Styles.EXTRA_INFO), "Misc Info")); + rootSpan.addChild(new TextSpan(getStyle(Styles.BRACKET), ")\n")); + rootSpan.addChild(new TextSpan(getStyle(Styles.EXTRA_INFO), "Additional Data\n")); + rootSpan.addChild(new TextSpan(getStyle(Styles.WARNING), "WARNING!!")); + return rootSpan; } public DefaultingDelegatingTextStyle getStyle(Styles styles) { @@ -67,11 +86,12 @@ public class DefaultTextHUDFeatureStyleFeature extends SimpleFeature { for (Map.Entry<String, DefaultingDelegatingTextStyle> stringDefaultingDelegatingTextStyleEntry : map.entrySet()) { if (!defaultStyleMap.containsKey(stringDefaultingDelegatingTextStyleEntry.getKey())) continue; DefaultingDelegatingTextStyle newStyle = stringDefaultingDelegatingTextStyleEntry.getValue(); + newStyle.setName("User Setting of "+defaultStyleMap.get(stringDefaultingDelegatingTextStyleEntry.getKey()).name); newStyle.setParent(() -> defaultStyleMap.get(stringDefaultingDelegatingTextStyleEntry.getKey())); styleMap.put(stringDefaultingDelegatingTextStyleEntry.getKey(), newStyle); } for (String s : needsToBeIn) { - styleMap.put(s, new DefaultingDelegatingTextStyle().setParent(() -> defaultStyleMap.get(s))); + styleMap.put(s, DefaultingDelegatingTextStyle.derive("User Setting of "+defaultStyleMap.get(s).name, () -> defaultStyleMap.get(s))); map.put(s, styleMap.get(s)); } } 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/richtext/DefaultingDelegatingTextStyle.java index 8aab3304..ff6cf834 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/DefaultingDelegatingTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/DefaultingDelegatingTextStyle.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.text; +package kr.syeyoung.dungeonsguide.mod.features.richtext; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.DefaultFontRenderer; @@ -24,13 +24,17 @@ 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.styles.ITextStyle; import lombok.Getter; +import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.experimental.Accessors; +import java.util.Optional; import java.util.function.Supplier; -@Setter @Accessors(chain = true) +@Setter @Accessors(chain = true) @RequiredArgsConstructor public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { + public String name; + public Double size; public Double topAscent; public Double bottomAscent; @@ -43,27 +47,31 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { public Boolean underline; public Boolean outline; public Boolean shadow; - + public Boolean background; public AColor backgroundShader; public AColor textShader; - public AColor strikeThroughShader; - public AColor underlineShader; - public AColor outlineShader; - public AColor shadowShader; + // field null: use parent + // optional null: default color derived from text + public Optional<AColor> strikeThroughShader; + public Optional<AColor> underlineShader; + public Optional<AColor> outlineShader; + public Optional<AColor> shadowShader; @Getter @Setter - public Supplier<DefaultingDelegatingTextStyle> parent; + public Supplier<ITextStyle> parent; public FontRenderer fontRenderer; - public static DefaultingDelegatingTextStyle derive(Supplier<DefaultingDelegatingTextStyle> parent) { + public static DefaultingDelegatingTextStyle derive(String name, Supplier<ITextStyle> parent) { DefaultingDelegatingTextStyle defaultTextHUDFeatureStyleFeature = new DefaultingDelegatingTextStyle(); + defaultTextHUDFeatureStyleFeature.setName(name); defaultTextHUDFeatureStyleFeature.setParent(parent); return defaultTextHUDFeatureStyleFeature; } - public static DefaultingDelegatingTextStyle ofDefault() { + public static DefaultingDelegatingTextStyle ofDefault(String name) { DefaultingDelegatingTextStyle parentDelegatingTextStyle = new DefaultingDelegatingTextStyle(); + parentDelegatingTextStyle.setName(name); parentDelegatingTextStyle.size = 8.0; parentDelegatingTextStyle.topAscent = 0.0; parentDelegatingTextStyle.bottomAscent = 1 / 8.0; @@ -73,19 +81,20 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { parentDelegatingTextStyle.underline = false; parentDelegatingTextStyle.shadow = false; parentDelegatingTextStyle.outline = false; + parentDelegatingTextStyle.background = false; - parentDelegatingTextStyle.backgroundShader = null; + parentDelegatingTextStyle.backgroundShader = new AColor(0XFF000000, true); parentDelegatingTextStyle.textShader = new AColor(0xFFFFFFFF, true); - parentDelegatingTextStyle.strikeThroughShader = new AColor(0xFF000000, true); - parentDelegatingTextStyle.underlineShader = new AColor(0xFF000000, true); - parentDelegatingTextStyle.outlineShader = new AColor(0xFF000000, true); - parentDelegatingTextStyle.shadowShader = new AColor(0xFF000000, true); + parentDelegatingTextStyle.strikeThroughShader = Optional.empty(); + parentDelegatingTextStyle.underlineShader = Optional.empty(); + parentDelegatingTextStyle.outlineShader = Optional.empty(); + parentDelegatingTextStyle.shadowShader = Optional.empty(); parentDelegatingTextStyle.fontRenderer = DefaultFontRenderer.DEFAULT_RENDERER; return parentDelegatingTextStyle; } - public DefaultingDelegatingTextStyle getParent() { + public ITextStyle getParent() { return parent.get(); } @@ -105,6 +114,11 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { } @Override + public Boolean hasBackground() { + return parent != null && background == null ? getParent().hasBackground() : background; + } + + @Override public Boolean isBold() { return parent != null && bold == null ? getParent().isBold() : bold; } @@ -141,7 +155,16 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { @Override public Shader getShadowShader() { - return parent != null && shadowShader == null ? getParent().getShadowShader() : shadowShader == null ? null : shadowShader.getShader(); + Optional<AColor> color; + if (shadowShader != null) color = shadowShader; + else if (parent != null && parent.get() instanceof DefaultingDelegatingTextStyle) color = ((DefaultingDelegatingTextStyle) parent.get()).getShadowShaderColor(); + else return parent.get().getShadowShader(); + if (color.isPresent()) return color.get().getShader(); + AColor textShader = getTextShaderColor(); + AColor aColor = new AColor(textShader.getRed()/4, textShader.getGreen()/4, textShader.getBlue()/4, textShader.getAlpha()); + aColor.setChroma(textShader.isChroma()); + aColor.setChromaSpeed(textShader.getChromaSpeed()); + return aColor.getShader(); } @Override @@ -151,12 +174,22 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { @Override public Shader getOutlineShader() { - return parent != null && outlineShader == null ? getParent().getOutlineShader() : outlineShader == null ? null : outlineShader.getShader(); + Optional<AColor> color; + if (outlineShader != null) color = outlineShader; + else if (parent != null && parent.get() instanceof DefaultingDelegatingTextStyle) color = ((DefaultingDelegatingTextStyle) parent.get()).getOutlineShaderColor(); + else return parent.get().getOutlineShader(); + if (color.isPresent()) return color.get().getShader(); + return getTextShaderColor().getShader(); } @Override public Shader getStrikeThroughShader() { - return parent != null && strikeThroughShader == null ? getParent().getStrikeThroughShader() : strikeThroughShader == null ? null : strikeThroughShader.getShader(); + Optional<AColor> color; + if (strikeThroughShader != null) color = strikeThroughShader; + else if (parent != null && parent.get() instanceof DefaultingDelegatingTextStyle) color = ((DefaultingDelegatingTextStyle) parent.get()).getStrikeThroughShaderColor(); + else return parent.get().getStrikeThroughShader(); + if (color.isPresent()) return color.get().getShader(); + return getTextShaderColor().getShader(); } @Override @@ -166,7 +199,37 @@ public class DefaultingDelegatingTextStyle implements ITextStyle, Cloneable { @Override public Shader getUnderlineShader() { - return parent != null && underlineShader == null ? getParent().getUnderlineShader() : underlineShader == null ? null : underlineShader.getShader(); + Optional<AColor> color; + if (underlineShader != null) color = underlineShader; + else if (parent != null && parent.get() instanceof DefaultingDelegatingTextStyle) color = ((DefaultingDelegatingTextStyle) parent.get()).getUnderlineShaderColor(); + else return parent.get().getUnderlineShader(); + if (color.isPresent()) return color.get().getShader(); + return getTextShaderColor().getShader(); + } + + + public Optional<AColor> getShadowShaderColor() { + return parent != null && shadowShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getShadowShaderColor() : shadowShader; + } + + public AColor getBackgroundShaderColor() { + return parent != null && backgroundShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getBackgroundShaderColor() : backgroundShader; + } + + public Optional<AColor> getOutlineShaderColor() { + return parent != null && outlineShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getOutlineShaderColor() : outlineShader; + } + + public Optional<AColor> getStrikeThroughShaderColor() { + return parent != null && strikeThroughShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getStrikeThroughShaderColor() : strikeThroughShader; + } + + public AColor getTextShaderColor() { + return parent != null && textShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getTextShaderColor() : textShader; + } + + public Optional<AColor> getUnderlineShaderColor() { + return parent != null && underlineShader == null && getParent() instanceof DefaultingDelegatingTextStyle ? ((DefaultingDelegatingTextStyle) getParent()).getUnderlineShaderColor() : underlineShader; } public DefaultingDelegatingTextStyle clone() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/NullTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/NullTextStyle.java index 06869ecd..ac06d51f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/NullTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/NullTextStyle.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.text; +package kr.syeyoung.dungeonsguide.mod.features.richtext; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.DefaultFontRenderer; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.FontRenderer; @@ -34,6 +34,11 @@ public class NullTextStyle implements ITextStyle, Cloneable { } @Override + public Boolean hasBackground() { + return false; + } + + @Override public Double getTopAscent() { return 0.0; } @@ -85,22 +90,22 @@ public class NullTextStyle implements ITextStyle, Cloneable { @Override public Shader getStrikeThroughShader() { - return null; + return new SingleColorShader(0); } @Override public Shader getUnderlineShader() { - return null; + return new SingleColorShader(0); } @Override public Shader getOutlineShader() { - return null; + return new SingleColorShader(0); } @Override public Shader getShadowShader() { - return null; + return new SingleColorShader(0); } @Override 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/richtext/TextHUDFeature.java index aacb770b..40a990cf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/TextHUDFeature.java @@ -1,6 +1,6 @@ /* * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * 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 @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.text; +package kr.syeyoung.dungeonsguide.mod.features.richtext; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.MarkerProvider; import kr.syeyoung.dungeonsguide.mod.config.types.TCEnum; @@ -25,6 +25,7 @@ import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.richtext.config.WidgetTextStyleConfig; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.BreakWord; @@ -47,7 +48,8 @@ public abstract class TextHUDFeature extends AbstractHUDFeature { super(category, name, description, key); addParameter("alignment", new FeatureParameter<>("alignment", "Alignment", "Alignment", RichText.TextAlign.LEFT, new TCEnum<>(RichText.TextAlign.values()), richText::setAlign)); - addParameter("newstyle", new FeatureParameter<>("newstyle", "TextStyle", "", styleMap, new TCRTextStyleMap(), this::updateStyle)); + addParameter("newstyle", new FeatureParameter<>("newstyle", "TextStyle", "", styleMap, new TCRTextStyleMap(), this::updateStyle) + .setWidgetGenerator((param) -> new WidgetTextStyleConfig(getDummyText(), styleMap))); } @Override @@ -153,11 +155,12 @@ public abstract class TextHUDFeature extends AbstractHUDFeature { for (Map.Entry<String, DefaultingDelegatingTextStyle> stringDefaultingDelegatingTextStyleEntry : map.entrySet()) { if (!defaultStyleMap.containsKey(stringDefaultingDelegatingTextStyleEntry.getKey())) continue; DefaultingDelegatingTextStyle newStyle = stringDefaultingDelegatingTextStyleEntry.getValue(); + newStyle.setName("User Setting of "+defaultStyleMap.get(stringDefaultingDelegatingTextStyleEntry.getKey()).name); newStyle.setParent(() -> defaultStyleMap.get(stringDefaultingDelegatingTextStyleEntry.getKey())); styleMap.put(stringDefaultingDelegatingTextStyleEntry.getKey(), newStyle); } for (String s : needsToBeIn) { - styleMap.put(s, new DefaultingDelegatingTextStyle().setParent(() -> defaultStyleMap.get(s))); + styleMap.put(s, DefaultingDelegatingTextStyle.derive("User Setting of "+defaultStyleMap.get(s).name, () -> defaultStyleMap.get(s))); map.put(s, styleMap.get(s)); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstCheckmark.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstCheckmark.java new file mode 100644 index 00000000..1fc6917f --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstCheckmark.java @@ -0,0 +1,41 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; + +public class WidgetConstCheckmark extends AnnotatedImportOnlyWidget { + @Bind(variableName = "enabled") + public final BindableAttribute<String> enabled = new BindableAttribute<>(String.class); + public WidgetConstCheckmark(boolean bool) { + super(new ResourceLocation("dungeonsguide:gui/config/text/constCheckmark.gui")); + this.enabled.setValue(bool ? "show" : "hide"); + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstColor.java new file mode 100644 index 00000000..2d2d2d5e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstColor.java @@ -0,0 +1,79 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +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.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; + +import java.util.Optional; + +public class WidgetConstColor extends AnnotatedImportOnlyWidget implements Renderer { + @Bind(variableName = "color") + public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class); + @Bind(variableName = "null") + public final BindableAttribute<String> isEmpty = new BindableAttribute<>(String.class, "hide"); + private AColor realColor; + + public WidgetConstColor(boolean show, AColor derivedColor) { + super(new ResourceLocation("dungeonsguide:gui/config/text/constColor.gui")); + isEmpty.setValue(show ? "show" : "hide"); + this.realColor = derivedColor; + } + + + @Override + public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) { + + int color = RenderUtils.getColorAt(getDomElement().getAbsBounds().getX(), getDomElement().getAbsBounds().getY(), realColor); + this.color.setValue(color); + + if (buildContext.getChildren().isEmpty()) return; + DomElement value = buildContext.getChildren().get(0); + + Rect original = value.getRelativeBound(); + if (original == null) return; + GlStateManager.translate(original.getX(), original.getY(), 0); + + double absXScale = buildContext.getAbsBounds().getWidth() / buildContext.getSize().getWidth(); + double absYScale = buildContext.getAbsBounds().getHeight() / buildContext.getSize().getHeight(); + + Rect elementABSBound = new Rect( + (buildContext.getAbsBounds().getX() + original.getX() * absXScale), + (buildContext.getAbsBounds().getY() + original.getY() * absYScale), + (original.getWidth() * absXScale), + (original.getHeight() * absYScale) + ); + value.setAbsBounds(elementABSBound); + + value.getRenderer().doRender(absMouseX, absMouseY, + relMouseX - original.getX(), + relMouseY - original.getY(), partialTicks, context, value); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLine.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLine.java new file mode 100644 index 00000000..53b127d1 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLine.java @@ -0,0 +1,114 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MinecraftTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MouseTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import scala.actors.threadpool.Arrays; + +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +public class WidgetConstStyleGroupStyleLine extends AnnotatedImportOnlyWidget { + @Bind(variableName = "erase") + public final BindableAttribute<String> erase = new BindableAttribute<>(String.class, "hide"); + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class, ""); + @Bind(variableName = "value") + public final BindableAttribute<Widget> value = new BindableAttribute<>(Widget.class); + + private List<String> hover; + private Supplier<Boolean> eraseEvaluator; + public WidgetConstStyleGroupStyleLine(String name, Supplier<Boolean> erase, Object value, String eraseReason) { + super(new ResourceLocation("dungeonsguide:gui/config/text/styleline.gui")); + this.name.setValue(name); + this.eraseEvaluator = erase; + refresh(); + + if (erase.get()) + hover = Arrays.asList(eraseReason.split("\n")); + + if (value instanceof AColor) { + this.value.setValue(new WidgetConstColor(true, (AColor) value)); + } else if (value instanceof Number) { + this.value.setValue(new Text(value.toString(), 0xFFAAAAAA, Text.TextAlign.LEFT, Text.WordBreak.WORD, 1.0, 8.0)); + } else if (value instanceof Boolean) { + this.value.setValue(new WidgetConstCheckmark((Boolean) value)); + } + } + + public void refresh() { + this.erase.setValue(eraseEvaluator.get() ? "show" : "hide"); + } + + private MinecraftTooltip actualTooltip = new MinecraftTooltip(); + private MouseTooltip tooltip = null; + @Override + public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (hover == null) return false; + getDomElement().setCursor(EnumCursor.NOT_ALLOWED); + List<String> toHover = hover; + + if (toHover != null) + actualTooltip.setTooltip(toHover); + + if (toHover == null && this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip); + this.tooltip = null; + } else if (toHover != null && this.tooltip == null) + PopupMgr.getPopupMgr(getDomElement()) + .openPopup(this.tooltip = new MouseTooltip(actualTooltip), (a) -> { + this.tooltip = null; + }); + return false; + } + + @Override + public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + } + + @Override + public void onUnmount() { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + super.onUnmount(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLineDerivedColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLineDerivedColor.java new file mode 100644 index 00000000..f583b24b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetConstStyleGroupStyleLineDerivedColor.java @@ -0,0 +1,104 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MinecraftTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MouseTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; +import net.minecraft.util.ResourceLocation; +import scala.actors.threadpool.Arrays; + +import java.util.List; +import java.util.function.Supplier; + +public class WidgetConstStyleGroupStyleLineDerivedColor extends AnnotatedImportOnlyWidget { + @Bind(variableName = "erase") + public final BindableAttribute<String> erase = new BindableAttribute<>(String.class, "hide"); + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class, ""); + @Bind(variableName = "value") + public final BindableAttribute<Widget> value = new BindableAttribute<>(Widget.class); + + private List<String> hover; + private Supplier<Boolean> eraseEvaluator; + public WidgetConstStyleGroupStyleLineDerivedColor(String name, Supplier<Boolean> erase, boolean isPresent, AColor derivedColor, String eraseReason) { + super(new ResourceLocation("dungeonsguide:gui/config/text/styleline.gui")); + this.name.setValue(name); + this.eraseEvaluator = erase; + refresh(); + + if (erase.get()) + hover = Arrays.asList(eraseReason.split("\n")); + + this.value.setValue(new WidgetConstColor(isPresent, derivedColor)); + } + + public void refresh() { + this.erase.setValue(eraseEvaluator.get() ? "show" : "hide"); + } + + private MinecraftTooltip actualTooltip = new MinecraftTooltip(); + private MouseTooltip tooltip = null; + @Override + public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (hover == null) return false; + getDomElement().setCursor(EnumCursor.NOT_ALLOWED); + List<String> toHover = hover; + + if (toHover != null) + actualTooltip.setTooltip(toHover); + + if (toHover == null && this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip); + this.tooltip = null; + } else if (toHover != null && this.tooltip == null) + PopupMgr.getPopupMgr(getDomElement()) + .openPopup(this.tooltip = new MouseTooltip(actualTooltip), (a) -> { + this.tooltip = null; + }); + return false; + } + + @Override + public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + } + + @Override + public void onUnmount() { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + super.onUnmount(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLine.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLine.java new file mode 100644 index 00000000..5fa8e578 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLine.java @@ -0,0 +1,276 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.config.types.coloredit.ColorEditPopup; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +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.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.AbsLocationPopup; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MinecraftTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MouseTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; +import scala.actors.threadpool.Arrays; + +import java.util.List; +import java.util.Optional; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class WidgetEditableStyleGroupStyleLine extends AnnotatedImportOnlyWidget { + @Bind(variableName = "enabled") + public final BindableAttribute<Boolean> enabled = new BindableAttribute<>(Boolean.class); + @Bind(variableName = "enabled2") + public final BindableAttribute<String> enabled2 = new BindableAttribute<>(String.class); + + + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class, ""); + @Bind(variableName = "value") + public final BindableAttribute<Widget> value = new BindableAttribute<>(Widget.class); + @Bind(variableName = "actualEdit") + public final BindableAttribute<Widget> actualEdit = new BindableAttribute<>(Widget.class); + + @Bind(variableName = "disableable") + public final BindableAttribute<String> disableable = new BindableAttribute<>(String.class); + + public WidgetEditableStyleGroupStyleLine(boolean disableable, String name, boolean isEnabled, Supplier<Object> defaultValueSup, Consumer<Object> setter) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableStyleline.gui")); + + this.disableable.setValue(disableable ? "show" : "hide"); + + enabled.addOnUpdate((old, neu) -> { + enabled2.setValue(neu ? "enable" : "disable"); + if (old == Boolean.FALSE && neu) { + Object defaultValue = defaultValueSup.get(); + setter.accept(defaultValue); + if (defaultValue instanceof AColor) { + BindableAttribute<AColor> bindableAttribute = new BindableAttribute<>(AColor.class,(AColor) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new ColorEditWidget(bindableAttribute)); + } else if (defaultValue instanceof Double) { + BindableAttribute<Double> bindableAttribute = new BindableAttribute<>(Double.class, (Double) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new DoubleEditWidget(bindableAttribute, 4, Double.POSITIVE_INFINITY)); + } else if (defaultValue instanceof Boolean) { + BindableAttribute<Boolean> bindableAttribute = new BindableAttribute<>(Boolean.class, (Boolean) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new BooleanEditWidget(bindableAttribute)); + } + } else if (old == Boolean.TRUE && !neu){ + setter.accept(null); + + Object defaultValue = defaultValueSup.get(); + if (defaultValue instanceof AColor) { + this.value.setValue(new WidgetConstColor(true, (AColor) defaultValue)); + } else if (defaultValue instanceof Double) { + this.value.setValue(new Text(defaultValue.toString(), 0xFFAAAAAA, Text.TextAlign.LEFT, Text.WordBreak.WORD, 1.0, 8.0)); + } else if (defaultValue instanceof Boolean) { + this.value.setValue(new WidgetConstCheckmark((Boolean) defaultValue)); + } + } + }); + enabled.setValue(isEnabled); + + this.name.setValue(name); + Object defaultValue = defaultValueSup.get(); + if (defaultValue instanceof AColor) { + this.value.setValue(new WidgetConstColor(true, (AColor) defaultValue)); + } else if (defaultValue instanceof Double) { + this.value.setValue(new Text(defaultValue.toString(), 0xFFAAAAAA, Text.TextAlign.LEFT, Text.WordBreak.WORD, 1.0, 8.0)); + } else if (defaultValue instanceof Boolean) { + this.value.setValue(new WidgetConstCheckmark((Boolean) defaultValue)); + } + if (defaultValue instanceof AColor) { + BindableAttribute<AColor> bindableAttribute = new BindableAttribute<>(AColor.class,(AColor) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new ColorEditWidget(bindableAttribute)); + } else if (defaultValue instanceof Double) { + BindableAttribute<Double> bindableAttribute = new BindableAttribute<>(Double.class, (Double) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new DoubleEditWidget(bindableAttribute, 4, Double.POSITIVE_INFINITY)); + } else if (defaultValue instanceof Boolean) { + BindableAttribute<Boolean> bindableAttribute = new BindableAttribute<>(Boolean.class, (Boolean) defaultValue); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(neu2); + }); + this.actualEdit.setValue(new BooleanEditWidget(bindableAttribute)); + } + } + + + public static class ColorEditWidget extends AnnotatedImportOnlyWidget implements Renderer { + @Bind(variableName = "color") + public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class); + @Bind(variableName = "hover") + public final BindableAttribute<Integer> hover = new BindableAttribute<>(Integer.class); + @Bind(variableName = "click") + public final BindableAttribute<Integer> click = new BindableAttribute<>(Integer.class); + + public final BindableAttribute<AColor> aColorBindableAttribute = new BindableAttribute<>(AColor.class); + + public ColorEditWidget(BindableAttribute<AColor> color) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableColor.gui")); + + aColorBindableAttribute.exportTo(color); + } + + private AbsLocationPopup locationPopup; + @On(functionName = "setColor") + public void openDialog() { + if (locationPopup != null) return; + PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); + ColorEditPopup colorEditPopup = new ColorEditPopup(aColorBindableAttribute); + double x = getDomElement().getAbsBounds().getX(); + double y = getDomElement().getAbsBounds().getY()+getDomElement().getAbsBounds().getHeight(); + locationPopup = + new AbsLocationPopup(x,y, colorEditPopup,true); + popupMgr.openPopup(locationPopup, (cb) -> { + locationPopup = null; + }); + } + + @Override + public void onUnmount() { + super.onUnmount(); + if (locationPopup != null) + PopupMgr.getPopupMgr(getDomElement()).closePopup(locationPopup); + } + + @Override + public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) { + int color = RenderUtils.getColorAt(getDomElement().getAbsBounds().getX(), getDomElement().getAbsBounds().getY(), aColorBindableAttribute.getValue()); + + this.color.setValue(color); + this.hover.setValue(RenderUtils.blendAlpha(color, 0.2f)); + this.click.setValue(RenderUtils.blendAlpha(color, 0.4f)); + + if (buildContext.getChildren().isEmpty()) return; + DomElement value = buildContext.getChildren().get(0); + + Rect original = value.getRelativeBound(); + if (original == null) return; + GlStateManager.translate(original.getX(), original.getY(), 0); + + double absXScale = buildContext.getAbsBounds().getWidth() / buildContext.getSize().getWidth(); + double absYScale = buildContext.getAbsBounds().getHeight() / buildContext.getSize().getHeight(); + + Rect elementABSBound = new Rect( + (buildContext.getAbsBounds().getX() + original.getX() * absXScale), + (buildContext.getAbsBounds().getY() + original.getY() * absYScale), + (original.getWidth() * absXScale), + (original.getHeight() * absYScale) + ); + value.setAbsBounds(elementABSBound); + + value.getRenderer().doRender(absMouseX, absMouseY, + relMouseX - original.getX(), + relMouseY - original.getY(), partialTicks, context, value); + } + } + + public static class DoubleEditWidget extends AnnotatedImportOnlyWidget { + @Bind(variableName = "value") + public final BindableAttribute<String> value = new BindableAttribute<>(String.class); + public final BindableAttribute<Double> truth = new BindableAttribute<>(Double.class); + + private double min; + private double max; + + public DoubleEditWidget(BindableAttribute<Double> featureParameter) { + this(featureParameter, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); + } + + public DoubleEditWidget(BindableAttribute<Double> featureParameter, double min, double max) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableNumber.gui")); + this.min = min; + this.max = max; + truth.exportTo(featureParameter); + + value.setValue(String.format("%f", truth.getValue())); + value.addOnUpdate((old, neu) -> { + try { + double truth = Float.parseFloat(neu); + if (truth < min) return; + if (truth > max) return; + this.truth.setValue(truth); + } catch (Exception e) { + } + }); + } + + @On(functionName = "inc") + public void inc() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + double newT = truth.getValue() + (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ? 1 : 0.1); + if (newT > max) newT = max; + truth.setValue(newT); + value.setValue(String.format("%f", truth.getValue())); + } + + @On(functionName = "dec") + public void dec() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + double newT = truth.getValue() - (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ? 1 : 0.1); + if (newT < min) newT = min; + truth.setValue(newT); + value.setValue(String.format("%f", truth.getValue())); + } + } + + + + public static class BooleanEditWidget extends AnnotatedImportOnlyWidget { + @Bind(variableName = "enabled") + public final BindableAttribute<Boolean> isEnabled = new BindableAttribute<>(Boolean.class); + public BooleanEditWidget(BindableAttribute<Boolean> featureParameter) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableCheckmark.gui")); + isEnabled.exportTo(featureParameter); + isEnabled.addOnUpdate((old,neu) -> { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + }); + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLineDerivedColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLineDerivedColor.java new file mode 100644 index 00000000..ebbb1bd7 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetEditableStyleGroupStyleLineDerivedColor.java @@ -0,0 +1,183 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.config.types.coloredit.ColorEditPopup; +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.elements.Text; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.AbsLocationPopup; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; +import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; + +import java.util.Optional; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class WidgetEditableStyleGroupStyleLineDerivedColor extends AnnotatedImportOnlyWidget { + @Bind(variableName = "enabled") + public final BindableAttribute<Boolean> enabled = new BindableAttribute<>(Boolean.class); + @Bind(variableName = "enabled2") + public final BindableAttribute<String> enabled2 = new BindableAttribute<>(String.class); + + + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class, ""); + @Bind(variableName = "value") + public final BindableAttribute<Widget> value = new BindableAttribute<>(Widget.class); + @Bind(variableName = "actualEdit") + public final BindableAttribute<Widget> actualEdit = new BindableAttribute<>(Widget.class); + + @Bind(variableName = "disableable") + public final BindableAttribute<String> disableable = new BindableAttribute<>(String.class); + + public WidgetEditableStyleGroupStyleLineDerivedColor(boolean disableable, String name, boolean isEnabled, + Supplier<Optional<AColor>> defaultValueSup, + Supplier<AColor> derivedColorSup, Consumer<Object> setter) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableStyleline.gui")); + + this.disableable.setValue(disableable ? "show" : "hide"); + + enabled.addOnUpdate((old, neu) -> { + enabled2.setValue(neu ? "enable" : "disable"); + if (old == Boolean.FALSE && neu) { + Optional<AColor> defaultValue = defaultValueSup.get(); + setter.accept(defaultValue); + BindableAttribute<AColor> bindableAttribute = new BindableAttribute<>(AColor.class, defaultValue.orElse(null)); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(Optional.ofNullable(neu2)); + }); + this.actualEdit.setValue(new ColorEditWidget(bindableAttribute, derivedColorSup)); + } else if (old == Boolean.TRUE && !neu){ + setter.accept(null); + + Optional<AColor> defaultValue = defaultValueSup.get(); + this.value.setValue(new WidgetConstColor(defaultValue.isPresent(), defaultValue.orElse(derivedColorSup.get()))); + } + }); + enabled.setValue(isEnabled); + + this.name.setValue(name); + Optional<AColor> defaultValue = defaultValueSup.get(); + this.value.setValue(new WidgetConstColor(defaultValue.isPresent(), defaultValue.orElse(derivedColorSup.get()))); + BindableAttribute<AColor> bindableAttribute = new BindableAttribute<>(AColor.class, defaultValue.orElse(null)); + bindableAttribute.addOnUpdate((o, neu2) -> { + setter.accept(Optional.ofNullable(neu2)); + }); + this.actualEdit.setValue(new ColorEditWidget(bindableAttribute, derivedColorSup)); + } + + + public static class ColorEditWidget extends AnnotatedImportOnlyWidget implements Renderer { + @Bind(variableName = "color") + public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class); + @Bind(variableName = "hover") + public final BindableAttribute<Integer> hover = new BindableAttribute<>(Integer.class); + @Bind(variableName = "click") + public final BindableAttribute<Integer> click = new BindableAttribute<>(Integer.class); + @Bind(variableName = "enabled") + public final BindableAttribute<Boolean> enabled = new BindableAttribute<>(Boolean.class); + @Bind(variableName = "enabled2") + public final BindableAttribute<String> enabled2 = new BindableAttribute<>(String.class); + + public final BindableAttribute<AColor> aColorBindableAttribute2 = new BindableAttribute<>(AColor.class); + private final Supplier<AColor> derived; + + public ColorEditWidget(BindableAttribute<AColor> color, Supplier<AColor> derivedColor) { + super(new ResourceLocation("dungeonsguide:gui/config/text/editableDerivedColor.gui")); + + enabled.addOnUpdate((o, n) -> { + enabled2.setValue(n ? "enabled" : "disabled"); + aColorBindableAttribute2.setValue(n ? null : derivedColor.get()); + }); + enabled.setValue(color.getValue() == null); + this.derived = derivedColor; + + aColorBindableAttribute2.exportTo(color); + } + + private AbsLocationPopup locationPopup; + @On(functionName = "setColor") + public void openDialog() { + if (locationPopup != null) return; + PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); + ColorEditPopup colorEditPopup = new ColorEditPopup(aColorBindableAttribute2); + double x = getDomElement().getAbsBounds().getX(); + double y = getDomElement().getAbsBounds().getY()+getDomElement().getAbsBounds().getHeight(); + locationPopup = + new AbsLocationPopup(x,y, colorEditPopup,true); + popupMgr.openPopup(locationPopup, (cb) -> { + locationPopup = null; + }); + } + + @Override + public void onUnmount() { + super.onUnmount(); + if (locationPopup != null) + PopupMgr.getPopupMgr(getDomElement()).closePopup(locationPopup); + } + + @Override + public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) { + int color = RenderUtils.getColorAt(getDomElement().getAbsBounds().getX(), getDomElement().getAbsBounds().getY(), aColorBindableAttribute2.getValue() == null ? derived.get() : aColorBindableAttribute2.getValue()); + + this.color.setValue(color); + this.hover.setValue(RenderUtils.blendAlpha(color, 0.2f)); + this.click.setValue(RenderUtils.blendAlpha(color, 0.4f)); + + if (buildContext.getChildren().isEmpty()) return; + DomElement value = buildContext.getChildren().get(0); + + Rect original = value.getRelativeBound(); + if (original == null) return; + GlStateManager.translate(original.getX(), original.getY(), 0); + + double absXScale = buildContext.getAbsBounds().getWidth() / buildContext.getSize().getWidth(); + double absYScale = buildContext.getAbsBounds().getHeight() / buildContext.getSize().getHeight(); + + Rect elementABSBound = new Rect( + (buildContext.getAbsBounds().getX() + original.getX() * absXScale), + (buildContext.getAbsBounds().getY() + original.getY() * absYScale), + (original.getWidth() * absXScale), + (original.getHeight() * absYScale) + ); + value.setAbsBounds(elementABSBound); + + value.getRenderer().doRender(absMouseX, absMouseY, + relMouseX - original.getX(), + relMouseY - original.getY(), partialTicks, context, value); + } + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetGroupButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetGroupButton.java new file mode 100644 index 00000000..2d5a0bc3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetGroupButton.java @@ -0,0 +1,77 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import net.minecraft.util.ResourceLocation; + +import java.util.Optional; + +public class WidgetGroupButton extends AnnotatedImportOnlyWidget { + @Bind(variableName = "name") + public final BindableAttribute<String> name = new BindableAttribute<>(String.class); + + private final WidgetTextStyleConfig config; + private final DefaultingDelegatingTextStyle style; + + + private AColor defaultBG; + private final DefaultingDelegatingTextStyle toEdit; + public WidgetGroupButton(WidgetTextStyleConfig config, String name, DefaultingDelegatingTextStyle style, DefaultingDelegatingTextStyle defaultingDelegatingTextStyle) { + super(new ResourceLocation("dungeonsguide:gui/config/text/groupbutton.gui")); + this.name.setValue(name); + this.config = config; + this.style = style; + this.toEdit = defaultingDelegatingTextStyle; + + defaultBG = style.backgroundShader; + } + + public void setNewBG(AColor defaultBG) { + this.defaultBG = defaultBG; + } + + @On(functionName = "click") + public void onClick() { + toEdit.backgroundShader = null; + toEdit.background = null; + config.refreshText(); + config.enterEdit(style); + } + + @Override + public void mouseEntered(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + toEdit.background = true; + toEdit.backgroundShader = defaultBG == null ? new AColor(0xFFFFFF00, true) : new AColor(RenderUtils.blendTwoColors(defaultBG.getRGB(), 0X55FFFF00), true); + config.refreshText(); + } + + @Override + public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + toEdit.backgroundShader = null; + toEdit.background = null; + config.refreshText(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetHelp.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetHelp.java new file mode 100644 index 00000000..81bfa98e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetHelp.java @@ -0,0 +1,74 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MinecraftTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.MouseTooltip; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; + +public class WidgetHelp extends AnnotatedImportOnlyWidget { + public WidgetHelp() { + super(new ResourceLocation("dungeonsguide:gui/config/text/help.gui")); + } + + private MinecraftTooltip actualTooltip = new MinecraftTooltip(); + private MouseTooltip tooltip = null; + + @Override + public void mouseEntered(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (this.tooltip == null) { + actualTooltip.setTooltip(Arrays.asList("Sorry, I tried my best designing this gui to be as intuitive as possible, but it seems like I failed doing so", + "Toggling the checkbox on the left overrides the inherited settings", + "And the checkbox on right is actual settings to override as", + "If checkbox is disabled, the shown value is the value that is currently applied to text", + "MC Default: means that the color will be calculated based on visible textColor automatically")); + + PopupMgr.getPopupMgr(getDomElement()) + .openPopup(this.tooltip = new MouseTooltip(actualTooltip), (a) -> { + this.tooltip = null; + }); + } + } + + @Override + public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + } + + @Override + public void onUnmount() { + if (this.tooltip != null) { + PopupMgr.getPopupMgr(getDomElement()) + .closePopup(this.tooltip, null); + this.tooltip = null; + } + super.onUnmount(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleEdit.java new file mode 100644 index 00000000..582ed649 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleEdit.java @@ -0,0 +1,73 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +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.elements.Column; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +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; + +public class WidgetStyleEdit extends AnnotatedImportOnlyWidget { + @Bind(variableName = "styles") + public final BindableAttribute widgets = new BindableAttribute(WidgetList.class); + @Bind(variableName = "api") + public final BindableAttribute<Column> api = new BindableAttribute(Column.class); + @Bind(variableName = "help") + public final BindableAttribute<Widget> help = new BindableAttribute<>(Widget.class, new WidgetHelp()); + private final WidgetTextStyleConfig config; + private DefaultingDelegatingTextStyle style; + public WidgetStyleEdit(WidgetTextStyleConfig config, DefaultingDelegatingTextStyle style) { + super(new ResourceLocation("dungeonsguide:gui/config/text/styleedit.gui")); + this.config = config; + this.style =style; + DefaultingDelegatingTextStyle curr = style; + List<Widget> widgetList = new ArrayList<>(); + while (curr != null) { + WidgetStyleGroup group = new WidgetStyleGroup(this, curr, style, curr == style); + if (group.anythingUseful() || style == curr) + widgetList.add(group); + if (curr.parent == null || !(curr.getParent() instanceof DefaultingDelegatingTextStyle)) break; + curr = (DefaultingDelegatingTextStyle) curr.getParent(); + } + + widgets.setValue(widgetList); + } + + public void update() { + config.refreshText(); + List<Widget> widgets = (List<Widget>) this.widgets.getValue(); + for (Widget widget : widgets) { + ((WidgetStyleGroup)widget).refresh(); + } + } + + @On(functionName = "back") + public void back() { + config.exitEdit(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleGroup.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleGroup.java new file mode 100644 index 00000000..ce79f688 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetStyleGroup.java @@ -0,0 +1,140 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +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.Optional; + +public class WidgetStyleGroup extends AnnotatedImportOnlyWidget { + @Bind(variableName = "styles") + public final BindableAttribute widgets = new BindableAttribute(WidgetList.class); + @Bind(variableName = "name") + public final BindableAttribute<String> stuff = new BindableAttribute<>(String.class); + @Bind(variableName = "inherit") + public final BindableAttribute<String> inherit = new BindableAttribute<>(String.class, "hide"); + + + private List<Widget> widgetList = new ArrayList<>(); + + public boolean anythingUseful() { + return !widgetList.isEmpty(); + } + public WidgetStyleGroup(WidgetStyleEdit edit, DefaultingDelegatingTextStyle style, DefaultingDelegatingTextStyle effective, boolean editable) { + super(new ResourceLocation("dungeonsguide:gui/config/text/stylegroup.gui")); + stuff.setValue(style.name); + inherit.setValue(style == effective ? "hide" : "show"); + + if (!editable) { + if (style.size != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("size", () -> style.size != effective.getSize(), style.size, "Overridden in child")); + if (style.topAscent != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("topAscent", () -> style.topAscent != effective.getTopAscent(), style.topAscent, "Overridden in child")); + if (style.bottomAscent != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("bottomAscent", () -> style.bottomAscent != effective.getBottomAscent(), style.bottomAscent, "Overridden in child")); + if (style.bold != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("bold", () -> style.bold != effective.isBold(), style.bold, "Overridden in child")); + if (style.italics != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("italics", () -> style.italics != effective.isItalics(), style.italics, "Overridden in child")); + if (style.strikeThrough != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("strikeThrough",() -> style.strikeThrough != effective.isStrikeThrough(), style.strikeThrough, "Overridden in child")); + if (style.underline != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("underline", () -> style.underline != effective.isUnderline(), style.underline, "Overridden in child")); + if (style.outline != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("outline", () -> style.outline != effective.isOutline(), style.outline, "Overridden in child")); + if (style.shadow != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("shadow", () -> style.shadow != effective.isShadow(), style.shadow, "Overridden in child")); + if (style.background != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("background", () -> style.background != effective.hasBackground(), style.background, "Overridden in child")); + if (style.backgroundShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("backgroundColor", () -> style.backgroundShader != effective.getBackgroundShaderColor(), style.backgroundShader, "Overridden in child")); + if (style.textShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLine("textColor", () -> style.textShader != effective.getTextShaderColor(), style.textShader, "Overridden in child")); + if (style.strikeThroughShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLineDerivedColor("strikeThroughColor", () -> style.strikeThroughShader != effective.getStrikeThroughShaderColor() || !effective.isStrikeThrough(), + style.strikeThroughShader.isPresent(), style.strikeThroughShader.orElse(style.getTextShaderColor()), + style.strikeThroughShader != effective.getStrikeThroughShaderColor() ? "Overridden in child" : "Strikethrough effectively disabled")); + if (style.underlineShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLineDerivedColor("underlineColor", () -> style.underlineShader != effective.getUnderlineShaderColor() || !effective.isUnderline(), + style.underlineShader.isPresent(), style.underlineShader.orElse(style.getTextShaderColor()), + style.underlineShader != effective.getUnderlineShaderColor() ? "Overridden in child" : "Underline effectively disabled")); + if (style.outlineShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLineDerivedColor("outlineColor", () -> style.outlineShader != effective.getOutlineShaderColor() || !effective.isOutline(), + style.outlineShader.isPresent(), style.outlineShader.orElse(style.getTextShaderColor()), + style.outlineShader != effective.getOutlineShaderColor() ? "Overridden in child" : "Outline effectively disabled")); + if (style.shadowShader != null) + widgetList.add(new WidgetConstStyleGroupStyleLineDerivedColor("shadowColor", () -> style.shadowShader != effective.getShadowShaderColor() || !effective.isShadow(), + style.shadowShader.isPresent(), style.shadowShader.orElseGet(() -> { + AColor textShader = style.getTextShaderColor(); + AColor aColor = new AColor(textShader.getRed()/4, textShader.getGreen()/4, textShader.getBlue()/4, textShader.getAlpha()); + aColor.setChroma(textShader.isChroma()); + aColor.setChromaSpeed(textShader.getChromaSpeed()); + return aColor; + }), + style.shadowShader != effective.getShadowShaderColor() ? "Overridden in child" : "Shadow effectively disabled")); + } else { + boolean disableable = style.parent != null; + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"size", style.size != null, () -> effective.getSize().doubleValue(), (val) -> {style.size= (Double) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"topAscent", style.topAscent != null, () -> effective.getTopAscent().doubleValue(), (val) -> {style.topAscent= (Double) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"bottomAscent", style.bottomAscent != null,() -> style.getBottomAscent().doubleValue(), (val) -> {style.bottomAscent= (Double) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"bold", style.bold != null, () -> style.isBold().booleanValue(), (val) -> {style.bold = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"italics", style.italics != null, () -> style.isItalics().booleanValue(), (val) -> {style.italics = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"strikeThrough", style.strikeThrough != null, () -> style.isStrikeThrough().booleanValue(), (val) -> {style.strikeThrough = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"underline", style.underline != null,() -> style.isUnderline().booleanValue(), (val) -> {style.underline = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"outline", style.outline != null, () -> style.isOutline().booleanValue(), (val) -> {style.outline = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"shadow", style.shadow != null, () -> style.isShadow().booleanValue(), (val) -> {style.shadow = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"background", style.background != null, () -> style.hasBackground().booleanValue(), (val) -> {style.background = (Boolean)val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(true, "backgroundColor", style.backgroundShader != null, + () -> new AColor(style.getBackgroundShaderColor()), (val) -> {style.backgroundShader = (AColor) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLine(disableable,"textColor", style.textShader != null, + () -> new AColor(style.getTextShaderColor()), (val) -> {style.textShader = (AColor) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLineDerivedColor(true, "strikeThroughColor", style.strikeThroughShader != null, + () -> style.getStrikeThroughShaderColor(), () -> new AColor(style.getTextShaderColor()), (val) -> {style.strikeThroughShader = (Optional<AColor>) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLineDerivedColor(true, "underlineColor", style.underlineShader != null, + () -> style.getUnderlineShaderColor(), () -> new AColor(style.getTextShaderColor()), (val) -> {style.underlineShader = (Optional<AColor>) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLineDerivedColor(true, "outlineColor", style.outlineShader != null, + () -> style.getOutlineShaderColor(), () -> new AColor(style.getTextShaderColor()), (val) -> {style.outlineShader = (Optional<AColor>) val; edit.update();})); + widgetList.add(new WidgetEditableStyleGroupStyleLineDerivedColor(true, "shadowColor", style.shadowShader != null, + () -> style.getShadowShaderColor(), () -> { + AColor textShader = style.getTextShaderColor(); + AColor aColor = new AColor(textShader.getRed()/4, textShader.getGreen()/4, textShader.getBlue()/4, textShader.getAlpha()); + aColor.setChroma(textShader.isChroma()); + aColor.setChromaSpeed(textShader.getChromaSpeed()); + return aColor; + }, (val) -> {style.shadowShader = (Optional<AColor>) val; edit.update();})); + } + widgets.setValue(widgetList); + } + + public void refresh() { + for (Widget widget : widgetList) { + if (widget instanceof WidgetConstStyleGroupStyleLine) + ((WidgetConstStyleGroupStyleLine) widget).refresh(); + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetTextStyleConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetTextStyleConfig.java new file mode 100644 index 00000000..69ce9855 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/config/WidgetTextStyleConfig.java @@ -0,0 +1,102 @@ +/* + * 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.richtext.config; + +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.BreakWord; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.RichText; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ITextStyle; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.mod.features.richtext.DefaultingDelegatingTextStyle; +import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList; +import net.minecraft.util.ResourceLocation; + +import java.util.*; + +public class WidgetTextStyleConfig extends AnnotatedImportOnlyWidget { + + @Bind(variableName = "visibility") + public final BindableAttribute<String> visibleWidget = new BindableAttribute<>(String.class, "group"); + + @Bind(variableName = "text") + public final BindableAttribute<Widget> text = new BindableAttribute<>(Widget.class); + + @Bind(variableName = "styleEdit") + public final BindableAttribute<Widget> styleEdit = new BindableAttribute<>(Widget.class); + + private RichText richText; + + @Bind(variableName = "groups") + public final BindableAttribute classes = new BindableAttribute<>(WidgetList.class); + + + private final TextSpan span; + private final Map<String, DefaultingDelegatingTextStyle> styleMap; + private final Map<String, WidgetGroupButton> buttons = new HashMap<>(); + public WidgetTextStyleConfig(TextSpan span, Map<String, DefaultingDelegatingTextStyle> styles) { + super(new ResourceLocation("dungeonsguide:gui/config/text/textconfig.gui")); + this.span = span; + this.styleMap = styles; + + Map<ITextStyle, DefaultingDelegatingTextStyle> wrapped = new HashMap<>(); + + Queue<TextSpan> toVisit = new LinkedList<>(); + toVisit.add(span); + while (!toVisit.isEmpty()) { + TextSpan span1 = toVisit.poll(); + ITextStyle style = span1.getTextStyle(); + if (!wrapped.containsKey(span1.getTextStyle())) + wrapped.put(span1.getTextStyle(), DefaultingDelegatingTextStyle.derive("Config Hack", () -> style)); + span1.setTextStyle(wrapped.get(span1.getTextStyle())); + toVisit.addAll(span1.getChildren()); + } + + text.setValue(richText = new RichText(span, BreakWord.WORD, false, RichText.TextAlign.LEFT)); + + List<Widget> list = new ArrayList<>(); + for (Map.Entry<String, DefaultingDelegatingTextStyle> stringDefaultingDelegatingTextStyleEntry : styles.entrySet()) { + WidgetGroupButton widgetGroupButton = new WidgetGroupButton(this, stringDefaultingDelegatingTextStyleEntry.getKey(), + stringDefaultingDelegatingTextStyleEntry.getValue(), wrapped.get(stringDefaultingDelegatingTextStyleEntry.getValue())); + buttons.put(stringDefaultingDelegatingTextStyleEntry.getKey(), widgetGroupButton); + list.add(widgetGroupButton); + } + classes.setValue(list); + } + + public void enterEdit(DefaultingDelegatingTextStyle style) { + // add smth + styleEdit.setValue(new WidgetStyleEdit(this, style)); + visibleWidget.setValue("style"); + } + + public void exitEdit() { + for (Map.Entry<String, WidgetGroupButton> stringWidgetGroupButtonEntry : buttons.entrySet()) { + stringWidgetGroupButtonEntry.getValue().setNewBG( + styleMap.get(stringWidgetGroupButtonEntry.getKey()).backgroundShader + ); + } + visibleWidget.setValue("group"); + } + public void refreshText() { + richText.setRootSpan(span); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextSpan.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextSpan.java deleted file mode 100644 index f38ac82f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextSpan.java +++ /dev/null @@ -1,32 +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.text; - -import lombok.Data; - -@Data -public class StyledTextSpan { - private String text; - private String group; - - public StyledTextSpan(String group, String text) { - this.text = text; - this.group = group; - } -} 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 f8105b6f..63faf77d 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 @@ -79,6 +79,12 @@ public class Column extends AnnotatedExportOnlyWidget implements Layouter { } } + public void removeAllWidget() { + for (DomElement child : getDomElement().getChildren()) { + getDomElement().removeElement(child); + } + } + public void removeWidget(Widget widget) { getDomElement().removeElement(widget.getDomElement()); } 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 2ec81139..683d4395 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 @@ -40,6 +40,7 @@ public class Slot extends AnnotatedExportOnlyWidget { private void update(Widget widget, Widget widget1) { if (this.getDomElement().getParent() == null) return; + if (!this.getDomElement().getChildren().isEmpty()) getDomElement().removeElement(getDomElement().getChildren().get(0)); DomElement domElement = null; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/FlatTextSpan.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/FlatTextSpan.java index ae1a7e01..0efb5347 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/FlatTextSpan.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/FlatTextSpan.java @@ -41,7 +41,7 @@ public class FlatTextSpan { return (1 + textStyle.getTopAscent() + textStyle.getBottomAscent()) * textStyle.getSize(); } public double getBaseline() { - return textStyle.getSize() * (textStyle.getFontRenderer().getBaselineHeight(textStyle) + textStyle.getTopAscent()); + return textStyle.getFontRenderer().getBaselineHeight(textStyle) + textStyle.getSize() * textStyle.getTopAscent(); } public BrokenWordData breakWord(double remainingWidth, double nextLineWidth, BreakWord breakWord) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/TextSpan.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/TextSpan.java index e8e562dc..e40113f7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/TextSpan.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/TextSpan.java @@ -21,14 +21,18 @@ package kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.CompiledTextStyle; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ITextStyle; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ParentDelegatingTextStyle; +import lombok.Getter; +import lombok.Setter; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public class TextSpan { + @Getter @Setter private ITextStyle textStyle; private String text; + @Getter private List<TextSpan> children = new ArrayList<>(); public TextSpan(ITextStyle textStyle, String text) { this.textStyle = textStyle; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java index 935bf647..21aaf581 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java @@ -160,7 +160,12 @@ public class DefaultFontRenderer implements FontRenderer { GlStateManager.enableTexture2D(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); for (char c : lineElement.value) { - x += renderChar(worldRenderer, x, y+1, c, lineElement.textStyle); + double offset = renderChar(worldRenderer, x, y+1, c, lineElement.textStyle); + if (lineElement.textStyle.isBold()) { + renderChar(worldRenderer, x+1, y+1, c, lineElement.textStyle); + offset += 1; + } + x+= offset; } draw(worldRenderer); if (!isShadow) lineElement.textStyle.getTextShader().freeShader(); @@ -171,9 +176,9 @@ public class DefaultFontRenderer implements FontRenderer { if (!isShadow) lineElement.textStyle.getStrikeThroughShader().useShader(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(startX, y + baseline/2, 0).endVertex(); - worldRenderer.pos(x, y + baseline/2, 0).endVertex(); - worldRenderer.pos(x, y +baseline/2+1, 0).endVertex(); worldRenderer.pos(startX, y + baseline/2+1, 0).endVertex(); + worldRenderer.pos(x, y +baseline/2+1, 0).endVertex(); + worldRenderer.pos(x, y + baseline/2, 0).endVertex(); draw(worldRenderer); if (!isShadow) lineElement.textStyle.getStrikeThroughShader().freeShader(); } @@ -181,9 +186,9 @@ public class DefaultFontRenderer implements FontRenderer { if (!isShadow) lineElement.textStyle.getUnderlineShader().useShader(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(startX, y + baseline, 0).endVertex(); - worldRenderer.pos(x, y + baseline, 0).endVertex(); - worldRenderer.pos(x, y + baseline+1, 0).endVertex(); worldRenderer.pos(startX, y + baseline+1, 0).endVertex(); + worldRenderer.pos(x, y + baseline+1, 0).endVertex(); + worldRenderer.pos(x, y + baseline, 0).endVertex(); draw(worldRenderer); if (!isShadow) lineElement.textStyle.getUnderlineShader().freeShader(); } @@ -198,13 +203,13 @@ public class DefaultFontRenderer implements FontRenderer { WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); GlStateManager.disableTexture2D(); GlStateManager.enableAlpha(); - if (lineElement.textStyle.getBackgroundShader() != null) { + if (lineElement.textStyle.hasBackground()) { lineElement.textStyle.getBackgroundShader().useShader(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldRenderer.pos(x, y, 0).endVertex(); - worldRenderer.pos(x + lineElement.getWidth(), y, 0).endVertex(); - worldRenderer.pos(x + lineElement.getWidth(), y + lineElement.textStyle.getSize(), 0).endVertex(); worldRenderer.pos(x, y + lineElement.textStyle.getSize(), 0).endVertex(); + worldRenderer.pos(x + lineElement.getWidth(), y + lineElement.textStyle.getSize(), 0).endVertex(); + worldRenderer.pos(x + lineElement.getWidth(), y, 0).endVertex(); draw(worldRenderer); lineElement.textStyle.getBackgroundShader().freeShader(); } @@ -276,8 +281,8 @@ public class DefaultFontRenderer implements FontRenderer { worldRenderer.pos(posX + (float)italicsAddition, posY, 0.0F).tex((float)texX / 128.0F, (float)texY / 128.0F).endVertex(); worldRenderer.pos(posX - (float)italicsAddition, posY + charHeight - 0.01F, 0.0F).tex((float)texX / 128.0F, ((float)texY + 7.99F) / 128.0F).endVertex(); - worldRenderer.pos(posX + charWidth+ (float)italicsAddition - 0.01F , posY+ charHeight - 0.01F, 0.0F).tex(((float)texX + texWidth - 1.01F) / 128.0F, ((float)texY + 7.99F) / 128.0F).endVertex(); - worldRenderer.pos(posX + charWidth - (float)italicsAddition - 0.01F, posY , 0.0F).tex(((float)texX + texWidth - 1.01F) / 128.0F, (float)texY / 128.0F).endVertex(); + worldRenderer.pos(posX + charWidth - (float)italicsAddition - 0.01F , posY+ charHeight - 0.01F, 0.0F).tex(((float)texX + texWidth - 1.01F) / 128.0F, ((float)texY + 7.99F) / 128.0F).endVertex(); + worldRenderer.pos(posX + charWidth + (float)italicsAddition - 0.01F, posY , 0.0F).tex(((float)texX + texWidth - 1.01F) / 128.0F, (float)texY / 128.0F).endVertex(); return texWidth * textStyle.getSize() / 8.0; } @@ -302,9 +307,9 @@ public class DefaultFontRenderer implements FontRenderer { .tex(texX / 256.0F, texY / 256.0F).endVertex(); worldRenderer.pos(posX - italicSlope, posY + charHeight - 0.01F, 0.0F) .tex(texX / 256.0F, (texY + 15.98F) / 256.0F).endVertex(); - worldRenderer.pos(posX + charWidth + italicSlope, posY + charHeight - 0.01F, 0.0F) + worldRenderer.pos(posX + charWidth - italicSlope, posY + charHeight - 0.01F, 0.0F) .tex((texX + texWidth) / 256.0F, (texY+15.98F) / 256.0F).endVertex(); - worldRenderer.pos(posX + charWidth - italicSlope, posY, 0.0F) + worldRenderer.pos(posX + charWidth + italicSlope, posY, 0.0F) .tex((texX + texWidth) / 256.0F, (texY) / 256.0F).endVertex(); return charWidth + textStyle.getSize() / 8.0; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/CompiledTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/CompiledTextStyle.java index 98e1b3c4..97ee88b5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/CompiledTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/CompiledTextStyle.java @@ -32,6 +32,7 @@ public class CompiledTextStyle implements ITextStyle { public boolean underline; public boolean outline; public boolean shadow; + public boolean background; public Shader backgroundShader; public Shader textShader; @@ -54,6 +55,7 @@ public class CompiledTextStyle implements ITextStyle { this.underline = from.isUnderline(); this.outline = from.isOutline(); this.shadow = from.isShadow(); + this.background = from.hasBackground(); this.backgroundShader = from.getBackgroundShader(); this.textShader = from.getTextShader(); @@ -64,6 +66,12 @@ public class CompiledTextStyle implements ITextStyle { this.fontRenderer = from.getFontRenderer(); } + + @Override + public Boolean hasBackground() { + return background; + } + @Override public Double getSize() { return size; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ITextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ITextStyle.java index 285ed79e..65636cab 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ITextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ITextStyle.java @@ -35,6 +35,7 @@ public interface ITextStyle { Boolean isOutline(); Boolean isShadow(); + Boolean hasBackground(); kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.shaders.Shader getBackgroundShader(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ParentDelegatingTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ParentDelegatingTextStyle.java index f9d4909d..15b38d09 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ParentDelegatingTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/styles/ParentDelegatingTextStyle.java @@ -33,7 +33,7 @@ public class ParentDelegatingTextStyle implements ITextStyle { public Double bottomAscent; - + public Boolean background; public Boolean bold; public Boolean italics; public Boolean strikeThrough; @@ -64,8 +64,9 @@ public class ParentDelegatingTextStyle implements ITextStyle { parentDelegatingTextStyle.underline = false; parentDelegatingTextStyle.shadow = false; parentDelegatingTextStyle.outline = false; + parentDelegatingTextStyle.background = false; - parentDelegatingTextStyle.backgroundShader = new SingleColorShader(0x00000000); + parentDelegatingTextStyle.backgroundShader = new SingleColorShader(0xFFFFFF00); parentDelegatingTextStyle.textShader = new SingleColorShader(0xFFFFFFFF); parentDelegatingTextStyle.strikeThroughShader = new SingleColorShader(0xFF000000); parentDelegatingTextStyle.underlineShader = new SingleColorShader(0xFF000000); @@ -92,6 +93,11 @@ public class ParentDelegatingTextStyle implements ITextStyle { } @Override + public Boolean hasBackground() { + return parent != null && background == null ? parent.hasBackground() : background; + } + + @Override public Boolean isBold() { return parent != null && bold == null ? parent.isBold() : bold; } @@ -155,4 +161,6 @@ public class ParentDelegatingTextStyle implements ITextStyle { public Shader getUnderlineShader() { return parent != null && underlineShader == null ? parent.getUnderlineShader() : underlineShader; } + + } 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 a1575d33..19e98925 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 @@ -84,6 +84,7 @@ public class DomElementRegistry { register("InvertStencil", new ExportedWidgetConverter(NegativeStencil::new)); register("WrapGrid", new ExportedWidgetConverter(Wrap::new)); + register("SimpleCheckBox", new DelegatingWidgetConverter(new ResourceLocation("dungeonsguide:gui/elements/checkbox.gui"))); register("ColorButton", new DelegatingWidgetConverter(new ResourceLocation("dungeonsguide:gui/elements/simpleButton.gui"))); register("RoundButton", new DelegatingWidgetConverter(new ResourceLocation("dungeonsguide:gui/elements/dgButton.gui"))); register("IconButton", new DelegatingWidgetConverter(new ResourceLocation("dungeonsguide:gui/elements/iconButton.gui"))); |