blob: 619a10b2d6ee275db9291135df7e1264348dc37f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package moe.nea.firmament.util.skyblock
import net.minecraft.world.item.ItemStack
import moe.nea.firmament.util.mc.loreAccordingToNbt
import moe.nea.firmament.util.unformattedString
object SBItemUtil {
fun ItemStack.getSearchName(): String {
val name = this.hoverName.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
}
}
|