Skip to content

Commit

Permalink
Feature: Ultimate Enchant Star (#2612)
Browse files Browse the repository at this point in the history
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
  • Loading branch information
ItsEmpa and ItsEmpa authored Sep 29, 2024
1 parent 37a186a commit e70a67b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ public String toString() {
@FeatureToggle
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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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

}

0 comments on commit e70a67b

Please sign in to comment.