diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-02-25 15:25:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-25 15:25:10 +0100 |
commit | 991854cd34f0fa9cb8b85a091df33c459df415a6 (patch) | |
tree | c6b7281267bc459d973226ac48b0484dc21c4da3 /src/main/kotlin | |
parent | a07e62b2b726035acaf442081d2b417d319b6fce (diff) | |
download | NotEnoughUpdates-991854cd34f0fa9cb8b85a091df33c459df415a6.tar.gz NotEnoughUpdates-991854cd34f0fa9cb8b85a091df33c459df415a6.tar.bz2 NotEnoughUpdates-991854cd34f0fa9cb8b85a091df33c459df415a6.zip |
Magical power in SkyBlock Menu icon again (#588)
Show magical power at accessory bag in skyblock menu.
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt index b871a672..4782ab0f 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt @@ -23,6 +23,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent import io.github.moulberry.notenoughupdates.events.SlotClickEvent +import io.github.moulberry.notenoughupdates.util.ItemUtils import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.client.player.inventory.ContainerLocalMenu import net.minecraft.init.Items @@ -30,9 +31,13 @@ import net.minecraft.item.Item import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.text.DecimalFormat +import java.text.DecimalFormatSymbols +import java.util.* @NEUAutoSubscribe object OldSkyBlockMenu { + private val decimalFormat = DecimalFormat("##,##0", DecimalFormatSymbols(Locale.US)) val map: Map<Int, SkyBlockButton> by lazy { val map = mutableMapOf<Int, SkyBlockButton>() @@ -48,11 +53,22 @@ object OldSkyBlockMenu { if (event.inventory !is ContainerLocalMenu) return val skyBlockButton = map[event.slotNumber] ?: return + val showWarning = skyBlockButton.requiresBoosterCookie && !CookieWarning.hasActiveBoosterCookie() + val item = if (showWarning) skyBlockButton.itemWithCookieWarning else skyBlockButton.itemWithoutCookieWarning - if (skyBlockButton.requiresBoosterCookie && !CookieWarning.hasActiveBoosterCookie()) { - event.replaceWith(skyBlockButton.itemWithCookieWarning) + if (skyBlockButton == SkyBlockButton.ACCESSORY) { + val magicalPower = NotEnoughUpdates.INSTANCE.config.profileSpecific?.magicalPower ?: 0 + + val lore = ItemUtils.getLore(item) + lore.add(4, "") + val format = decimalFormat.format(magicalPower) + lore.add(5, "§7Magical Power: §6$format") + + val newItem = ItemStack.copyItemStack(item) + ItemUtils.setLore(newItem, lore) + event.replaceWith(newItem) } else { - event.replaceWith(skyBlockButton.itemWithoutCookieWarning) + event.replaceWith(item) } } |