aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/rei
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/rei')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntrySerializer.kt6
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntrySerializer.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntrySerializer.kt
index 97082e2..b6c81a7 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntrySerializer.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntrySerializer.kt
@@ -8,16 +8,18 @@ import moe.nea.notenoughupdates.repo.RepoManager
import moe.nea.notenoughupdates.util.SkyblockId
object NEUItemEntrySerializer : EntrySerializer<NEUItem?> {
+ const val SKYBLOCK_ID_ENTRY = "SKYBLOCK_ID"
+
override fun supportSaving(): Boolean = true
override fun supportReading(): Boolean = true
override fun read(tag: NbtCompound): NEUItem? {
- return RepoManager.getNEUItem(SkyblockId(tag.getString("SKYBLOCK_ID")))
+ return RepoManager.getNEUItem(SkyblockId(tag.getString(SKYBLOCK_ID_ENTRY)))
}
override fun save(entry: EntryStack<NEUItem?>, value: NEUItem?): NbtCompound {
return NbtCompound().apply {
- putString("SKYBLOCK_ID", value?.skyblockItemId ?: "null")
+ putString(SKYBLOCK_ID_ENTRY, value?.skyblockItemId ?: "null")
}
}
}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt
index e89b007..88f7abc 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt
@@ -9,6 +9,7 @@ import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes
import net.minecraft.item.ItemStack
import net.minecraft.util.Identifier
+import moe.nea.notenoughupdates.repo.ItemCache
import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
import moe.nea.notenoughupdates.repo.RepoManager
@@ -17,7 +18,7 @@ class NEUReiPlugin : REIClientPlugin {
companion object {
fun EntryStack<NEUItem>.asItemEntry(): EntryStack<ItemStack> {
- return EntryStack.of(VanillaEntryTypes.ITEM, value.asItemStack())
+ return EntryStack.of(VanillaEntryTypes.ITEM, value?.asItemStack())
}
val SKYBLOCK_ITEM_TYPE_ID = Identifier("notenoughupdates", "skyblockitems")