From 0a22d3126cd4c0f5a9092d227fa05393ab8e8529 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:35:02 +0200 Subject: [PATCH 1/3] fixes Signed-off-by: Empa <42304516+ItsEmpa@users.noreply.github.com> --- .../dungeon/HighlightClickedBlocksConfig.java | 40 +++++++++---------- .../dungeon/DungeonHighlightClickedBlocks.kt | 40 +++++++++---------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java index 6da765e7518d..6ba7232b0dd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java @@ -9,53 +9,53 @@ public class HighlightClickedBlocksConfig { @Expose - @ConfigOption(name = "Enabled", desc = "Highlight levers, chests, and Wither Essence when clicked in Dungeons.") + @ConfigOption(name = "Enabled", desc = "Highlight levers, chests, and wither essence when clicked in Dungeons.") @ConfigEditorBoolean @FeatureToggle public boolean enabled = false; @Expose - @ConfigOption(name = "Chest Colour", desc = "Colour of clicked chests") + @ConfigOption(name = "Chest Color", desc = "Color of clicked chests.") @ConfigEditorColour - public String chestColour = "0:178:85:255:85"; + public String chestColor = "0:178:85:255:85"; @Expose - @ConfigOption(name = "Trapped Chest Colour", desc = "Colour of clicked trapped chests") + @ConfigOption(name = "Trapped Chest Color", desc = "Color of clicked trapped chests.") @ConfigEditorColour - public String trappedChestColour = "0:178:0:170:0"; + public String trappedChestColor = "0:178:0:170:0"; @Expose - @ConfigOption(name = "Locked Chest Colour", desc = "Colour of clicked locked chests") + @ConfigOption(name = "Locked Chest Color", desc = "Color of clicked locked chests.") @ConfigEditorColour - public String lockedChestColour = "0:178:255:85:85"; + public String lockedChestColor = "0:178:255:85:85"; @Expose - @ConfigOption(name = "Wither Essence Colour", desc = "Colour of clicked wither essence") + @ConfigOption(name = "Wither Essence Color", desc = "Color of clicked wither essence.") @ConfigEditorColour - public String witherEssenceColour = "0:178:255:85:255"; + public String witherEssenceColor = "0:178:255:85:255"; @Expose - @ConfigOption(name = "Lever Colour", desc = "Colour of clicked levers") + @ConfigOption(name = "Lever Color", desc = "Color of clicked levers.") @ConfigEditorColour - public String leverColour = "0:178:255:255:85"; + public String leverColor = "0:178:255:255:85"; @Expose - @ConfigOption(name = "Show Text", desc = "If enabled shows a text telling you what you clicked with the highlight.") + @ConfigOption(name = "Show Text", desc = "Shows a text saying what you clicked with the highlight.") @ConfigEditorBoolean - public boolean showTextEnabled = true; + public boolean showText = true; @Expose - @ConfigOption(name = "Random Colour", desc = "If enabled makes the colours random.") + @ConfigOption(name = "Random Color", desc = "If enabled makes the colors random.") @ConfigEditorBoolean - public boolean randomColourEnabled = false; + public boolean randomColor = false; @ConfigOption(name = "Reset Colors", desc = "Resets the colors of the highlights to default ones.") @ConfigEditorButton(buttonText = "Reset") public Runnable reset = () -> { - chestColour = "0:178:85:255:85"; - trappedChestColour = "0:178:0:170:0"; - lockedChestColour = "0:178:255:85:85"; - witherEssenceColour = "0:178:255:85:255"; - leverColour = "0:178:255:255:85"; + chestColor = "0:178:85:255:85"; + trappedChestColor = "0:178:0:170:0"; + lockedChestColor = "0:178:255:85:85"; + witherEssenceColor = "0:178:255:85:255"; + leverColor = "0:178:255:255:85"; }; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 0ecc5d5d4814..ba4d8be77f30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -23,10 +23,11 @@ import kotlin.time.Duration.Companion.seconds @SkyHanniModule object DungeonHighlightClickedBlocks { + private val config get() = SkyHanniMod.feature.dungeon.clickedBlocks private val blocks = TimeLimitedCache(3.seconds) - private var colourIndex = 0 - private val colours = LorenzColor.entries.filter { + private var colorIndex = 0 + private val colors = LorenzColor.entries.filter { it !in listOf( LorenzColor.BLACK, LorenzColor.WHITE, @@ -36,11 +37,11 @@ object DungeonHighlightClickedBlocks { ) } - private fun getRandomColour(): LorenzColor { - var id = colourIndex + 1 - if (id == colours.size) id = 0 - colourIndex = id - return colours[colourIndex] + private fun getRandomColor(): LorenzColor { + var id = colorIndex + 1 + if (id == colors.size) id = 0 + colorIndex = id + return colors[colorIndex] } @SubscribeEvent @@ -52,14 +53,13 @@ object DungeonHighlightClickedBlocks { } if (event.message == "§cThat chest is locked!") { - blocks.lastOrNull { it.value.displayText.contains("Chest") }?.value?.colour = config.lockedChestColour.toChromaColor() + blocks.lastOrNull { it.value.displayText.contains("Chest") }?.value?.color = config.lockedChestColor.toChromaColor() } } @SubscribeEvent fun onBlockClick(event: BlockClickEvent) { if (!isEnabled()) return - if (DungeonAPI.inBossRoom) return if (event.clickType != ClickType.RIGHT_CLICK) return val position = event.position @@ -86,16 +86,16 @@ object DungeonHighlightClickedBlocks { val inWaterRoom = DungeonAPI.getRoomID() == "-60,-60" if (inWaterRoom && type == ClickedBlockType.LEVER) return - val color = if (config.randomColourEnabled) getRandomColour().toColor() else type.colour() + val color = if (config.randomColor) getRandomColor().toColor() else type.color() val displayText = ExtendedChatColor(color.rgb, false).toString() + "Clicked " + type.display blocks[position] = ClickedBlock(displayText, color) } - enum class ClickedBlockType(val display: String, val colour: () -> Color) { - LEVER("Lever", { config.leverColour.toChromaColor() }), - CHEST("Chest", { config.chestColour.toChromaColor() }), - TRAPPED_CHEST("Trapped Chest", { config.trappedChestColour.toChromaColor() }), - WITHER_ESSENCE("Wither Essence", { config.witherEssenceColour.toChromaColor() }), + enum class ClickedBlockType(val display: String, val color: () -> Color) { + LEVER("Lever", { config.leverColor.toChromaColor() }), + CHEST("Chest", { config.chestColor.toChromaColor() }), + TRAPPED_CHEST("Trapped Chest", { config.trappedChestColor.toChromaColor() }), + WITHER_ESSENCE("Wither Essence", { config.witherEssenceColor.toChromaColor() }), } @SubscribeEvent @@ -103,11 +103,9 @@ object DungeonHighlightClickedBlocks { if (!isEnabled()) return blocks.forEach { (position, block) -> - event.drawColor(position, block.colour) - if (config.showTextEnabled) { + event.drawColor(position, block.color) + if (config.showText) { event.drawString(position.add(0.5, 0.5, 0.5), block.displayText, true) - } else { - return } } } @@ -117,7 +115,7 @@ object DungeonHighlightClickedBlocks { event.move(52, "dungeon.highlightClickedBlocks", "dungeon.clickedBlocks.enabled") } - class ClickedBlock(val displayText: String, var colour: Color) + class ClickedBlock(val displayText: String, var color: Color) - fun isEnabled() = DungeonAPI.inDungeon() && config.enabled + fun isEnabled() = !DungeonAPI.inBossRoom && DungeonAPI.inDungeon() && config.enabled } From f5467cf378e129b1f3b6f4bb9939f2c9e1d44547 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:38:35 +0200 Subject: [PATCH 2/3] fix merge Signed-off-by: Empa <42304516+ItsEmpa@users.noreply.github.com> --- .../config/features/dungeon/HighlightClickedBlocksConfig.java | 2 +- .../skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java index ec5333d1328d..2cc3f7cad3e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java @@ -49,7 +49,7 @@ public class HighlightClickedBlocksConfig { @ConfigEditorBoolean public boolean randomColor = false; - @ConfigOption(name = "Reset Colours", desc = "Resets the colours of the highlights to default ones.") + @ConfigOption(name = "Reset Colous", desc = "Resets the colors of the highlights to default ones.") @ConfigEditorButton(buttonText = "Reset") public Runnable reset = () -> { chestColor = "0:178:85:255:85"; diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 213456b8e37c..636e5d1178d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -117,6 +117,6 @@ object DungeonHighlightClickedBlocks { class ClickedBlock(val displayText: String, var color: Color) - fun isEnabled() = !DungeonAPI.inBossRoom && inDungeonAPI.inDungeon() && config.enabled + fun isEnabled() = !DungeonAPI.inBossRoom && DungeonAPI.inDungeon() && config.enabled } From 3ee35236fb37bdc8a988c3f1ccd1d33a5f51e945 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:39:48 +0200 Subject: [PATCH 3/3] oops Signed-off-by: Empa <42304516+ItsEmpa@users.noreply.github.com> --- .../config/features/dungeon/HighlightClickedBlocksConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java index 2cc3f7cad3e5..6ba7232b0dd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/HighlightClickedBlocksConfig.java @@ -49,7 +49,7 @@ public class HighlightClickedBlocksConfig { @ConfigEditorBoolean public boolean randomColor = false; - @ConfigOption(name = "Reset Colous", desc = "Resets the colors of the highlights to default ones.") + @ConfigOption(name = "Reset Colors", desc = "Resets the colors of the highlights to default ones.") @ConfigEditorButton(buttonText = "Reset") public Runnable reset = () -> { chestColor = "0:178:85:255:85";