diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-13 20:47:59 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-13 20:47:59 +0200 |
commit | 0cc77949c907d38497f8cdf6fd8198fe5f0a9440 (patch) | |
tree | 0549dfcb0d621c23d225e29be374373ad1b39b2d /src/main/kotlin/features | |
parent | 87b851373071490bb371ba1160f85f0341579cb2 (diff) | |
download | Firmament-0cc77949c907d38497f8cdf6fd8198fe5f0a9440.tar.gz Firmament-0cc77949c907d38497f8cdf6fd8198fe5f0a9440.tar.bz2 Firmament-0cc77949c907d38497f8cdf6fd8198fe5f0a9440.zip |
Add current pet highlighter
Diffstat (limited to 'src/main/kotlin/features')
-rw-r--r-- | src/main/kotlin/features/FeatureManager.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/features/inventory/PetFeatures.kt | 40 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/main/kotlin/features/FeatureManager.kt b/src/main/kotlin/features/FeatureManager.kt index c2889eb..55f6328 100644 --- a/src/main/kotlin/features/FeatureManager.kt +++ b/src/main/kotlin/features/FeatureManager.kt @@ -21,6 +21,7 @@ import moe.nea.firmament.features.fixes.CompatibliltyFeatures import moe.nea.firmament.features.fixes.Fixes import moe.nea.firmament.features.inventory.CraftingOverlay import moe.nea.firmament.features.inventory.ItemRarityCosmetics +import moe.nea.firmament.features.inventory.PetFeatures import moe.nea.firmament.features.inventory.PriceData import moe.nea.firmament.features.inventory.SaveCursorPosition import moe.nea.firmament.features.inventory.SlotLocking @@ -67,6 +68,7 @@ object FeatureManager : DataHolder<FeatureManager.Config>(serializer(), "feature loadFeature(CompatibliltyFeatures) loadFeature(AnniversaryFeatures) loadFeature(QuickCommands) + loadFeature(PetFeatures) loadFeature(SaveCursorPosition) loadFeature(CustomSkyBlockTextures) loadFeature(PriceData) diff --git a/src/main/kotlin/features/inventory/PetFeatures.kt b/src/main/kotlin/features/inventory/PetFeatures.kt new file mode 100644 index 0000000..81124f3 --- /dev/null +++ b/src/main/kotlin/features/inventory/PetFeatures.kt @@ -0,0 +1,40 @@ +package moe.nea.firmament.features.inventory + +import net.minecraft.util.Identifier +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.events.SlotRenderEvents +import moe.nea.firmament.features.FirmamentFeature +import moe.nea.firmament.gui.config.ManagedConfig +import moe.nea.firmament.util.MC +import moe.nea.firmament.util.petData +import moe.nea.firmament.util.unformattedString +import moe.nea.firmament.util.useMatch + +object PetFeatures : FirmamentFeature { + override val identifier: String + get() = "pets" + + override val config: ManagedConfig? + get() = TConfig + + object TConfig : ManagedConfig(identifier) { + val highlightEquippedPet by toggle("highlight-pet") { true } + } + + val petMenuTitle = "Pets(?: \\([0-9]+/[0-9]+\\))?".toPattern() + + @Subscribe + fun onSlotRender(event: SlotRenderEvents.Before) { + if (!TConfig.highlightEquippedPet) return + val stack = event.slot.stack + if (stack.petData?.active == true) + petMenuTitle.useMatch(MC.screenName ?: return) { + event.context.drawSprite( + event.slot.x, event.slot.y, 0, 16, 16, + MC.guiAtlasManager.getSprite(Identifier.of("firmament:selected_pet_background")) + ) + } + } + + +} |