aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java3
-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
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt8
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt15
11 files changed, 29 insertions, 65 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java
index 7ee18deb9..0c72e2b32 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java
@@ -44,7 +44,8 @@ public class MiningEventConfig {
public enum ShowType {
BOTH("Both Mining Islands"),
CRYSTAL("Crystal Hollows Only"),
- DWARVEN("Dwarven Mines Only");
+ DWARVEN("Dwarven Mines Only"),
+ ;
private final String str;
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 -> {}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
index 8c8ed5ab8..3304534a3 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
@@ -40,15 +40,8 @@ class GuiContainerHook(guiAny: Any) {
}
fun onMouseClick(slot: Slot?, slotId: Int, clickedButton: Int, clickType: Int, ci: CallbackInfo) {
- if (SlotClickEvent(
- gui,
- gui.inventorySlots,
- gui.inventorySlots?.inventory?.takeIf { it.size > slotId && slotId >= 0 }?.get(slotId),
- slot,
- slotId,
- clickedButton,
- clickType
- ).postAndCatch()
+ val item = gui.inventorySlots?.inventory?.takeIf { it.size > slotId && slotId >= 0 }?.get(slotId)
+ if (SlotClickEvent(gui, gui.inventorySlots, item, slot, slotId, clickedButton, clickType).postAndCatch()
) ci.cancel()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
index 41bed3290..aab61ab10 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
@@ -355,17 +355,9 @@ object GuiRenderUtils {
}
if (k > 0) {
- Utils.drawTexturedRect(
- x,
- y,
- w_2.coerceAtMost(k).toFloat(),
- height,
- 0f,
- w_2.toDouble().coerceAtMost(k.toDouble() / xSize).toFloat(),
- vMinFilled,
- vMaxFilled,
- GL11.GL_NEAREST
- )
+ val uMax = w_2.toDouble().coerceAtMost(k.toDouble() / xSize).toFloat()
+ val width = w_2.coerceAtMost(k).toFloat()
+ Utils.drawTexturedRect(x, y, width, height, 0f, uMax, vMinFilled, vMaxFilled, GL11.GL_NEAREST)
if (completed > 0.5f) {
Utils.drawTexturedRect(
x + w_2,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
index 535298543..e8045d70a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -148,12 +148,8 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
lists.addAsSingletonList(renderable)
}
if (hiddenItemTexts.size > 0) {
- lists.addAsSingletonList(
- Renderable.hoverTips(
- " §7${hiddenItemTexts.size} cheap items are hidden.",
- hiddenItemTexts
- )
- )
+ val text = Renderable.hoverTips(" §7${hiddenItemTexts.size} cheap items are hidden.", hiddenItemTexts)
+ lists.addAsSingletonList(text)
}
return profit
diff --git a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
index 3a4a08c47..8bc8808af 100644
--- a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
+++ b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
@@ -22,10 +22,7 @@ class VisitorToolTipParserTest {
@Test
fun testParseItemsNeeded() {
- val parsedData = VisitorTooltipParser.parse(
- lore,
- GardenConfig()
- )
+ val parsedData = VisitorTooltipParser.parse(lore, GardenConfig())
assert(parsedData.itemsNeeded.isNotEmpty()) {
"Visitor items needed is ${parsedData.itemsNeeded.count()} instead of 1"
}
@@ -36,10 +33,7 @@ class VisitorToolTipParserTest {
@Test
fun testParseRewards() {
- val parsedData = VisitorTooltipParser.parse(
- lore,
- GardenConfig()
- )
+ val parsedData = VisitorTooltipParser.parse(lore, GardenConfig())
assert(parsedData.rewards.isNotEmpty()) {
"Visitor rewards is ${parsedData.rewards.count()} instead of 6"
}
@@ -62,10 +56,7 @@ class VisitorToolTipParserTest {
@Test
fun testParseCopper() {
- val parsedData = VisitorTooltipParser.parse(
- lore,
- GardenConfig()
- )
+ val parsedData = VisitorTooltipParser.parse(lore, GardenConfig())
val copper = parsedData.rewards["Copper"]
assert(copper == 23) {
"Visitor rewards does not contain 'Copper' with amount '23'"