From bfe43b7ebffab551740d32cf919db27504d27ffb Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:12:24 +0200 Subject: Feature: Mineshaft Pity Display + OreMinedEvent (#1655) Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com> Co-authored-by: Thunderblade73 Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/test/SkyHanniDebugsAndTests.kt | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/test') diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 4e1c51de3..ce1b5eea7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.ConfigManager @@ -13,10 +14,14 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.events.mining.OreMinedEvent import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.getBazaarData +import at.hannibal2.skyhanni.features.mining.OreBlock import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.BlockUtils +import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils @@ -504,13 +509,27 @@ object SkyHanniDebugsAndTests { itemRenderDebug() } - if (Minecraft.getMinecraft().gameSettings.showDebugInfo && debugConfig.currentAreaDebug) { - config.debugLocationPos.renderString( - "Current Area: ${HypixelData.skyBlockArea}", - posLabel = "SkyBlock Area (Debug)", - ) + if (Minecraft.getMinecraft().gameSettings.showDebugInfo) { + if (debugConfig.currentAreaDebug) { + config.debugLocationPos.renderString( + "Current Area: ${HypixelData.skyBlockArea}", + posLabel = "SkyBlock Area (Debug)", + ) + } + + if (debugConfig.raytracedOreblock) { + BlockUtils.getBlockLookingAt(50.0)?.let { pos -> + OreBlock.getByStateOrNull(pos.getBlockStateAt())?.let { ore -> + config.debugOrePos.renderString( + "Looking at: ${ore.name} (${pos.toCleanString()})", + posLabel = "OreBlock" + ) + } + } + } } + if (!debugConfig.enabled) return if (displayLine.isNotEmpty()) { @@ -549,6 +568,14 @@ object SkyHanniDebugsAndTests { ) } + @HandleEvent(onlyOnSkyblock = true) + fun onOreMined(event: OreMinedEvent) { + if (!debugConfig.oreEventMessages) return + val originalOre = event.originalOre + val extraBlocks = event.extraBlocks.map { "${it.key.name}: ${it.value}" } + ChatUtils.debug("Mined: $originalOre (${extraBlocks.joinToString()})") + } + @SubscribeEvent fun onReceiveParticle(event: ReceiveParticleEvent) { // val particleType = event.type -- cgit