aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/ItemCache.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-17 17:29:15 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-17 17:29:15 +0100
commit970dfddaf9e80d6b206f411139227397f4d9e847 (patch)
tree999f15cf28127c2053058dd877f6354540c22553 /src/main/kotlin/repo/ItemCache.kt
parent915ab96b2444fa2e93d99a9747861b619d77f8f8 (diff)
downloadFirmament-970dfddaf9e80d6b206f411139227397f4d9e847.tar.gz
Firmament-970dfddaf9e80d6b206f411139227397f4d9e847.tar.bz2
Firmament-970dfddaf9e80d6b206f411139227397f4d9e847.zip
feat: Add bazaar/ah search hotkey
Diffstat (limited to 'src/main/kotlin/repo/ItemCache.kt')
-rw-r--r--src/main/kotlin/repo/ItemCache.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/kotlin/repo/ItemCache.kt b/src/main/kotlin/repo/ItemCache.kt
index 6fb2ab8..014de7d 100644
--- a/src/main/kotlin/repo/ItemCache.kt
+++ b/src/main/kotlin/repo/ItemCache.kt
@@ -23,6 +23,7 @@ import net.minecraft.item.Items
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtElement
import net.minecraft.nbt.NbtOps
+import net.minecraft.nbt.NbtString
import net.minecraft.text.Text
import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.config.HudMeta
@@ -33,11 +34,11 @@ import moe.nea.firmament.util.LegacyTagParser
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.SkyblockId
import moe.nea.firmament.util.TestUtil
+import moe.nea.firmament.util.mc.FirmamentDataComponentTypes
import moe.nea.firmament.util.mc.appendLore
import moe.nea.firmament.util.mc.modifyLore
import moe.nea.firmament.util.mc.setCustomName
import moe.nea.firmament.util.mc.setSkullOwner
-import moe.nea.firmament.util.skyblockId
object ItemCache : IReloadable {
private val cache: MutableMap<String, ItemStack> = ConcurrentHashMap()
@@ -67,6 +68,8 @@ object ItemCache : IReloadable {
null
}
+ val ItemStack.isBroken
+ get() = get(FirmamentDataComponentTypes.IS_BROKEN) ?: false
fun brokenItemStack(neuItem: NEUItem?, idHint: SkyblockId? = null): ItemStack {
return ItemStack(Items.PAINTING).apply {
setCustomName(Text.literal(neuItem?.displayName ?: idHint?.neuItem ?: "null"))
@@ -78,6 +81,10 @@ object ItemCache : IReloadable {
)
)
)
+ set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(NbtCompound().apply {
+ put("ID", NbtString.of(neuItem?.skyblockItemId ?: idHint?.neuItem ?: "null"))
+ }))
+ set(FirmamentDataComponentTypes.IS_BROKEN, true)
}
}