From 725f1f84dc791c3b31d3917bfe61c69a0b586448 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:59:42 +0100 Subject: Showing a better plot name in scoreboard. Updates faster and doesnt hide when pests are spawned. --- .../config/features/garden/GardenConfig.java | 6 ++++++ .../skyhanni/mixins/hooks/GuiIngameHook.kt | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java index 5b8485e77..b8351feeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java @@ -213,6 +213,12 @@ public class GardenConfig { @FeatureToggle public boolean plotBorders = true; + @Expose + @ConfigOption(name = "Plot Name in Scoreboard", desc = "Showing a better plot name in scoreboard. Updates faster and doesnt hide when pests are spawned.") + @ConfigEditorBoolean + @FeatureToggle + public boolean plotNameInScoreboard = true; + @Expose @ConfigOption(name = "Copy Milestone Data", desc = "Copy wrong crop milestone data in clipboard when opening the crop milestone menu. Please share this data in SkyHanni discord.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt index 7fb80d4e0..eeae056b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt @@ -1,6 +1,10 @@ package at.hannibal2.skyhanni.mixins.hooks import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.features.garden.GardenPlotAPI +import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isBarn +import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.name import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.gui.FontRenderer @@ -24,5 +28,23 @@ fun drawString( } } + if (SkyHanniMod.feature.garden.plotNameInScoreboard && GardenAPI.inGarden()) { + if (text.contains("⏣")) { + val plot = GardenPlotAPI.getCurrentPlot() + val pests = if (text.contains("ൠ")) { + text.last().digitToInt() + } else 0 + var name = plot?.let { + if (it.isBarn()) { + "§aGarden: The Barn" + } else "§aPlot: §b" + it.name + } ?: "§aGarden §cOutside" + if (pests > 0) { + name = "$name §7(§4${pests}ൠ§7)" + } + return instance.drawString(" §7⏣ $name", x, y, color) + } + } + return instance.drawString(text, x, y, color) } -- cgit