aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-27 12:13:56 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-27 12:13:56 +0200
commitcc27e7f7a8b88fe4ce5fc989f23015bdce626452 (patch)
treeab8efcb463d157423dbfdc12e6805850ee69c134 /src/main/java/at/hannibal2
parent7bc35eb6725f0ceabfd060a16147b106af869bb4 (diff)
downloadskyhanni-cc27e7f7a8b88fe4ce5fc989f23015bdce626452.tar.gz
skyhanni-cc27e7f7a8b88fe4ce5fc989f23015bdce626452.tar.bz2
skyhanni-cc27e7f7a8b88fe4ce5fc989f23015bdce626452.zip
use ItemCategory.ENCHANTED_BOOK more
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt2
2 files changed, 5 insertions, 4 deletions
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 e6d78b25e..d642140b9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
@@ -8,8 +8,10 @@ import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.DisplayTableEntry
import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemCategory
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.ItemUtils.name
@@ -19,7 +21,6 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -120,9 +121,9 @@ class AnitaMedalProfit {
)
}
- private fun getItemName(item: ItemStack): String? {
+ private fun getItemName(item: ItemStack): String {
val name = item.name
- val isEnchantedBook = name.removeColor() == "Enchanted Book"
+ val isEnchantedBook = item.getItemCategoryOrNull() == ItemCategory.ENCHANTED_BOOK
return if (isEnchantedBook) {
item.itemName
} else name
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 01d049dcb..0b7b9a5be 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -378,7 +378,7 @@ object ItemUtils {
val name = itemStack?.name ?: error("Could not find item name for $this")
// show enchanted book name
- if (name.endsWith("Enchanted Book")) {
+ if (itemStack.getItemCategoryOrNull() == ItemCategory.ENCHANTED_BOOK) {
return itemStack.getLore()[0]
}
if (name.endsWith("Enchanted Book Bundle")) {