aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-09-29 19:41:58 +1000
committerGitHub <noreply@github.com>2024-09-29 11:41:58 +0200
commit8988f7d34d706b909012dceea8bad65b4863ea44 (patch)
treebe907ec20f3cfbd46f0ea314d615a47596e177ba /src/main/java/at/hannibal2/skyhanni/utils
parent3569dec0ab32c357eb34cff79c200f379f3d19ce (diff)
downloadskyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.tar.gz
skyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.tar.bz2
skyhanni-8988f7d34d706b909012dceea8bad65b4863ea44.zip
Backend: Detekt Fixes Part 4 (#2610)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt8
3 files changed, 19 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
index 944a3201a..4e06b22ea 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideGUI.kt
@@ -8,11 +8,11 @@ import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.item.ItemStack
-const val selectedColor = 0x50000000
-const val notSelectedColor = 0x50303030
-const val tabSpacing = 5
-const val tabShortSide = 25
-const val tabLongSide = 28
+const val SELECTED_COLOR = 0x50000000
+const val NOT_SELECTED_COLOR = 0x50303030
+const val TAB_SPACING = 5
+const val TAB_SHORT_SIDE = 25
+const val TAB_LONG_SIDE = 28
abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen() {
@@ -50,11 +50,11 @@ abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen
}
private fun renderHorizontalTabs() {
- var offset = Pair(tabSpacing.toFloat() * 3f, -tabLongSide.toFloat())
+ var offset = Pair(TAB_SPACING.toFloat() * 3f, -TAB_LONG_SIDE.toFloat())
GlStateManager.translate(offset.first, offset.second, 0f)
for (tab in horizontalTabs) {
tab.render(offset.first.toInt(), offset.second.toInt())
- val xShift = (tabShortSide + tabSpacing).toFloat()
+ val xShift = (TAB_SHORT_SIDE + TAB_SPACING).toFloat()
offset = offset.first + xShift to offset.second
GlStateManager.translate(xShift, 0f, 0f)
}
@@ -62,11 +62,11 @@ abstract class GuideGUI<pageEnum : Enum<*>>(defaultScreen: pageEnum) : GuiScreen
}
private fun renderVerticalTabs() {
- var offset = Pair(-tabLongSide.toFloat(), tabSpacing.toFloat() * 3f)
+ var offset = Pair(-TAB_LONG_SIDE.toFloat(), TAB_SPACING.toFloat() * 3f)
GlStateManager.translate(offset.first, offset.second, 0f)
for (tab in verticalTabs) {
tab.render(offset.first.toInt(), offset.second.toInt())
- val yShift = (tabShortSide + tabSpacing).toFloat()
+ val yShift = (TAB_SHORT_SIDE + TAB_SPACING).toFloat()
offset = offset.first to offset.second + yShift
GlStateManager.translate(0f, yShift, 0f)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
index acc69c8cc..231402d33 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
@@ -28,19 +28,19 @@ class GuideTab(
}
fun select() {
- selectColor = selectedColor
+ selectColor = SELECTED_COLOR
}
fun unSelect() {
- selectColor = notSelectedColor
+ selectColor = NOT_SELECTED_COLOR
}
- fun isSelected() = selectColor == selectedColor
+ fun isSelected() = selectColor == SELECTED_COLOR
- val width = if (isVertical) tabLongSide else tabShortSide
- val height = if (isVertical) tabShortSide else tabLongSide
+ val width = if (isVertical) TAB_LONG_SIDE else TAB_SHORT_SIDE
+ val height = if (isVertical) TAB_SHORT_SIDE else TAB_LONG_SIDE
- private var selectColor = notSelectedColor
+ private var selectColor = NOT_SELECTED_COLOR
private val renderable = Renderable.clickAndHover(object : Renderable {
override val width = this@GuideTab.width
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
index 4a81830a8..d2191462f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Searchable.kt
@@ -9,14 +9,14 @@ fun Renderable.toSearchable(searchText: String? = null) = Searchable(this, searc
fun Searchable.toRenderable() = renderable
fun List<Searchable>.toRenderable() = map { it.toRenderable() }
fun List<Searchable>.toMap() = associate { it.renderable to it.string }
-val searchPrefix = "§eSearch: §7"
+const val SEARCH_PREFIX = "§eSearch: §7"
fun List<Searchable>.buildSearchBox(
textInput: TextInput,
): Renderable {
val key = 0
return Renderable.searchBox(
Renderable.verticalSearchableContainer(toMap(), textInput = textInput, key = key + 1),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,
@@ -39,7 +39,7 @@ fun List<Searchable>.buildSearchableScrollable(
scrollValue = scrollValue,
velocity = velocity,
),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,
@@ -51,7 +51,7 @@ fun Map<List<Renderable>, String?>.buildSearchableTable(): Renderable {
val key = 0
return Renderable.searchBox(
Renderable.searchableTable(toMap(), textInput = textInput, key = key + 1),
- searchPrefix,
+ SEARCH_PREFIX,
onUpdateSize = { println("onUpdateSize") },
textInput = textInput,
key = key,