diff options
| author | Roman / Linnea Gräf <nea@nea.moe> | 2023-02-21 13:23:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-21 13:23:57 +0100 |
| commit | 64f9b6b44426b907f3f2cb916f778fb92b441389 (patch) | |
| tree | 013aaf159a39a957ec6a19fab72bb38640a15c4c | |
| parent | 2680839f534557031238e4a8e3026914ec75a563 (diff) | |
| parent | 0ff7428140927aaa676b217d09b410dc36a98b4a (diff) | |
| download | SkyHanni-64f9b6b44426b907f3f2cb916f778fb92b441389.tar.gz SkyHanni-64f9b6b44426b907f3f2cb916f778fb92b441389.tar.bz2 SkyHanni-64f9b6b44426b907f3f2cb916f778fb92b441389.zip | |
Merge branch 'dev_3' into yaw_snapping
24 files changed, 382 insertions, 115 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 26138a826..31f067203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ + Added **Crop Milestone** Number - Show the number of the crop milestone in the inventory. + Added **Crop Upgrades** Number - Show the number of upgrades in the crop upgrades inventory. + Added **Yaw Snapping** - Make it harder to overshoot certain yaw angles. (contrib nea89) ++ Added **Visitor Timer** - Timer when the next visitor will appear, and a number how many visitors are already waiting. ### Features from other Mods > *The following features are only there because I want them when testing SkyHanni features without other mods present.* diff --git a/FEATURES.md b/FEATURES.md index eb2d38911..82c6cc743 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -165,6 +165,7 @@ + **Show Price** - Show the bazaar price of the items required for the visitors. + **Crop Milestone** Number - Show the number of the crop milestone in the inventory. + **Crop Upgrades** Number - Show the number of upgrades in the crop upgrades inventory. ++ **Visitor Timer** - Timer when the next visitor will appear, and a number how many visitors are already waiting. ## Commands - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 131d136d9..2b3c0fa4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow; import at.hannibal2.skyhanni.features.fishing.*; import at.hannibal2.skyhanni.features.garden.GardenInventoryNumbers; import at.hannibal2.skyhanni.features.garden.GardenVisitorFeatures; +import at.hannibal2.skyhanni.features.garden.GardenVisitorTimer; import at.hannibal2.skyhanni.features.garden.SkyMartBestProfit; import at.hannibal2.skyhanni.features.inventory.*; import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles; @@ -52,6 +53,7 @@ import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper; import at.hannibal2.skyhanni.test.LorenzTest; import at.hannibal2.skyhanni.test.PacketTest; import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter; +import at.hannibal2.skyhanni.utils.TabListData; import kotlin.coroutines.EmptyCoroutineContext; import kotlinx.coroutines.*; import net.minecraft.client.Minecraft; @@ -112,6 +114,8 @@ public class SkyHanniMod { loadModule(new RenderLivingEntityHelper()); loadModule(new SkillExperience()); loadModule(new InventoryData()); + loadModule(new TabListData()); + loadModule(new RenderGuiData()); //features loadModule(new BazaarOrderHelper()); @@ -202,6 +206,7 @@ public class SkyHanniMod { loadModule(new GardenVisitorFeatures()); loadModule(new GardenInventoryNumbers()); loadModule(new YawSnapping()); + loadModule(new GardenVisitorTimer()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 13ebf5106..59e14e60d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -142,8 +142,13 @@ public class Features extends Config { return; } - if (runnableId.equals("visitorHelper")) { - editOverlay(activeConfigCategory, 200, 16, garden.visitorHelperPos); + if (runnableId.equals("visitorNeeds")) { + editOverlay(activeConfigCategory, 200, 16, garden.visitorNeedsPos); + return; + } + + if (runnableId.equals("visitorTimer")) { + editOverlay(activeConfigCategory, 200, 16, garden.visitorTimerPos); return; } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index 139567c97..967c2487b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -24,48 +24,79 @@ public class Garden { public Position skyMartCopperPricePos = new Position(44, -108, false, true); @Expose - @ConfigOption(name = "Visitor Helper", desc = "") + @ConfigOption(name = "Visitor", desc = "") @ConfigEditorAccordion(id = 1) - public boolean visitorHelper = false; + public boolean visitor = false; @Expose - @ConfigOption(name = "Visitor Display", desc = "Show all items needed for the visitors.") - @ConfigEditorBoolean + @ConfigOption(name = "Visitor Timer", desc = "") @ConfigAccordionId(id = 1) - public boolean visitorHelperDisplay = true; + @ConfigEditorAccordion(id = 2) + public boolean visitorTimer = false; + + @Expose + @ConfigOption(name = "Visitor Timer", desc = "Timer when the next visitor will appear," + + "and a number how many visitors are already waiting.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean visitorTimerEnabled = true; @Expose - @ConfigOption(name = "Visitor Helper Position", desc = "") - @ConfigEditorButton(runnableId = "visitorHelper", buttonText = "Edit") + @ConfigOption(name = "Visitor Timer Position", desc = "") + @ConfigEditorButton(runnableId = "visitorTimer", buttonText = "Edit") + @ConfigAccordionId(id = 2) + public Position visitorTimerPos = new Position(0, 0, false, true); + + @Expose + @ConfigOption(name = "Visitor Items Needed", desc = "") @ConfigAccordionId(id = 1) - public Position visitorHelperPos = new Position(0, 0, false, true); + @ConfigEditorAccordion(id = 3) + public boolean visitorNeeds = false; + + @Expose + @ConfigOption(name = "Items Needed", desc = "Show all items needed for the visitors.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean visitorNeedsDisplay = true; + + @Expose + @ConfigOption(name = "Items Needed Position", desc = "") + @ConfigEditorButton(runnableId = "visitorNeeds", buttonText = "Edit") + @ConfigAccordionId(id = 3) + public Position visitorNeedsPos = new Position(0, 0, false, true); + + @Expose + @ConfigOption(name = "Only when Close", desc = "Only show the needed items when close to the visitors.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean visitorNeedsOnlyWhenClose = false; @Expose @ConfigOption(name = "Highlight Ready", desc = "Highlight the visitor when the required items are in the inventory.") @ConfigEditorBoolean @ConfigAccordionId(id = 1) - public boolean visitorHelperHighlightReady = true; + public boolean visitorHighlightReady = true; @Expose @ConfigOption(name = "Show Price", desc = "Show the bazaar price of the items required for the visitors.") @ConfigEditorBoolean @ConfigAccordionId(id = 1) - public boolean visitorHelperShowPrice = true; + public boolean visitorShowPrice = true; @Expose @ConfigOption(name = "Numbers", desc = "") - @ConfigEditorAccordion(id = 2) + @ConfigEditorAccordion(id = 4) public boolean numbers = false; @Expose - @ConfigOption(name = "Crop Milestone", desc = "Show the number of the crop milestone in the inventory.") + @ConfigOption(name = "Crop Milestone", desc = "Show the number of crop milestones in the inventory.") @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean cropMilestoneNumber = true; + @ConfigAccordionId(id = 4) + public boolean numberCropMilestone = true; @Expose @ConfigOption(name = "Crop Upgrades", desc = "Show the number of upgrades in the crop upgrades inventory.") @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean cropUpgradesNumber = true; + @ConfigAccordionId(id = 4) + public boolean numberCropUpgrades = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt index 174c5d3d0..458d94260 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import at.hannibal2.skyhanni.utils.TabListUtils +import at.hannibal2.skyhanni.utils.TabListData import net.minecraft.client.Minecraft import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -125,7 +125,7 @@ class HyPixelData { private fun checkIsland() { var newIsland = "" var guesting = false - for (line in TabListUtils.getTabList()) { + for (line in TabListData.getTabList()) { if (line.startsWith("§b§lArea: ")) { newIsland = line.split(": ")[1].removeColor() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt new file mode 100644 index 000000000..b9a217fbc --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.GuiRenderEvent +import net.minecraftforge.client.event.GuiScreenEvent +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RenderGuiData { + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + GuiRenderEvent(GuiRenderEvent.RenderType.IN_WORLD).postAndCatch() + } + + @SubscribeEvent + fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { + GuiRenderEvent(GuiRenderEvent.RenderType.INVENTORY_BACKGROUND).postAndCatch() + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiRenderEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderEvent.kt new file mode 100644 index 000000000..9b7cebced --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/GuiRenderEvent.kt @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.events + +class GuiRenderEvent(val type: RenderType): LorenzEvent() { + + enum class RenderType { + INVENTORY_BACKGROUND, + IN_WORLD, + ; + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt new file mode 100644 index 000000000..4524cbd05 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/TabListUpdateEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class TabListUpdateEvent(val tabList: List<String>): LorenzEvent()
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt index ea04aa1e5..03a07dbb1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.features.bingo -import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.SkillExperience import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -107,7 +106,7 @@ class BingoNextStepHelper { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - if (!HyPixelData.skyBlock) return + if (!LorenzUtils.inSkyBlock) return //TODO add thys message // if (event.message == "thys message") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt index 95b9b1e9e..1c6efdc1b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal +import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -20,17 +20,18 @@ class GardenInventoryNumbers { if (!isEnabled()) return if (InventoryUtils.openInventoryName() == "Crop Milestones") { - if (!SkyHanniMod.feature.garden.cropMilestoneNumber) return + if (!SkyHanniMod.feature.garden.numberCropMilestone) return event.stack.getLore() .map { patternTierProgress.matcher(it) } .filter { it.matches() } - .map { it.group(1).romanToDecimal() - 1 } + + .map { it.group(1).romanToDecimalIfNeeded() - 1 } .forEach { event.stackTip = "" + it } } if (InventoryUtils.openInventoryName() == "Crop Upgrades") { - if (!SkyHanniMod.feature.garden.cropUpgradesNumber) return + if (!SkyHanniMod.feature.garden.numberCropUpgrades) return event.stack.getLore() .map { patternUpgradeTier.matcher(it) } 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 d2b860908..06dbd10ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.withAlpha @@ -16,16 +17,13 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.network.play.client.C02PacketUseEntity import net.minecraft.network.play.server.S13PacketDestroyEntities -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent -import java.util.regex.Pattern class GardenVisitorFeatures { - private val pattern = Pattern.compile("(.*)§8x(.*)") private val visitors = mutableMapOf<String, Visitor>() private val display = mutableListOf<String>() private var lastClickedNpc = 0 @@ -34,8 +32,8 @@ class GardenVisitorFeatures { @SubscribeEvent fun onChatPacket(event: InventoryOpenEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.garden.visitorHelperDisplay && - !SkyHanniMod.feature.garden.visitorHelperHighlightReady + if (!SkyHanniMod.feature.garden.visitorNeedsDisplay && + !SkyHanniMod.feature.garden.visitorHighlightReady ) return val npcItem = event.inventory.items[13] ?: return @@ -57,11 +55,8 @@ class GardenVisitorFeatures { if (line == "§7Items Required:") continue if (line.isEmpty()) break - val matcher = pattern.matcher(line) - if (!matcher.matches()) continue - - val itemName = matcher.group(1).trim() - val amount = matcher.group(2).toInt() + val (itemName, amount) = ItemUtils.readItemAmount(line) + if (itemName == null) continue visitor.items[itemName] = amount } @@ -83,7 +78,7 @@ class GardenVisitorFeatures { } if (requiredItems.isEmpty()) return - display.add("Visitors need:") + display.add("Visitor Items Needed:") for ((name, amount) in requiredItems) { display.add(" -$name §8x$amount") } @@ -95,7 +90,7 @@ class GardenVisitorFeatures { fun onTooltip(event: ItemTooltipEvent) { if (!isEnabled()) return if (!nearby) return - if (!SkyHanniMod.feature.garden.visitorHelperShowPrice) return + if (!SkyHanniMod.feature.garden.visitorShowPrice) return val name = event.itemStack.name ?: return if (name != "§aAccept Offer") return @@ -109,17 +104,14 @@ class GardenVisitorFeatures { if (line == "") { if (amountDifferentItems > 1) { val format = NumberUtil.format(totalPrice) - list[1] = list[1] + "$line §f(§6$format§f)" + list[1] = list[1] + "$line §f(§6Total §6$format§f)" } break } if (i > 1) { - val matcher = pattern.matcher(line) - if (matcher.matches()) { - val itemName = matcher.group(1).trim() - val amount = matcher.group(2).toInt() - + val (itemName, amount) = ItemUtils.readItemAmount(line) + if (itemName != null) { val internalName = NEUItems.getInternalNameByName(itemName) val auctionManager = NotEnoughUpdates.INSTANCE.manager.auctionManager val lowestBin = auctionManager.getBazaarOrBin(internalName, false) @@ -137,15 +129,31 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.garden.visitorHelperDisplay && - !SkyHanniMod.feature.garden.visitorHelperHighlightReady && - !SkyHanniMod.feature.garden.visitorHelperShowPrice + if (!SkyHanniMod.feature.garden.visitorNeedsDisplay && + !SkyHanniMod.feature.garden.visitorHighlightReady && + !SkyHanniMod.feature.garden.visitorShowPrice ) return if (tick++ % 60 != 0) return - nearby = LocationUtils.playerLocation().distance(LorenzVec(8.4, 72.0, -14.1)) < 10 + val defaultVanillaSkin = LorenzVec(8.4, 72.0, -14.1) + val castleSkin = LorenzVec(-5, 75, 18) + val bambooSkin = LorenzVec(-12, 72, -25) + val hiveSkin = LorenzVec(-17, 71, -19) + val cubeSkin = LorenzVec(-17, 71, -19) + + // TODO Only check current one, ignore others. + val list = mutableListOf<LorenzVec>() + list.add(defaultVanillaSkin) + list.add(castleSkin) + list.add(bambooSkin) + list.add(hiveSkin) + list.add(cubeSkin) + + val playerLocation = LocationUtils.playerLocation() + nearby = list.map { playerLocation.distance(it) < 15 }.any { it } - if (nearby && SkyHanniMod.feature.garden.visitorHelperHighlightReady) { + + if (nearby && SkyHanniMod.feature.garden.visitorHighlightReady) { checkVisitorsReady() } } @@ -167,7 +175,7 @@ class GardenVisitorFeatures { if (entity is EntityLivingBase) { val color = LorenzColor.GREEN.toColor().withAlpha(120) RenderLivingEntityHelper.setEntityColor(entity, color) - { SkyHanniMod.feature.garden.visitorHelperHighlightReady } + { SkyHanniMod.feature.garden.visitorHighlightReady } } } } @@ -188,26 +196,29 @@ class GardenVisitorFeatures { } } + // TODO make event @SubscribeEvent fun onSendEvent(event: PacketEvent.SendEvent) { val packet = event.packet if (packet !is C02PacketUseEntity) return val theWorld = Minecraft.getMinecraft().theWorld - val entity = packet.getEntityFromWorld(theWorld) + val entity = packet.getEntityFromWorld(theWorld) ?: return val entityId = entity.entityId lastClickedNpc = entityId } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.garden.visitorHelperDisplay) return - if (!nearby) return + if (!SkyHanniMod.feature.garden.visitorNeedsDisplay) return + + if (SkyHanniMod.feature.garden.visitorNeedsOnlyWhenClose) { + if (!nearby) return + } - SkyHanniMod.feature.garden.visitorHelperPos.renderStrings(display) + SkyHanniMod.feature.garden.visitorNeedsPos.renderStrings(display) } class Visitor(val entityId: Int, val items: MutableMap<String, Int> = mutableMapOf()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt new file mode 100644 index 000000000..d8bbe2d6f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt @@ -0,0 +1,64 @@ +package at.hannibal2.skyhanni.features.garden + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.TimeUtils +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class GardenVisitorTimer { + private val patternNextVisitor = Pattern.compile(" Next Visitor: §r§b(.*)") + private val patternVisitors = Pattern.compile("§b§lVisitors: §r§f\\((\\d)\\)") + private var render = "" + private var lastMillis = 0L + + @SubscribeEvent + fun onTick(event: TabListUpdateEvent) { + if (!isEnabled()) return + + var visitorsAmount = 0 + var millis = 15 * 60_000L + for (line in event.tabList) { + var matcher = patternNextVisitor.matcher(line) + if (matcher.matches()) { + val rawTime = matcher.group(1) + millis = TimeUtils.getMillis(rawTime) + } + + matcher = patternVisitors.matcher(line) + if (matcher.matches()) { + visitorsAmount = matcher.group(1).toInt() + } + } + + val diff = lastMillis - millis + if (diff == 0L) return + lastMillis = millis + + val extraSpeed = if (diff in 1001..10_000) { + val factor = diff / 1000 + "§f/§e" + TimeUtils.formatDuration(millis / factor) + } else "" + + val visitorLabel = if (visitorsAmount == 1) "Visitor" else "Visitors" + val formatDuration = TimeUtils.formatDuration(millis) + render = "§b$visitorsAmount $visitorLabel §f(Next in §e$formatDuration$extraSpeed§f)" + } + + @SubscribeEvent + fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + if (!isEnabled()) return + + SkyHanniMod.feature.garden.visitorTimerPos.renderString(render) + } + + private fun isEnabled() = + LorenzUtils.inSkyBlock && + SkyHanniMod.feature.garden.visitorTimerEnabled && + LorenzUtils.skyBlockIsland == IslandType.GARDEN +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 8fed472a0..3b9de73de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.events.HypixelTickEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -28,7 +27,7 @@ class TpsCounter { init { fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) { - if (!HyPixelData.skyBlock) return@fixedRateTimer + if (!LorenzUtils.inSkyBlock) return@fixedRateTimer if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer if (packetsFromLastSecond == 0) return@fixedRateTimer @@ -58,7 +57,7 @@ class TpsCounter { } } fixedRateTimer(name = "skyhanni-tps-counter-ticks", period = 50L) { - if (!HyPixelData.skyBlock) return@fixedRateTimer + if (!LorenzUtils.inSkyBlock) return@fixedRateTimer if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer if (hasPacketReceived) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index c4d5d311e..99c13a58c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper @@ -10,7 +9,7 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMini import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems -import at.hannibal2.skyhanni.utils.TabListUtils +import at.hannibal2.skyhanni.utils.TabListData import com.google.gson.JsonObject import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -49,7 +48,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { - if (!HyPixelData.skyBlock) return + if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return if (dirty) { @@ -59,7 +58,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { |
