diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-09-29 10:20:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-29 10:20:56 +0200 |
commit | e70a67bd5f4e0f0ca17bb1dd836a857b03c30cca (patch) | |
tree | 3713dad08591ceb7569ae2da92933b555c1a7e45 /src/main/java/at | |
parent | 37a186a932fcd81cfed66642e6a7833937f43b3a (diff) | |
download | skyhanni-e70a67bd5f4e0f0ca17bb1dd836a857b03c30cca.tar.gz skyhanni-e70a67bd5f4e0f0ca17bb1dd836a857b03c30cca.tar.bz2 skyhanni-e70a67bd5f4e0f0ca17bb1dd836a857b03c30cca.zip |
Feature: Ultimate Enchant Star (#2612)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt | 28 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index 510f953ca..6e064ced6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -232,6 +232,12 @@ public class InventoryConfig { public boolean itemStars = false; @Expose + @ConfigOption(name = "Ultimate Enchant Star", desc = "Show a star on Enchanted Books with an Ultimate Enchant.") + @ConfigEditorBoolean + @FeatureToggle + public boolean ultimateEnchantStar = false; + + @Expose @ConfigOption(name = "Missing Tasks", desc = "Highlight missing tasks in the SkyBlock Level Guide inventory.") // TODO move( , "inventory.highlightMissingSkyBlockLevelGuide", "inventory.skyblockGuideConfig.highlightMissingSkyBlockLevelGuide") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt new file mode 100644 index 000000000..315d9822b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt @@ -0,0 +1,28 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderItemTipEvent +import at.hannibal2.skyhanni.events.RenderObject +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments +import net.minecraft.init.Items +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object UltimateEnchantStar { + + private val config get() = SkyHanniMod.feature.inventory + + @SubscribeEvent + fun onRenderItemTip(event: RenderItemTipEvent) { + if (!isEnabled()) return + if (event.stack.item != Items.enchanted_book) return + val enchants = event.stack.getEnchantments() ?: return + if (enchants.size != 1 || !enchants.keys.first().startsWith("ultimate_")) return + event.renderObjects += RenderObject("§d✦", -10, -10) + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && config.ultimateEnchantStar + +} |