Skip to content

Feature: Mining Profit Tracker#5260

Open
mrid-12 wants to merge 10 commits intohannibal002:betafrom
mrid-12:beta
Open

Feature: Mining Profit Tracker#5260
mrid-12 wants to merge 10 commits intohannibal002:betafrom
mrid-12:beta

Conversation

@mrid-12
Copy link

@mrid-12 mrid-12 commented Feb 20, 2026

Dependencies

What

Designed a new mining profit tracker! It activates only when on The End, Crimson Isle, Glacite Tunnels/Shafts, Crystal Hollows and Dwarven Mines.
It works functionally similar to the fishing profit tracker, and includes some inspiration from the existing Gemstone Profit tracker.

Images

Changelog New Features

  • Added Mining Profit Tracker. - mrid12
    • Category changer matching to Skyblock's block types and some common mob drops in misc materials.
    • Reads data directly from sack updates and no chat messages (even Suspicious Scrap/ Flawed gems from Pristine).
    • Tracks blocks mined without spread, and estimated profit per block (when hovering over Session Profit).
    • Allows users to toggle the tier of gemstone they would like to craft for profit(s).

@github-actions github-actions bot added Detekt Has detekt problem and removed Fails Multi-Version A pr that fails build multiversion labels Feb 20, 2026
@mrid-12 mrid-12 marked this pull request as ready for review February 20, 2026 06:05
@github-actions github-actions bot added the Wrong Title/Changelog There is an error in the title or changelog label Feb 20, 2026
@github-actions
Copy link

I have detected some issues with your pull request:

Body issues:
Change should end with a full stop in text: Mining Profit Tracker

Please fix these issues. For the correct format, refer to the pull request template.

@github-actions github-actions bot removed the Wrong Title/Changelog There is an error in the title or changelog label Feb 20, 2026
@github-actions
Copy link

13 Detekt Failures

Rules flagged (4): SpacingAroundOperators, SpacingAroundCurly, MaxLineLength, UnusedPrivateProperty
Files flagged (2): MiningTracker.kt, MiningProfitTrackerConfig.kt

Rule violations

@github-actions github-actions bot removed the Detekt Has detekt problem label Feb 20, 2026
"§eAlways On: Timer keeps running even if you stop mining."
)
@Accordion
val perTrackerConfig: IndividualItemTrackerConfig = IndividualItemTrackerConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the default config options for the tracker, not what the name/description says. You can control timeout in the way that you have described, but that is by setting customItemTracker to true on tracker initialization and then writing a custom control class for the tracker.

RenderDisplayHelper(
outsideInventory = true,
inOwnInventory = true,
condition = { config.enabled && SkyBlockUtils.inSkyBlock && onMiningIsland() },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add config option for holding mining tool


// Associated data when hovering over tracker lines.
data class Data(
@Expose var totalBlocksMined: Long = 0L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool if this was split into block types


// Description when hovering over the above line
override fun getCoinDescription(item: TrackedItem): List<String> {
val mobKillCoinsFormat = item.totalAmount.shortFormat()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

)
}

fun onMiningIsland(): Boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already exists: IslandTypeTags.CUSTOM_MINING.inAny()



// BlockType category control. All is for any minable quantity.
@HandleEvent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to fix OreMinedEvent in mining api instead

BlockTypes = event.getConstant<MiningJson>("Mining").categories ?: emptyMap()
}

private fun MutableList<Searchable>.addCategories(data: Data): (NeuInternalName) -> Boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use BucketedItemTracker as your tracker class instead of doing this

if (!config.enabled) return

if (event.source == ItemAddManager.Source.COMMAND) {
if (config.enabled) return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks wrong. accidentally inverted? why would the command only work while disabled?

}

fun onMiningIsland(): Boolean {
return MiningApi.inDwarvenMines or MiningApi.inGlaciteArea() or
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of bitwise or, use kotlins ||

val config get() = SkyHanniMod.feature.mining.miningTracker

// Block Types; see [https://github.com/hannibal002/SkyHanni-REPO/blob/main/constants/Mining.json]
private var BlockTypes: Map<String, List<NeuInternalName>>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable names start with lower case letter

@@ -0,0 +1,334 @@
@file:Suppress("DuplicatedCode")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use this. if we actually have duplicate code, we should try to fix it instead of intentionally writing duplicate code

fun onBlockClick(event: BlockClickEvent) {
if (!config.enabled || !onMiningIsland()) return
tracker.update()
if (event.clickType != at.hannibal2.skyhanni.data.ClickType.LEFT_CLICK) return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use the full path name. use the import properly

return
}

DelayedRun.runDelayed(500.milliseconds) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 500ms? please add a comment in code to explain why


@HandleEvent
fun onRepoReload(event: RepositoryReloadEvent) {
BlockTypes = event.getConstant<MiningJson>("Mining").categories ?: emptyMap()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

categories can not be null. either it exists, or it throws an error (that then gets handled properly y the event handler and error manager). remove the ?: emptyMap() part at the end

import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import net.minecraft.world.level.block.Blocks
import kotlin.collections.orEmpty
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

import kotlin.time.Duration.Companion.milliseconds


typealias CategoryName = String
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not have a benefit imo

var flowstatePersonalBest = 0

@Expose
var miningTracker: at.hannibal2.skyhanni.features.mining.tracker.MiningTracker.Data =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove redundant import here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants