From a399cf02f2f599990270faed31f81b669fa3db6a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:56:08 +0200 Subject: renamed SendTitleHelper to TitleUtils --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 +- .../at/hannibal2/skyhanni/data/SendTitleHelper.kt | 40 ---------------------- .../java/at/hannibal2/skyhanni/data/TitleUtils.kt | 40 ++++++++++++++++++++++ .../skyhanni/features/bingo/MinionCraftHelper.kt | 4 +-- .../features/garden/GardenCropMilestoneDisplay.kt | 4 +-- .../features/garden/GardenNextJacobContest.kt | 4 +-- .../skyhanni/features/garden/GardenOptimalSpeed.kt | 4 +-- .../features/garden/GardenVisitorFeatures.kt | 4 +-- .../features/garden/WrongFungiCutterWarning.kt | 4 +-- .../features/garden/composter/ComposterDisplay.kt | 6 ++-- .../skyhanni/features/slayer/SlayerQuestWarning.kt | 4 +-- .../slayer/blaze/BlazeSlayerFirePitsWarning.kt | 4 +-- 12 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 96e71a779..4b24f51fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -123,7 +123,7 @@ public class SkyHanniMod { loadModule(new EntityMovementData()); loadModule(new ItemClickData()); loadModule(new MinecraftData()); - loadModule(new SendTitleHelper()); + loadModule(new TitleUtils()); loadModule(new ItemTipHelper()); loadModule(new RenderLivingEntityHelper()); loadModule(new SkillExperience()); diff --git a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt deleted file mode 100644 index 5b65bfad3..000000000 --- a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt +++ /dev/null @@ -1,40 +0,0 @@ -package at.hannibal2.skyhanni.data - -import at.hannibal2.skyhanni.events.GuiRenderEvent -import io.github.moulberry.moulconfig.internal.TextRenderUtils -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.ScaledResolution -import net.minecraft.client.renderer.GlStateManager -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class SendTitleHelper { - - companion object { - private var display = "" - private var endTime = 0L - - fun sendTitle(text: String, duration: Int) { - display = "§f$text" - endTime = System.currentTimeMillis() + duration - } - } - - @SubscribeEvent - fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (System.currentTimeMillis() > endTime) return - - val scaledResolution = ScaledResolution(Minecraft.getMinecraft()) - val width = scaledResolution.scaledWidth - val height = scaledResolution.scaledHeight - - GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) - val renderer = Minecraft.getMinecraft().fontRendererObj - - GlStateManager.pushMatrix() - GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f) - GlStateManager.scale(4.0f, 4.0f, 4.0f) - TextRenderUtils.drawStringCenteredScaledMaxWidth(display, renderer, 0f, 0f, false, 75, 0) - GlStateManager.popMatrix() - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt new file mode 100644 index 000000000..89e11f447 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt @@ -0,0 +1,40 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.GuiRenderEvent +import io.github.moulberry.moulconfig.internal.TextRenderUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.ScaledResolution +import net.minecraft.client.renderer.GlStateManager +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class TitleUtils { + + companion object { + private var display = "" + private var endTime = 0L + + fun sendTitle(text: String, duration: Int) { + display = "§f$text" + endTime = System.currentTimeMillis() + duration + } + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (System.currentTimeMillis() > endTime) return + + val scaledResolution = ScaledResolution(Minecraft.getMinecraft()) + val width = scaledResolution.scaledWidth + val height = scaledResolution.scaledHeight + + GlStateManager.enableBlend() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + val renderer = Minecraft.getMinecraft().fontRendererObj + + GlStateManager.pushMatrix() + GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f) + GlStateManager.scale(4.0f, 4.0f, 4.0f) + TextRenderUtils.drawStringCenteredScaledMaxWidth(display, renderer, 0f, 0f, false, 75, 0) + GlStateManager.popMatrix() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index fca965c15..72251046b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent @@ -256,7 +256,7 @@ class MinionCraftHelper { private fun notify(minionName: String) { if (alreadyNotified.contains(minionName)) return - SendTitleHelper.sendTitle("Can craft $minionName", 3_000) + TitleUtils.sendTitle("Can craft $minionName", 3_000) alreadyNotified.add(minionName) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt index c9eff68ed..9e4013088 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter import at.hannibal2.skyhanni.data.MayorElectionData -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.CropType.Companion.getCropType import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon @@ -297,7 +297,7 @@ class GardenCropMilestoneDisplay { lastPlaySoundTime = System.currentTimeMillis() SoundUtils.playBeepSound() } - SendTitleHelper.sendTitle("§b${crop.cropName} $nextTier in $duration", 1_500) + TitleUtils.sendTitle("§b${crop.cropName} $nextTier in $duration", 1_500) } } lineMap[3] = Collections.singletonList("§7In §b$duration") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index ec2bd680c..1fcb470b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -214,7 +214,7 @@ class GardenNextJacobContest { val cropText = crops.joinToString("§7, ") { "§a${it.cropName}" } LorenzUtils.chat("§e[SkyHanni] Next farming contest: $cropText") - SendTitleHelper.sendTitle("§eFarming Contest!", 5_000) + TitleUtils.sendTitle("§eFarming Contest!", 5_000) SoundUtils.playBeepSound() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 5c1b83610..cab83ecb3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent @@ -106,7 +106,7 @@ class GardenOptimalSpeed { if (System.currentTimeMillis() < lastWarnTime + 20_000) return lastWarnTime = System.currentTimeMillis() - SendTitleHelper.sendTitle("§cWrong speed!", 3_000) + TitleUtils.sendTitle("§cWrong speed!", 3_000) cropInHand?.let { LorenzUtils.chat("§e[SkyHanni] Wrong speed for ${it.cropName}: §f$currentSpeed §e(§f$optimalSpeed §eis optimal)") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt index 893b0434a..2b7f12539 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.GardenAPI.getSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper @@ -364,7 +364,7 @@ class GardenVisitorFeatures { visitors[name] = Visitor(name, status = VisitorStatus.NEW) LorenzUtils.debug("new visitor '$name'") if (config.visitorNotificationTitle) { - SendTitleHelper.sendTitle("§eNew Visitor", 5_000) + TitleUtils.sendTitle("§eNew Visitor", 5_000) } if (config.visitorNotificationChat) { val displayName = GardenVisitorColorNames.getColoredName(name) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/WrongFungiCutterWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/WrongFungiCutterWarning.kt index ab6c2420d..b52603590 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/WrongFungiCutterWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/WrongFungiCutterWarning.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ClickType -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -46,7 +46,7 @@ class WrongFungiCutterWarning { private fun notifyWrong() { if (!SkyHanniMod.feature.garden.fungiCutterWarn) return - SendTitleHelper.sendTitle("§cWrong Fungi Cutter Mode!", 2_000) + TitleUtils.sendTitle("§cWrong Fungi Cutter Mode!", 2_000) if (System.currentTimeMillis() > lastPlaySoundTime + 3_00) { lastPlaySoundTime = System.currentTimeMillis() SoundUtils.playBeepSound() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 691fc6846..846ab4bf1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent @@ -147,7 +147,7 @@ class ComposterDisplay { if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter) { if (System.currentTimeMillis() >= hidden.informedAboutLowMatter) { if (config.composterNotifyLowTitle) { - SendTitleHelper.sendTitle("§cYour Organic Matter is low", 4_000) + TitleUtils.sendTitle("§cYour Organic Matter is low", 4_000) } LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 @@ -158,7 +158,7 @@ class ComposterDisplay { System.currentTimeMillis() >= hidden.informedAboutLowFuel ) { if (config.composterNotifyLowTitle) { - SendTitleHelper.sendTitle("§cYour Fuel is low", 4_000) + TitleUtils.sendTitle("§cYour Fuel is low", 4_000) } LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!") hidden.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5 diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index d699b04e1..00b05a431 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ScoreboardData -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LocationUtils @@ -137,7 +137,7 @@ class SlayerQuestWarning { LorenzUtils.chat("§e[SkyHanni] $chatMessage") if (config.questWarningTitle) { - SendTitleHelper.sendTitle("§e$titleMessage", 2_000) + TitleUtils.sendTitle("§e$titleMessage", 2_000) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index f395793a1..298adfca4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.SendTitleHelper +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.BossHealthChangeEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager @@ -18,7 +18,7 @@ class BlazeSlayerFirePitsWarning { private var nextTickIn = 0 fun fireFirePits() { - SendTitleHelper.sendTitle("§cFire Pits!", 2_000) + TitleUtils.sendTitle("§cFire Pits!", 2_000) } } -- cgit