feat: Add Pet overlay

* feat: pet overlay

* fix: missing shadow

* fix: getting pet when not in pets menu

* sort translations

* Merge branch 'master' into feat/pet-overlay

* Merge branch 'master' into feat/pet-overlay

* Add requested changes for Pet Overlay
This commit is contained in:
Jacob
2025-05-08 05:20:29 +08:00
committed by GitHub
parent 63669bc28b
commit 40256ca601
7 changed files with 75 additions and 8 deletions

View File

@@ -135,4 +135,8 @@ object FirmFormatters {
fun formatPosition(position: BlockPos): Text {
return Text.literal("x: ${position.x}, y: ${position.y}, z: ${position.z}")
}
fun formatPercent(value: Double, decimals: Int = 1): String {
return "%.${decimals}f%%".format(value * 100)
}
}

View File

@@ -21,6 +21,7 @@ import net.minecraft.network.RegistryByteBuf
import net.minecraft.network.codec.PacketCodec
import net.minecraft.network.codec.PacketCodecs
import net.minecraft.util.Identifier
import moe.nea.firmament.repo.ExpLadders
import moe.nea.firmament.repo.ItemCache.asItemStack
import moe.nea.firmament.repo.set
import moe.nea.firmament.util.collections.WeakCache
@@ -104,8 +105,10 @@ data class HypixelPetInfo(
val candyUsed: Int = 0,
val uuid: UUID? = null,
val active: Boolean = false,
val heldItem: String? = null,
) {
val skyblockId get() = SkyblockId("${type.uppercase()};${tier.ordinal}") // TODO: is this ordinal set up correctly?
val level get() = ExpLadders.getExpLadder(type, tier).getPetLevel(exp)
}
private val jsonparser = Json { ignoreUnknownKeys = true }

View File

@@ -164,4 +164,14 @@ fun Text.transformEachRecursively(function: (Text) -> Text): Text {
fun tr(key: String, default: String): MutableText = error("Compiler plugin did not run.")
fun trResolved(key: String, vararg args: Any): MutableText = Text.stringifiedTranslatable(key, *args)
fun titleCase(str: String): String {
return str
.lowercase()
.replace("_", " ")
.split(" ")
.joinToString(" ") { word ->
word.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
}
}