aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/ItemCache.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-07 14:45:21 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-07 14:45:21 +0100
commit4ae0fd617489a4a18edfbdd6343d88add8b234a7 (patch)
tree57429b26e691ab221b26676f3cccbd960f697d22 /src/main/kotlin/repo/ItemCache.kt
parentbf7795df22ca7892fae1238403feebb57c005562 (diff)
downloadFirmament-4ae0fd617489a4a18edfbdd6343d88add8b234a7.tar.gz
Firmament-4ae0fd617489a4a18edfbdd6343d88add8b234a7.tar.bz2
Firmament-4ae0fd617489a4a18edfbdd6343d88add8b234a7.zip
WIP: Re-Enable REI
Diffstat (limited to 'src/main/kotlin/repo/ItemCache.kt')
-rw-r--r--src/main/kotlin/repo/ItemCache.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/kotlin/repo/ItemCache.kt b/src/main/kotlin/repo/ItemCache.kt
index 014de7d..23c5ffb 100644
--- a/src/main/kotlin/repo/ItemCache.kt
+++ b/src/main/kotlin/repo/ItemCache.kt
@@ -70,6 +70,12 @@ object ItemCache : IReloadable {
val ItemStack.isBroken
get() = get(FirmamentDataComponentTypes.IS_BROKEN) ?: false
+
+ fun ItemStack.withFallback(fallback: ItemStack?): ItemStack {
+ if (isBroken && fallback != null) return fallback
+ return this
+ }
+
fun brokenItemStack(neuItem: NEUItem?, idHint: SkyblockId? = null): ItemStack {
return ItemStack(Items.PAINTING).apply {
setCustomName(Text.literal(neuItem?.displayName ?: idHint?.neuItem ?: "null"))