-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Ultimate Enchant Star (#2612)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/at/hannibal2/skyhanni/features/inventory/UltimateEnchantStar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
} |