aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt2
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt27
2 files changed, 27 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
index f363878..64dec99 100644
--- a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -44,7 +45,6 @@ object CustomSkyBlockTextures : FirmamentFeature {
it.overrideModel = ModelIdentifier("firmskyblock", id.identifier.path, "inventory")
}
TickEvent.subscribe {
- throw RuntimeException()
if (TConfig.cacheDuration < 1 || it.tickCount % TConfig.cacheDuration == 0) {
CustomItemModelEvent.clearCache()
skullTextureCache.clear()
diff --git a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
index 37a1f0c..fb63eba 100644
--- a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -94,12 +95,36 @@ val ItemStack.petData: HypixelPetInfo?
val ItemStack.skyBlockId: SkyblockId?
get() {
return when (val id = extraAttributes.getString("id")) {
+ "" -> {
+ null
+ }
+
"PET" -> {
petData?.skyblockId ?: SkyblockId.PET_NULL
}
- // TODO: RUNE, ENCHANTED_BOOK, PARTY_HAT_CRAB{,_ANIMATED}, ABICASE
+
+ "RUNE", "UNIQUE_RUNE" -> {
+ val runeData = extraAttributes.getCompound("runes")
+ val runeKind = runeData.keys.singleOrNull()
+ if (runeKind == null) SkyblockId("RUNE")
+ else SkyblockId("${runeKind.uppercase()}_RUNE;${runeData.getInt(runeKind)}")
+ }
+
+ "ABICASE" -> {
+ SkyblockId("ABICASE_${extraAttributes.getString("model").uppercase()}")
+ }
+
+ "ENCHANTED_BOOK" -> {
+ val enchantmentData = extraAttributes.getCompound("enchantments")
+ val enchantName = enchantmentData.keys.singleOrNull()
+ if (enchantName == null) SkyblockId("ENCHANTED_BOOK")
+ else SkyblockId("${enchantName.uppercase()};${enchantmentData.getInt(enchantName)}")
+ }
+
+ // TODO: PARTY_HAT_CRAB{,_ANIMATED,_SLOTH}
else -> {
SkyblockId(id)
}
}
}
+