feat: Add bazaar/ah search hotkey
This commit is contained in:
@@ -49,6 +49,7 @@ object MC {
|
||||
messageQueue.add(text)
|
||||
}
|
||||
|
||||
@Deprecated("Use checked method instead", replaceWith = ReplaceWith("sendCommand(command)"))
|
||||
fun sendServerCommand(command: String) {
|
||||
val nh = player?.networkHandler ?: return
|
||||
nh.sendPacket(
|
||||
|
||||
36
src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt
Normal file
36
src/main/kotlin/util/mc/FirmamentDataComponentTypes.kt
Normal file
@@ -0,0 +1,36 @@
|
||||
package moe.nea.firmament.util.mc
|
||||
|
||||
import com.mojang.serialization.Codec
|
||||
import net.minecraft.component.ComponentType
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.registry.Registry
|
||||
import moe.nea.firmament.Firmament
|
||||
import moe.nea.firmament.annotations.Subscribe
|
||||
import moe.nea.firmament.events.ClientInitEvent
|
||||
|
||||
object FirmamentDataComponentTypes {
|
||||
|
||||
@Subscribe
|
||||
fun init(event: ClientInitEvent) {
|
||||
}
|
||||
|
||||
private fun <T> register(
|
||||
id: String,
|
||||
builderOperator: (ComponentType.Builder<T>) -> Unit
|
||||
): ComponentType<T> {
|
||||
return Registry.register(
|
||||
Registries.DATA_COMPONENT_TYPE,
|
||||
Firmament.identifier(id),
|
||||
ComponentType.builder<T>().also(builderOperator)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
val IS_BROKEN = register<Boolean>(
|
||||
"is_broken"
|
||||
) {
|
||||
it.codec(Codec.BOOL.fieldOf("is_broken").codec())
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
21
src/main/kotlin/util/skyblock/SBItemUtil.kt
Normal file
21
src/main/kotlin/util/skyblock/SBItemUtil.kt
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user