diff options
author | nea <nea@nea.moe> | 2023-06-12 17:46:41 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-06-12 17:46:41 +0200 |
commit | d4410a67fb43cf467194b67552cdf4b85c6753bd (patch) | |
tree | e86f0b06741cefe44c80e4e607c334ac47eef61d /src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt | |
parent | cd87be6cb3af335b90fe1c92e71bd3e980f3a310 (diff) | |
download | Firmament-d4410a67fb43cf467194b67552cdf4b85c6753bd.tar.gz Firmament-d4410a67fb43cf467194b67552cdf4b85c6753bd.tar.bz2 Firmament-d4410a67fb43cf467194b67552cdf4b85c6753bd.zip |
Add crafting overlay
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt index 3d54d5f..eac7d01 100644 --- a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt +++ b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt @@ -39,7 +39,10 @@ import moe.nea.firmament.repo.ItemCache import moe.nea.firmament.repo.ItemCache.asItemStack import moe.nea.firmament.repo.RepoManager import moe.nea.firmament.util.FirmFormatters +import moe.nea.firmament.util.HypixelPetInfo import moe.nea.firmament.util.SkyblockId +import moe.nea.firmament.util.petData +import moe.nea.firmament.util.skyBlockId // TODO: add in extra data like pet info, into this structure data class PetData( @@ -47,6 +50,12 @@ data class PetData( val petId: String, val exp: Double, ) { + companion object { + fun fromHypixel(petInfo: HypixelPetInfo) = PetData( + petInfo.tier, petInfo.type, petInfo.exp, + ) + } + val levelData by lazy { ExpLadders.getExpLadder(petId, rarity).getPetLevel(exp) } } @@ -155,5 +164,13 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> { fun getEntry(ingredient: NEUIngredient): EntryStack<SBItemStack> = getEntry(SkyblockId(ingredient.itemId), count = ingredient.amount.toInt()) - + fun getEntry(stack: ItemStack): EntryStack<SBItemStack> = + getEntry( + SBItemStack( + stack.skyBlockId ?: SkyblockId.NULL, + RepoManager.getNEUItem(stack.skyBlockId ?: SkyblockId.NULL), + stack.count, + petData = stack.petData?.let { PetData.fromHypixel(it) } + ) + ) } |