aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-26 10:46:09 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-26 10:46:09 +0200
commitb20320d8fc9d0b8747dc955668226000a47e23cf (patch)
tree83c0736cc7a3451ec9721d0daf431c75977603d4
parent5963a6555fff757a263e47f2cc8b2e49ae16c6ed (diff)
downloadskyhanni-b20320d8fc9d0b8747dc955668226000a47e23cf.tar.gz
skyhanni-b20320d8fc9d0b8747dc955668226000a47e23cf.tar.bz2
skyhanni-b20320d8fc9d0b8747dc955668226000a47e23cf.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt3
2 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
index 033fbb893..4776ff9c9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt
@@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
-import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.NEUInternalName
@@ -207,16 +206,15 @@ class FarmingFortuneDisplay {
return dedicationMultiplier * cropMilestone
}
- fun getSunderFortune(tool: ItemStack?): Double { return (tool?.getEnchantments()?.get("sunder") ?: 0) * 12.5 }
- fun getHarvestingFortune(tool: ItemStack?): Double { return (tool?.getEnchantments()?.get("harvesting") ?: 0) * 12.5 }
- fun getCultivatingFortune(tool: ItemStack?): Double { return (tool?.getEnchantments()?.get("cultivating") ?: 0) * 2.0}
+ fun getSunderFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("sunder") ?: 0) * 12.5
+ fun getHarvestingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("harvesting") ?: 0) * 12.5
+ fun getCultivatingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("cultivating") ?: 0) * 2.0
- fun getAbilityFortune(item: ItemStack?): Double {
- if (item == null) return 0.0
- return getAbilityFortune(item.getInternalName(), item.getLore())
- }
+ fun getAbilityFortune(item: ItemStack?) = item?.let {
+ getAbilityFortune(it.getInternalName(), it.getLore())
+ } ?: 0.0
- fun getAbilityFortune(internalName: NEUInternalName, lore: List<String>): Double {
+ fun getAbilityFortune(internalName: NEUInternalName, lore: List<String>): Double {
val lotusAbilityPattern = "§7Piece Bonus: §6+(?<bonus>.*)☘".toPattern()
// todo make it work on Melon and Cropie armor
val armorAbilityFortune = "§7.*§7Grants §6(?<bonus>.*)☘.*".toPattern()
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 7aca21152..8f9a58c24 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
@@ -285,7 +285,8 @@ class ItemAbilityCooldown {
val stack = event.stack
val guiOpen = Minecraft.getMinecraft().currentScreen != null
- val list = items.filter { it.key.getItemUuid() == stack.getItemUuid() }
+ val uuid = stack.getItemUuid()
+ val list = items.filter { it.key.getItemUuid() == uuid }
.firstNotNullOfOrNull { it.value } ?: return
for (itemText in list) {