From 1f19a29b67cdcaa19d2a1c61da7098b27d808446 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:16:36 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index ebc0313c7..756d87d13 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -175,12 +175,16 @@ object SkyBlockItemModifierUtils { fun ItemStack.hasArtOfPeace() = getAttributeBoolean("artOfPeaceApplied") + fun ItemStack.isMuseumDonated() = getAttributeBoolean("donated_museum") + fun ItemStack.getLivingMetalProgress() = getAttributeInt("lm_evo") fun ItemStack.getBottleOfJyrreSeconds() = getAttributeInt("bottle_of_jyrre_seconds") fun ItemStack.getEdition() = getAttributeInt("edition") + fun ItemStack.getNewYearCake() = getAttributeInt("new_years_cake") + fun ItemStack.getEnchantments() = getExtraAttributes()?.takeIf { it.hasKey("enchantments") }?.run { val enchantments = this.getCompoundTag("enchantments") enchantments.keySet.associateWith { enchantments.getInteger(it) } @@ -251,7 +255,7 @@ object SkyBlockItemModifierUtils { getExtraAttributes()?.getLong(label)?.takeUnless { it == 0L } private fun ItemStack.getAttributeBoolean(label: String): Boolean { - return getExtraAttributes()?.hasKey(label) ?: false + return getExtraAttributes()?.getBoolean(label) ?: false } fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes") -- cgit