diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-06-13 21:34:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 21:34:57 +0200 |
commit | e9c12d363a45d7cc1581fd882f3701b5388f4a8e (patch) | |
tree | 2d9b87cb625bcd3c4df7f3c76cbd15f4c034d5cc /src/main/java/at/hannibal2 | |
parent | 25c623952b4cf1b60e15fbaf7562839bfe9f2201 (diff) | |
download | skyhanni-e9c12d363a45d7cc1581fd882f3701b5388f4a8e.tar.gz skyhanni-e9c12d363a45d7cc1581fd882f3701b5388f4a8e.tar.bz2 skyhanni-e9c12d363a45d7cc1581fd882f3701b5388f4a8e.zip |
Backend: code cleanup in custom wardrobe (#2088)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt index a8e334bff..69df1cf56 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt @@ -464,18 +464,8 @@ object CustomWardrobe { add( Renderable.clickable( Renderable.hoverable( - Renderable.string( - (if (wardrobeSlot.favorite) "§c" else "§7") + "❤", - scale = textScale, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER, - ), - Renderable.string( - (if (wardrobeSlot.favorite) "§4" else "§8") + "❤", - scale = textScale, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER, - ), + centerString((if (wardrobeSlot.favorite) "§c" else "§7") + "❤", scale = textScale), + centerString((if (wardrobeSlot.favorite) "§4" else "§8") + "❤", scale = textScale), ), onClick = { wardrobeSlot.favorite = !wardrobeSlot.favorite @@ -486,12 +476,7 @@ object CustomWardrobe { if (config.estimatedValue && shouldRender) { add( Renderable.hoverTips( - Renderable.string( - "§2$", - scale = textScale, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER, - ), + centerString("§2$", scale = textScale), WardrobeAPI.createPriceLore(wardrobeSlot), ), ) @@ -518,12 +503,7 @@ object CustomWardrobe { Renderable.placeholder(buttonWidth, buttonHeight), onClick, ), - Renderable.string( - text, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER, - scale = textScale, - ), + centerString(text, scale = textScale), false, ), hoveredColor, @@ -536,12 +516,7 @@ object CustomWardrobe { Renderable.drawInsideRoundedRect( Renderable.doubleLayered( Renderable.placeholder(buttonWidth, buttonHeight), - Renderable.string( - text, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER, - scale = textScale, - ), + centerString(text, scale = textScale), ), unhoveredColor.darker(0.57), padding = 0, @@ -638,4 +613,10 @@ object CustomWardrobe { } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && WardrobeAPI.inWardrobe() + + fun centerString( + text: String, + scale: Double = 1.0, + color: Color = Color.WHITE, + ) = Renderable.string(text, scale, color, horizontalAlign = HorizontalAlignment.CENTER) } |