diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2025-06-04 01:22:27 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-06-04 01:29:52 +0200 |
commit | ca501218a2f2e4cfb97b4d3e33d0b46a3508a7d3 (patch) | |
tree | 03b10dcdac8908864ae1c7ec1128dab0e4da451e /src | |
parent | d1b396ca71d2750c71afe71f1680634d1136ccdf (diff) | |
download | Firmament-ca501218a2f2e4cfb97b4d3e33d0b46a3508a7d3.tar.gz Firmament-ca501218a2f2e4cfb97b4d3e33d0b46a3508a7d3.tar.bz2 Firmament-ca501218a2f2e4cfb97b4d3e33d0b46a3508a7d3.zip |
feat: Custom Skyblock ID for Attribute Shards and Potion (This means Potions and Attribute Shards now show prices)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/util/SkyblockId.kt | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/main/kotlin/util/SkyblockId.kt b/src/main/kotlin/util/SkyblockId.kt index 42d9a89..5613393 100644 --- a/src/main/kotlin/util/SkyblockId.kt +++ b/src/main/kotlin/util/SkyblockId.kt @@ -6,8 +6,7 @@ import com.mojang.serialization.Codec import io.github.moulberry.repo.data.NEUIngredient import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.Rarity -import java.util.Optional -import java.util.UUID +import java.util.* import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import kotlinx.serialization.json.Json @@ -202,7 +201,31 @@ val ItemStack.skyBlockId: SkyblockId? else SkyblockId("${enchantName.uppercase()};${enchantmentData.getInt(enchantName).getOrNull()}") } - // TODO: PARTY_HAT_CRAB{,_ANIMATED,_SLOTH},POTION + "ATTRIBUTE_SHARD" -> { + val attributeData = extraAttributes.getCompound("attributes").getOrNull() + val attributeName = attributeData?.keys?.singleOrNull() + if (attributeName == null) SkyblockId("ATTRIBUTE_SHARD") + else SkyblockId( + "ATTRIBUTE_SHARD_${attributeName.uppercase()};${ + attributeData.getInt(attributeName).getOrNull() + }" + ) + } + + "POTION" -> { + val potionData = extraAttributes.getString("potion").getOrNull() + val potionName = extraAttributes.getString("potion_name").getOrNull() + val potionLevel = extraAttributes.getInt("potion_level").getOrNull() + val potionType = extraAttributes.getString("potion_type").getOrNull() + when { + potionName != null -> SkyblockId("POTION_${potionName.uppercase()};$potionLevel") + potionData != null -> SkyblockId("POTION_${potionData.uppercase()};$potionLevel") + potionType != null -> SkyblockId("POTION${potionType.uppercase()}") + else -> SkyblockId("WATER_BOTTLE") + } + } + + // TODO: PARTY_HAT_CRAB{,_ANIMATED,_SLOTH} else -> { SkyblockId(id) } |