Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Mining Commissions Blocks Color #1701

Merged
merged 14 commits into from
May 7, 2024
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ import at.hannibal2.skyhanni.features.mining.DeepCavernsGuide
import at.hannibal2.skyhanni.features.mining.GoldenGoblinHighlight
import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs
import at.hannibal2.skyhanni.features.mining.KingTalismanHelper
import at.hannibal2.skyhanni.features.mining.MiningCommissionsBlocksColor
import at.hannibal2.skyhanni.features.mining.MiningNotifications
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsNamesInCore
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsWalls
Expand Down Expand Up @@ -812,6 +813,7 @@ class SkyHanniMod {
loadModule(ShowItemUuid())
loadModule(FrozenTreasureTracker)
loadModule(MiningEventDisplay)
loadModule(MiningCommissionsBlocksColor)
loadModule(SlayerRngMeterDisplay())
loadModule(GhostCounter)
loadModule(RiftTimer())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package at.hannibal2.skyhanni.config.features.mining;

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.utils.LorenzColor;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import io.github.notenoughupdates.moulconfig.observer.Property;

public class CommissionsBlocksColorConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Change the color of ores on mining island depending on your active commissions. Gray out irrelevant ores.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = false;

@Expose
@ConfigOption(name = "Sneak Toggle", desc = "Quickly disable or enable this feature via sneaking.")
@ConfigEditorBoolean
public Property<Boolean> sneakQuickToggle = Property.of(false);

@Expose
@ConfigOption(name = "Color", desc = "Change the highlight color.")
@ConfigEditorDropdown
public Property<LorenzColor> color = Property.of(LorenzColor.GREEN);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public class MiningConfig {
@Accordion
public MiningNotificationsConfig notifications = new MiningNotificationsConfig();

@Expose
@ConfigOption(name = "Commissions Blocks Color", desc = "")
@Accordion
public CommissionsBlocksColorConfig commissionsBlocksColor = new CommissionsBlocksColorConfig();

@Expose
@ConfigOption(name = "Highlight Commission Mobs", desc = "Highlight Mobs that are part of active commissions.")
@ConfigEditorBoolean
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/MiningAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import kotlin.time.Duration.Companion.seconds
object MiningAPI {

private val group = RepoPattern.group("data.miningapi")
private val glaciteAreaPattern by group.pattern("area.glacite", "Glacite Tunnels")
private val glaciteAreaPattern by group.pattern("area.glacite", "Glacite Tunnels|Glacite Lake")
val coldReset by group.pattern(
"cold.reset",
"§6The warmth of the campfire reduced your §r§b❄ Cold §r§6to §r§a0§r§6!|§c ☠ §r§7You froze to death§r§7."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object GriffinBurrowParticleFinder {
if (particleType != null) {

val location = packet.toLorenzVec().toBlockPos().down().toLorenzVec()
if (recentlyDugParticleBurrows.contains(location)) return
if (location in recentlyDugParticleBurrows) return
val burrow = burrows.getOrPut(location) { Burrow(location) }

when (particleType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class HighlightMiningCommissionMobs {

private val config get() = SkyHanniMod.feature.mining
// TODO Commissin API
private var active = listOf<MobType>()

// TODO Commissin API
enum class MobType(val commissionName: String, val isMob: (EntityLivingBase) -> Boolean) {

// Dwarven Mines
Expand All @@ -43,6 +45,8 @@ class HighlightMiningCommissionMobs {
it is EntitySlime && (it.hasMaxHealth(5_000) || it.hasMaxHealth(10_000) || it.hasMaxHealth(25_000))
}),
CH_GOBLIN_SLAYER("Goblin Slayer", { it.name == "Weakling " }),

// new commissions
;
}

Expand All @@ -67,6 +71,7 @@ class HighlightMiningCommissionMobs {
fun onTabListUpdate(event: TabListUpdateEvent) {
if (!isEnabled()) return

// TODO Commissin API
MobType.entries.filter { type ->
event.tabList.findLast { line -> line.removeColor().trim().startsWith(type.commissionName) }
?.let { !it.endsWith("§aDONE") }
Expand Down
Loading
Loading