diff options
author | Linnea Gräf <nea@nea.moe> | 2024-02-17 13:36:37 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-02-17 13:36:37 +0100 |
commit | 2e571210c948d90a7d0ea8b07184102ceb401962 (patch) | |
tree | 2266caacfcda621d9420f411a92e66b70bc9574f | |
parent | a20e3696ece23ba4389deeebf63e1cc33f717705 (diff) | |
download | Firmament-2e571210c948d90a7d0ea8b07184102ceb401962.tar.gz Firmament-2e571210c948d90a7d0ea8b07184102ceb401962.tar.bz2 Firmament-2e571210c948d90a7d0ea8b07184102ceb401962.zip |
Fix missing ids for runes and enchantment books
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt | 27 |
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) } } } + |