aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-07 01:20:43 +0100
committerGitHub <noreply@github.com>2024-03-07 01:20:43 +0100
commit84589e27e919acd6f8972bb053e209b175950cfc (patch)
tree33e168a478c85ff5170e67c88594ada2538370aa /src/main/java/at/hannibal2/skyhanni/features
parent0dd5963b30522610991bc1f75b188d7c4f8266d5 (diff)
downloadskyhanni-84589e27e919acd6f8972bb053e209b175950cfc.tar.gz
skyhanni-84589e27e919acd6f8972bb053e209b175950cfc.tar.bz2
skyhanni-84589e27e919acd6f8972bb053e209b175950cfc.zip
Interlal Change: Code cleanup (#1113)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt14
6 files changed, 17 insertions, 26 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt
index 51a3def55..2b7e33e66 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt
@@ -21,10 +21,8 @@ class HighlightInquisitors {
val entity = event.entity
if (entity is EntityPlayer && entity.name == "Minos Inquisitor") {
- RenderLivingEntityHelper.setEntityColor(
- entity,
- LorenzColor.AQUA.toColor().withAlpha(127)
- ) { config.highlightInquisitors }
+ val color = LorenzColor.AQUA.toColor().withAlpha(127)
+ RenderLivingEntityHelper.setEntityColor(entity, color) { config.highlightInquisitors }
RenderLivingEntityHelper.setNoHurtTime(entity) { config.highlightInquisitors }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt
index deb699327..f17ec4587 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt
@@ -22,19 +22,17 @@ import java.awt.Color
class GeyserFishing {
private val config get() = SkyHanniMod.feature.fishing.trophyFishing.geyserOptions
+ private val geyserOffset = LorenzVec(0.1f, 0.6f, 0.1f)
+
private var geyser: LorenzVec? = null
private var geyserBox: AxisAlignedBB? = null
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
fun onReceiveParticle(event: ReceiveParticleEvent) {
if (!shouldProcessParticles()) return
- if (event.type != EnumParticleTypes.CLOUD || event.count != 15 || event.speed != 0.05f || event.offset != LorenzVec(
- 0.1f,
- 0.6f,
- 0.1f
- )
- ) return
-
+ with(event) {
+ if (type != EnumParticleTypes.CLOUD || count != 15 || speed != 0.05f || offset != geyserOffset) return
+ }
geyser = event.location
val potentialGeyser = geyser ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
index 086f4816d..ff27bd43f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
@@ -89,10 +89,13 @@ class MinionXp {
}
}
+ // TODO find the correct name of the list
+ private val listWithMissingName = listOf(21..26, 30..35, 39..44)
+
private fun handleItems(inventoryItems: Map<Int, ItemStack>, isMinion: Boolean): EnumMap<SkillType, Double> {
val xpTotal = EnumMap<SkillType, Double>(SkillType::class.java)
inventoryItems.filter {
- it.value.getLore().isNotEmpty() && (!isMinion || it.key in listOf(21..26, 30..35, 39..44).flatten())
+ it.value.getLore().isNotEmpty() && (!isMinion || it.key in listWithMissingName.flatten())
}.forEach { (_, itemStack) ->
val item = toPrimitiveItemStack(itemStack)
val name = item.internalName
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
index c5dde5ffb..b2530af37 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
@@ -43,7 +43,7 @@ class CustomTextBox {
}
private fun isEnabled() =
- config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected())
+ (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) && config.enabled
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
index b8a57856c..6997da51b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
@@ -106,8 +106,8 @@ class MarkedPlayerManager {
}
}
- private fun isEnabled() =
- config.highlightInWorld && (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected())
+ private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected())
+ && config.highlightInWorld
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
index 9efac5974..7199a1d56 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
@@ -95,17 +95,9 @@ object SkillProgress {
SkillProgressConfig.TextAlignment.LEFT,
SkillProgressConfig.TextAlignment.RIGHT,
-> {
- config.displayPosition.renderRenderables(
- listOf(
- Renderable.fixedSizeLine(
- horizontalContainer(
- display,
- horizontalAlign = textAlignment.alignment
- ), maxWidth
- )
- ),
- posLabel = "Skill Progress"
- )
+ val content = horizontalContainer(display, horizontalAlign = textAlignment.alignment)
+ val renderables = listOf(Renderable.fixedSizeLine(content, maxWidth))
+ config.displayPosition.renderRenderables(renderables, posLabel = "Skill Progress")
}
else -> {}