aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-06-05 00:27:15 +0200
committerGitHub <noreply@github.com>2023-06-05 00:27:15 +0200
commitfd248c963a4d08be55817cfc7683547f54f399f2 (patch)
tree5041db9cf3ee2e2b230883a943c95886d33f9beb /src/main/java/at/hannibal2/skyhanni/features/misc
parent6a108796ed40747693277335b4d5de90c3ce7f0b (diff)
downloadskyhanni-fd248c963a4d08be55817cfc7683547f54f399f2.tar.gz
skyhanni-fd248c963a4d08be55817cfc7683547f54f399f2.tar.bz2
skyhanni-fd248c963a4d08be55817cfc7683547f54f399f2.zip
Updated Sack-In-A-Sack display (#216)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
index 3c4e4849c..5d851eb56 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
@@ -2,18 +2,24 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiRenderItemEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
+import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraft.client.renderer.GlStateManager
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PocketSackInASackDisplay {
+ private val config get() = SkyHanniMod.feature.misc.pocketSackInASack
+ private val valPattern = "§5§o§7This sack is stitched with (?<number>.*)".toPattern()
+
@SubscribeEvent
fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
val stack = event.stack ?: return
if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return
- if (!SkyHanniMod.feature.misc.sackInASackApplied) return
+ if (!config.showApplied) return
val pocketSackInASackApplied = stack.getAppliedPocketSackInASack() ?: return
val stackTip = "§a$pocketSackInASackApplied"
@@ -38,4 +44,22 @@ class PocketSackInASackDisplay {
GlStateManager.enableLighting()
GlStateManager.enableDepth()
}
+
+ @SubscribeEvent
+ fun onTooltip(event: LorenzToolTipEvent){
+ if (!config.replaceLore) return
+ if (!ItemUtils.isSack(event.itemStack.displayName)) return
+ val it = event.toolTip.listIterator()
+ for (line in it){
+ valPattern.matchMatcher(line){
+ val replace = when (group("number")){
+ "a" -> "§c1"
+ "two" -> "§62"
+ "three" -> "§a3"
+ else -> "0"
+ }
+ it.set(line.replace(Regex("\\b${group("number")}\\b"), "$replace§7/§b3"))
+ }
+ }
+ }
} \ No newline at end of file