Conversation
Just used this to copy my desc
src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningProfitTrackerConfig.kt
Outdated
Show resolved
Hide resolved
|
I have detected some issues with your pull request: Body issues: Please fix these issues. For the correct format, refer to the pull request template. |
13 Detekt FailuresRules flagged (4): Rule violations
|
| "§eAlways On: Timer keeps running even if you stop mining." | ||
| ) | ||
| @Accordion | ||
| val perTrackerConfig: IndividualItemTrackerConfig = IndividualItemTrackerConfig() |
There was a problem hiding this comment.
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() }, |
There was a problem hiding this comment.
Add config option for holding mining tool
|
|
||
| // Associated data when hovering over tracker lines. | ||
| data class Data( | ||
| @Expose var totalBlocksMined: Long = 0L |
There was a problem hiding this comment.
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() |
| ) | ||
| } | ||
|
|
||
| fun onMiningIsland(): Boolean { |
There was a problem hiding this comment.
Already exists: IslandTypeTags.CUSTOM_MINING.inAny()
|
|
||
|
|
||
| // BlockType category control. All is for any minable quantity. | ||
| @HandleEvent |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Use BucketedItemTracker as your tracker class instead of doing this
| if (!config.enabled) return | ||
|
|
||
| if (event.source == ItemAddManager.Source.COMMAND) { | ||
| if (config.enabled) return |
There was a problem hiding this comment.
this looks wrong. accidentally inverted? why would the command only work while disabled?
| } | ||
|
|
||
| fun onMiningIsland(): Boolean { | ||
| return MiningApi.inDwarvenMines or MiningApi.inGlaciteArea() or |
There was a problem hiding this comment.
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>> |
There was a problem hiding this comment.
variable names start with lower case letter
| @@ -0,0 +1,334 @@ | |||
| @file:Suppress("DuplicatedCode") | |||
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
do not use the full path name. use the import properly
| return | ||
| } | ||
|
|
||
| DelayedRun.runDelayed(500.milliseconds) { |
There was a problem hiding this comment.
why 500ms? please add a comment in code to explain why
|
|
||
| @HandleEvent | ||
| fun onRepoReload(event: RepositoryReloadEvent) { | ||
| BlockTypes = event.getConstant<MiningJson>("Mining").categories ?: emptyMap() |
There was a problem hiding this comment.
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 |
| import kotlin.time.Duration.Companion.milliseconds | ||
|
|
||
|
|
||
| typealias CategoryName = String |
| var flowstatePersonalBest = 0 | ||
|
|
||
| @Expose | ||
| var miningTracker: at.hannibal2.skyhanni.features.mining.tracker.MiningTracker.Data = |
There was a problem hiding this comment.
remove redundant import here
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