aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 16:01:11 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 16:01:11 +0200
commitf6d917fce6ef289789c9e594dbb1b911f86ef8bd (patch)
tree03c98dd4fc032328b73280b93ec17bed85017808 /src/main/java/at
parent9cd32579cfec4fbfdd710442841c6e712a786c53 (diff)
downloadskyhanni-f6d917fce6ef289789c9e594dbb1b911f86ef8bd.tar.gz
skyhanni-f6d917fce6ef289789c9e594dbb1b911f86ef8bd.tar.bz2
skyhanni-f6d917fce6ef289789c9e594dbb1b911f86ef8bd.zip
code cleanup
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt117
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt2
12 files changed, 134 insertions, 74 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index 165934ea0..b02a8483e 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -47,11 +47,11 @@ class CollectionAPI {
val inventoryName = event.inventoryName
if (inventoryName.endsWith(" Collection")) {
val stack = event.inventoryItems[4] ?: return
- for (line in stack.getLore()) {
+ loop@ for (line in stack.getLore()) {
singleCounterPattern.matchMatcher(line) {
val counter = group("amount").replace(",", "").toLong()
val name = inventoryName.split(" ").dropLast(1).joinToString(" ")
- val internalName = NEUItems.getInternalNameOrNull(name) ?: continue
+ val internalName = NEUItems.getInternalNameOrNull(name) ?: continue@loop
collectionValue[internalName] = counter
}
}
@@ -72,10 +72,10 @@ class CollectionAPI {
name = name.split(" ").dropLast(1).joinToString(" ")
}
- for (line in lore) {
+ loop@ for (line in lore) {
counterPattern.matchMatcher(line) {
val counter = group("amount").replace(",", "").toLong()
- val internalName = NEUItems.getInternalNameOrNull(name) ?: continue
+ val internalName = NEUItems.getInternalNameOrNull(name) ?: continue@loop
collectionValue[internalName] = counter
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
index 55bb5585b..dd9ccef71 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
@@ -78,7 +78,7 @@ class OwnInventoryData {
val internalName = item.getInternalNameOrNull()
if (internalName == null) {
- LorenzUtils.debug("OwnInventoryData add is empty for: '$internalName'")
+ LorenzUtils.debug("OwnInventoryData add is empty for: '${item.name}'")
return
}
if (internalName.startsWith("MAP-")) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt
index 3fba348aa..ce3d8ba46 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt
@@ -9,5 +9,5 @@ object DianaAPI {
fun isRitualActive() = MayorElection.isPerkActive("Diana", "Mythological Ritual")
- fun hasGriffinPet() = ProfileStorageData.profileSpecific?.let { it.currentPet.contains("Griffin") } ?: false
+ fun hasGriffinPet() = ProfileStorageData.profileSpecific?.currentPet?.contains("Griffin") ?: false
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
index ca1cd732f..0fb0be6ff 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import net.minecraft.item.ItemStack
@@ -89,7 +90,7 @@ class AnitaMedalProfit {
}
private fun getFullCost(requiredItems: MutableList<String>): Double {
- val jacobTicketPrice = NEUItems.getPrice("JACOBS_TICKET")
+ val jacobTicketPrice = "JACOBS_TICKET".asInternalName().getPrice()
var otherItemsPrice = 0.0
for (rawItemName in requiredItems) {
val (name, amount) = ItemUtils.readItemAmount(rawItemName)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
index 8f6a2c207..d047780c7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
@@ -35,12 +35,20 @@ object FortuneUpgrades {
genericUpgrades.clear()
if (hidden.plotsUnlocked != -1 && hidden.plotsUnlocked != 24) {
- genericUpgrades.add(FortuneUpgrade("§7Unlock your ${(hidden.plotsUnlocked + 1).addSuffix()} §7plot",
- null, "COMPOST", compostNeeded[hidden.plotsUnlocked], 3.0))
+ genericUpgrades.add(
+ FortuneUpgrade(
+ "§7Unlock your ${(hidden.plotsUnlocked + 1).addSuffix()} §7plot",
+ null, "COMPOST", compostNeeded[hidden.plotsUnlocked], 3.0
+ )
+ )
}
if (hidden.anitaUpgrade != -1 && hidden.anitaUpgrade != 15) {
- genericUpgrades.add(FortuneUpgrade("§7Upgrade Anita bonus to level ${hidden.anitaUpgrade + 1}",
- null, "JACOBS_TICKET", anitaTicketsNeeded[hidden.anitaUpgrade], 2.0))
+ genericUpgrades.add(
+ FortuneUpgrade(
+ "§7Upgrade Anita bonus to level ${hidden.anitaUpgrade + 1}",
+ null, "JACOBS_TICKET", anitaTicketsNeeded[hidden.anitaUpgrade], 2.0
+ )
+ )
}
getEquipmentUpgrades()
@@ -91,8 +99,12 @@ object FortuneUpgrades {
val enchantments = item.getEnchantments() ?: emptyMap()
val greenThumbLvl = enchantments["green_thumb"] ?: 0
if (greenThumbLvl != 5 && visitors != 0.0) {
- genericUpgrades.add(FortuneUpgrade("§7Enchant your ${item.displayName} §7with Green Thumb ${greenThumbLvl + 1}",
- 1500, "GREEN_THUMB;1", getNeededBooks(greenThumbLvl), visitors * 0.05))
+ genericUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${item.displayName} §7with Green Thumb ${greenThumbLvl + 1}",
+ 1500, "GREEN_THUMB;1", getNeededBooks(greenThumbLvl), visitors * 0.05
+ )
+ )
}
recombobulateItem(item, genericUpgrades)
when (item.getReforgeName()) {
@@ -100,6 +112,7 @@ object FortuneUpgrades {
"blooming" -> {
reforgeItem(item, FarmingReforges.ROOTED, genericUpgrades)
}
+
else -> {
reforgeItem(item, FarmingReforges.BLOOMING, genericUpgrades)
}
@@ -119,6 +132,7 @@ object FortuneUpgrades {
"bustling" -> {
reforgeItem(item, FarmingReforges.MOSSY, genericUpgrades)
}
+
else -> {
reforgeItem(item, FarmingReforges.BUSTLING, genericUpgrades, 100)
}
@@ -134,6 +148,7 @@ object FortuneUpgrades {
"YELLOW_BANDANA" -> {
//todo once auction stuff is done
}
+
else -> {
//give pet yellow bandana
}
@@ -154,39 +169,70 @@ object FortuneUpgrades {
if (crop in axeCrops) {
val sunderLvl = enchantments["sunder"] ?: 0
if (sunderLvl != 5) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Sunder ${sunderLvl + 1}",
- 10, "SUNDER;1", getNeededBooks(sunderLvl), 12.5))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${tool.displayName} §7with Sunder ${sunderLvl + 1}",
+ 10, "SUNDER;1", getNeededBooks(sunderLvl), 12.5
+ )
+ )
}
} else {
val harvestingLvl = enchantments["harvesting"] ?: 0
if (harvestingLvl == 5) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Harvesting ${harvestingLvl + 1}",
- 10, "HARVESTING;6", 1, 12.5))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${tool.displayName} §7with Harvesting ${harvestingLvl + 1}",
+ 10, "HARVESTING;6", 1, 12.5
+ )
+ )
}
}
if (farmingForDummiesCount != 5) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Add a Farming for Dummies to your ${tool.displayName}",
- null, "FARMING_FOR_DUMMIES", 1, 1.0))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Add a Farming for Dummies to your ${tool.displayName}",
+ null,
+ "FARMING_FOR_DUMMIES",
+ 1,
+ 1.0
+ )
+ )
}
val cropMilestone = GardenCropMilestones.getTierForCrops(crop.getCounter())
if (dedicationLvl != 4 && cropMilestone > 0) {
val dedicationMultiplier = listOf(0.5, 0.75, 1.0, 2.0)[dedicationLvl]
- val dedicationIncrease = dedicationMultiplier * cropMilestone - FarmingFortuneDisplay.getDedicationFortune(tool, crop)
+ val dedicationIncrease =
+ dedicationMultiplier * cropMilestone - FarmingFortuneDisplay.getDedicationFortune(tool, crop)
if (dedicationLvl == 3) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Dedication ${dedicationLvl + 1}",
- null, "DEDICATION;4", 1, dedicationIncrease))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${tool.displayName} §7with Dedication ${dedicationLvl + 1}",
+ null, "DEDICATION;4", 1, dedicationIncrease
+ )
+ )
} else {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Dedication ${dedicationLvl + 1}",
- 250, "DEDICATION;1", getNeededBooks(dedicationLvl), dedicationIncrease))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${tool.displayName} §7with Dedication ${dedicationLvl + 1}",
+ 250, "DEDICATION;1", getNeededBooks(dedicationLvl), dedicationIncrease
+ )
+ )
}
}
if (cultivatingLvl == 0) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Cultivating",
- null, "CULTIVATING;1", 1, 6.0))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade("§7Enchant your ${tool.displayName} §7with Cultivating", null, "CULTIVATING;1", 1, 6.0)
+ )
}
if (turboCropLvl != 5) {
- cropSpecificUpgrades.add(FortuneUpgrade("§7Enchant your ${tool.displayName} §7with ${crop.getTurboCrop().replace("_", " ")} ${turboCropLvl + 1}",
- null, "${crop.getTurboCrop().uppercase()};1", getNeededBooks(turboCropLvl), 5.0))
+ cropSpecificUpgrades.add(
+ FortuneUpgrade(
+ "§7Enchant your ${tool.displayName} §7with ${
+ crop.getTurboCrop().replace("_", " ")
+ } ${turboCropLvl + 1}",
+ null, "${crop.getTurboCrop().uppercase()};1", getNeededBooks(turboCropLvl), 5.0
+ )
+ )
}
recombobulateItem(tool, cropSpecificUpgrades)
when (tool.getReforgeName()) {
@@ -202,21 +248,32 @@ object FortuneUpgrades {
private fun recombobulateItem(item: ItemStack, list: MutableList<FortuneUpgrade>) {
if (item.isRecombobulated()) return
val reforge = item.getReforgeName()?.let {
- FarmingReforges.entries.find { enumValue -> enumValue.name == it.uppercase()
+ FarmingReforges.entries.find { enumValue ->
+ enumValue.name == it.uppercase()
}
} ?: return
FarmingFortuneDisplay.loadFortuneLineData(item, 0.0)
val increase = reforge[item.getItemRarity() + 1, FarmingFortuneDisplay.reforgeFortune] ?: return
- list.add(FortuneUpgrade("§7Recombobulate your ${item.displayName}",
- null, "RECOMBOBULATOR_3000", 1, increase))
+ list.add(
+ FortuneUpgrade("§7Recombobulate your ${item.displayName}", null, "RECOMBOBULATOR_3000", 1, increase)
+ )
}
- private fun reforgeItem(item: ItemStack, reforge: FarmingReforges, list: MutableList<FortuneUpgrade>,copperPrice: Int? = null) {
+ private fun reforgeItem(
+ item: ItemStack,
+ reforge: FarmingReforges,
+ list: MutableList<FortuneUpgrade>,
+ copperPrice: Int? = null
+ ) {
FarmingFortuneDisplay.loadFortuneLineData(item, 0.0)
val increase = reforge[item.getItemRarity(), FarmingFortuneDisplay.reforgeFortune] ?: return
- list.add(FortuneUpgrade("§7Reforge your ${item.displayName} §7to ${reforge.reforgeName}",
- copperPrice, reforge.reforgeItem, 1, increase))
+ list.add(
+ FortuneUpgrade(
+ "§7Reforge your ${item.displayName} §7to ${reforge.reforgeName}",
+ copperPrice, reforge.reforgeItem, 1, increase
+ )
+ )
}
private fun getNeededBooks(currentLvl: Int): Int {
@@ -232,8 +289,10 @@ object FortuneUpgrades {
private val cropUpgrades = listOf(5, 10, 20, 50, 100, 500, 1000, 5000, 10000)
// If they unlock in a weird order for example getting a corner before a cheaper one won't work properly
- private val compostNeeded = listOf(1, 2, 4, 8, 16, 24, 32, 48, 64, 96, 128, 160, 160,
- 320, 320, 480, 480, 640, 800, 1120, 1280, 1600, 1920, 2400)
+ private val compostNeeded = listOf(
+ 1, 2, 4, 8, 16, 24, 32, 48, 64, 96, 128, 160, 160,
+ 320, 320, 480, 480, 640, 800, 1120, 1280, 1600, 1920, 2400
+ )
// no support for people with 5% discount
private val anitaTicketsNeeded = listOf(0, 50, 50, 100, 100, 150, 150, 200, 200, 250, 300, 350, 400, 450, 1000)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 2b029d8c8..c8085efcc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -100,7 +100,10 @@ class GardenVisitorFeatures {
println("visitors: $visitors")
println("name: $name")
println("npcItem.name: ${npcItem.name}")
- CopyErrorCommand.logError(RuntimeException("visitor is null! '$name'"), "Error finding the visitor `$name§c`. Try to reopen the inventory")
+ CopyErrorCommand.logError(
+ RuntimeException("visitor is null! '$name'"),
+ "Error finding the visitor `$name§c`. Try to reopen the inventory"
+ )
return
}
@@ -428,7 +431,7 @@ class GardenVisitorFeatures {
fun onTick(event: LorenzTickEvent) {
if (!GardenAPI.inGarden()) return
if (!config.visitorNeedsDisplay && config.visitorHighlightStatus == 3) return
- if (!event.isMod(10)) return
+ if (!event.isMod(10)) return
// if (!event.isMod(300)) return
if (GardenAPI.onBarnPlot && config.visitorHighlightStatus != 3) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
index 4be642f6c..cd927a6a6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
@@ -56,6 +56,7 @@ class SackDisplay {
"Ruby Gemstones" to "ROUGH_RUBY_GEM".asInternalName(),
"Opal Gemstones" to "ROUGH_OPAL_GEM".asInternalName(),
)
+ private val MAGMA_FISH = "MAGMA_FISH".asInternalName()
private val numPattern =
"(?:(?:§[0-9a-f](?<level>I{1,3})§7:)?|(?:§7Stored:)?) (?<color>§[0-9a-f])(?<stored>[0-9.,kKmMbB]+)§7/(?<total>\\d+(?:[0-9.,]+)?[kKmMbB]?)".toPattern()
@@ -100,22 +101,22 @@ class SackDisplay {
when (rarity) {
"Rough" -> {
gem.rough = stored
- gem.roughPrice = calculatePrice(internalName, stored)
+ gem.roughPrice = internalName.sackPrice(stored)
}
"Flawed" -> {
gem.flawed = stored
- gem.flawedPrice = calculatePrice(internalName, stored)
+ gem.flawedPrice = internalName.sackPrice(stored)
}
"Fine" -> {
gem.fine = stored
- gem.finePrice = calculatePrice(internalName, stored)
+ gem.finePrice = internalName.sackPrice(stored)
}
"Flawless" -> {
gem.flawless = stored
- gem.flawlessPrice = calculatePrice(internalName, stored)
+ gem.flawlessPrice = internalName.sackPrice(stored)
}
}
gemstoneItem[name] = gem
@@ -124,26 +125,20 @@ class SackDisplay {
} else {
numPattern.matchMatcher(line) {
val stored = group("stored")
- val total = group("total")
val internalName = stack.getInternalName()
item.internalName = internalName
item.colorCode = group("color")
item.stored = stored
- item.total = total
- if (isTrophySack) {
+ item.total = group("total")
+ item.price = if (isTrophySack) {
val trophyName =
internalName.asString().lowercase().substringBeforeLast("_").replace("_", "")
val filletValue =
TrophyFishManager.getInfoByName(trophyName)?.getFilletValue(sackRarity!!) ?: 0
val storedNumber = stored.formatNumber().toInt()
- item.price =
- calculatePrice("MAGMA_FISH".asInternalName(), (filletValue * storedNumber).toString())
- } else {
- item.price = if (calculatePrice(internalName, stored) < 0) 0 else calculatePrice(
- internalName,
- stored
- )
- }
+ MAGMA_FISH.sackPrice((filletValue * storedNumber).toString())
+ } else internalName.sackPrice(stored).coerceAtLeast(0)
+
if (isRuneSack) {
val level = group("level")
rune.stack = stack
@@ -347,17 +342,11 @@ class SackDisplay {
private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
private fun isRuneDisplayEnabled() = config.showRunes
- private fun calculatePrice(internalName: NEUInternalName, stored: String) = when (config.priceFrom) {
- 0 -> {
- (internalName.getPrice(true) * stored.formatNumber()).toInt().let {
- if (it < 0)
- 0
- else it
- }
- }
+ private fun NEUInternalName.sackPrice(stored: String) = when (config.priceFrom) {
+ 0 -> (getPrice(true) * stored.formatNumber()).toInt().let { if (it < 0) 0 else it }
1 -> try {
- val npcPrice = internalName.getBazaarData()?.npcPrice ?: 0.0
+ val npcPrice = getBazaarData()?.npcPrice ?: 0.0
(npcPrice * stored.formatNumber()).toInt()
} catch (e: Exception) {
0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
index 09a1ed991..c4e0cbb26 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt
@@ -21,8 +21,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ItemAbilityCooldown {
private var lastAbility = ""
- var items = mapOf<ItemStack, List<ItemText>>()
+ private var items = mapOf<ItemStack, List<ItemText>>()
private val youAlignedOthersPattern = "§eYou aligned §r§a.* §r§eother player(s)?!".toPattern()
+ private val WEIRD_TUBA = "WEIRD_TUBA".asInternalName()
+ private val WEIRDER_TUBA = "WEIRDER_TUBA".asInternalName()
@SubscribeEvent
fun onSoundEvent(event: PlaySoundEvent) {
@@ -93,10 +95,10 @@ class ItemAbilityCooldown {
if (event.soundName == "mob.wolf.howl") {
if (event.volume == 0.5f) {
val recentItems = InventoryUtils.recentItemsInHand.values
- if ("WEIRD_TUBA".asInternalName() in recentItems) {
+ if (WEIRD_TUBA in recentItems) {
ItemAbility.WEIRD_TUBA.sound()
}
- if ("WEIRDER_TUBA".asInternalName() in recentItems) {
+ if (WEIRDER_TUBA in recentItems) {
ItemAbility.WEIRDER_TUBA.sound()
}
}
@@ -137,7 +139,7 @@ class ItemAbilityCooldown {
}
}
if (event.soundName == "random.drink") {
- if (event.pitch.round(1).toDouble() == 1.8 && event.volume == 1.0f) {
+ if (event.pitch.round(1) == 1.8 && event.volume == 1.0f) {
ItemAbility.HOLY_ICE.sound()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
index b52fb85f0..3031e021e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
@@ -102,7 +102,7 @@ class KingTalismanHelper {
farDisplay_ = "§cNext missing king: §7$king §eNow $missingTimeFormat"
}
- val timeString = if (missing) " §cMissing " + missingTimeFormat else ""
+ val timeString = if (missing) " §cMissing $missingTimeFormat" else ""
add("§7$currentString$king$missingString$timeString")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt
index 549776a40..62cc85eae 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt
@@ -20,7 +20,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class EnderNodeTracker {
- private val config get() = SkyHanniMod.feature.misc.enderNodeTracker;
+ private val config get() = SkyHanniMod.feature.misc.enderNodeTracker
private var totalNodesMined = 0
private var totalEndermiteNests = 0
@@ -154,6 +154,7 @@ class EnderNodeTracker {
"§5Ender Boots",
"§5Ender Necklace",
"§5Ender Gauntlet" -> true
+
else -> false
}
@@ -179,8 +180,10 @@ class EnderNodeTracker {
addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)")
}
addAsSingletonList(" ")
- addAsSingletonList("§b${totalEnderArmor.addSeparators()} §5Ender Armor " +
- "§7(§6${format(totalEnderArmor * 10_000)}§7)")
+ addAsSingletonList(
+ "§b${totalEnderArmor.addSeparators()} §5Ender Armor " +
+ "§7(§6${format(totalEnderArmor * 10_000)}§7)"
+ )
for (item in EnderNode.entries.subList(11, 16)) {
val count = (lootCount[item] ?: 0).addSeparators()
val profit = format(lootProfit[item] ?: 0.0)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
index 580fc7691..c6bbdab9f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
@@ -83,6 +83,9 @@ object GhostCounter {
private var currentSkill = ""
private var currentSkillLevel = -1
private const val CONFIG_VALUE_VERSION = 1
+ private val SORROW = "SORROW".asInternalName()
+ private val PLASMA = "PLASMA".asInternalName()
+ private val VOLTA = "VOLTA".asInternalName()
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
@@ -224,10 +227,10 @@ object GhostCounter {
addAsSingletonList(etaFormatting.base.formatText(eta).formatText(killETA))
val rate = 0.12 * (1 + (avgMagicFind.toDouble() / 100))
- val sorrowValue = ("SORROW".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong()
+ val sorrowValue = SORROW.getBazaarData()?.buyPrice?.toLong() ?: 0L
val final: String = (killInterp * sorrowValue * (rate / 100)).toLong().addSeparators()
- val plasmaValue = ("PLASMA".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong()
- val voltaValue = ("VOLTA".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong()
+ val plasmaValue = PLASMA.getBazaarData()?.buyPrice?.toLong() ?: 0L
+ val voltaValue = VOLTA.getBazaarData()?.buyPrice?.toLong() ?: 0L
var moneyMade: Long = 0
val priceMap = listOf(
Triple("Sorrow", SORROWCOUNT.getInt(), sorrowValue),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index 2027e68ce..d6886200e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -81,7 +81,7 @@ object EstimatedItemValue {
val item = event.stack
val oldData = cache[item]
- if (oldData != null && false) {
+ if (oldData != null) {
display = oldData
lastToolTipTime = System.currentTimeMillis()
return