aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/SkyblockId.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-18 17:47:32 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-18 17:47:32 +0200
commita27f8e6fed4f8f6565e311fe3684beb0377229f7 (patch)
tree2e1fac26116ba9c9435f4541bcbdbddc1d36b4ac /src/main/kotlin/util/SkyblockId.kt
parentc71fca6cc633416162b2dd010c52182662ceff85 (diff)
downloadfirmament-a27f8e6fed4f8f6565e311fe3684beb0377229f7.tar.gz
firmament-a27f8e6fed4f8f6565e311fe3684beb0377229f7.tar.bz2
firmament-a27f8e6fed4f8f6565e311fe3684beb0377229f7.zip
Add super craft to the move item REI button
Diffstat (limited to 'src/main/kotlin/util/SkyblockId.kt')
-rw-r--r--src/main/kotlin/util/SkyblockId.kt13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/kotlin/util/SkyblockId.kt b/src/main/kotlin/util/SkyblockId.kt
index 5b96dfa..31227e2 100644
--- a/src/main/kotlin/util/SkyblockId.kt
+++ b/src/main/kotlin/util/SkyblockId.kt
@@ -13,8 +13,10 @@ import kotlin.jvm.optionals.getOrNull
import net.minecraft.component.DataComponentTypes
import net.minecraft.component.type.NbtComponent
import net.minecraft.item.ItemStack
+import net.minecraft.item.Items
import net.minecraft.nbt.NbtCompound
import net.minecraft.util.Identifier
+import moe.nea.firmament.repo.ItemCache.asItemStack
import moe.nea.firmament.repo.set
import moe.nea.firmament.util.collections.WeakCache
import moe.nea.firmament.util.json.DashlessUUIDSerializer
@@ -69,6 +71,17 @@ value class SkyblockId(val neuItem: String) {
val NEUItem.skyblockId get() = SkyblockId(skyblockItemId)
+fun NEUItem.guessRecipeId(): String? {
+ if (!skyblockItemId.contains(";")) return skyblockItemId
+ val item = this.asItemStack()
+ val (id, extraId) = skyblockItemId.split(";")
+ if (item.item == Items.ENCHANTED_BOOK) {
+ return "ENCHANTED_BOOK_${id}_${extraId}"
+ }
+ if (item.petData != null) return id
+ return null
+}
+
@Serializable
data class HypixelPetInfo(
val type: String,