From 970dfddaf9e80d6b206f411139227397f4d9e847 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 17 Nov 2024 17:29:15 +0100 Subject: feat: Add bazaar/ah search hotkey --- src/main/kotlin/util/skyblock/SBItemUtil.kt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/kotlin/util/skyblock/SBItemUtil.kt (limited to 'src/main/kotlin/util/skyblock') diff --git a/src/main/kotlin/util/skyblock/SBItemUtil.kt b/src/main/kotlin/util/skyblock/SBItemUtil.kt new file mode 100644 index 0000000..3901b60 --- /dev/null +++ b/src/main/kotlin/util/skyblock/SBItemUtil.kt @@ -0,0 +1,21 @@ +package moe.nea.firmament.util.skyblock + +import net.minecraft.item.ItemStack +import moe.nea.firmament.util.mc.loreAccordingToNbt +import moe.nea.firmament.util.unformattedString + +object SBItemUtil { + fun ItemStack.getSearchName(): String { + val name = this.name.unformattedString + if (name.contains("Enchanted Book")) { + val enchant = loreAccordingToNbt.firstOrNull()?.unformattedString + if (enchant != null) return enchant + } + if (name.startsWith("[Lvl")) { + val closing = name.indexOf(']') + if (closing > 0) + return name.substring(closing) + } + return name + } +} -- cgit