aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt63
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt2
5 files changed, 76 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 968b2e986..e4a9d682c 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -59,8 +59,9 @@ import at.hannibal2.skyhanni.features.mobs.AshfangMinisNametagHider
import at.hannibal2.skyhanni.features.mobs.MobHighlight
import at.hannibal2.skyhanni.features.nether.ashfang.*
import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper
-import at.hannibal2.skyhanni.features.rift.RiftTimer
+import at.hannibal2.skyhanni.features.rift.HighlightRiftGuide
import at.hannibal2.skyhanni.features.rift.RiftAPI
+import at.hannibal2.skyhanni.features.rift.RiftTimer
import at.hannibal2.skyhanni.features.slayer.*
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper
@@ -304,6 +305,7 @@ class SkyHanniMod {
loadModule(SlayerRngMeterDisplay())
loadModule(GhostCounter)
loadModule(RiftTimer())
+ loadModule(HighlightRiftGuide())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
index 581413ec0..0477920a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
@@ -11,9 +11,9 @@ public class RiftConfig {
@ConfigOption(name = "Rift Timer", desc = "")
@Accordion
@Expose
- public TimerConfig timer = new TimerConfig();
+ public RiftTimerConfig timer = new RiftTimerConfig();
- public static class TimerConfig {
+ public static class RiftTimerConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Show the remaining rift time, max time, percentage, and extra time changes.")
@@ -34,4 +34,9 @@ public class RiftConfig {
public Position timerPosition = new Position(10, 10, false, true);
}
+
+ @Expose
+ @ConfigOption(name = "Highlight Guide", desc = "Highlight things to do in the Rift Guide.")
+ @ConfigEditorBoolean
+ public boolean highlightGuide = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt
new file mode 100644
index 000000000..a8bf69fba
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/HighlightRiftGuide.kt
@@ -0,0 +1,63 @@
+package at.hannibal2.skyhanni.features.rift
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.InventoryOpenEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class HighlightRiftGuide {
+ private val config get() = SkyHanniMod.feature.rift
+ private var inInventory = false
+ private var highlightedItems = listOf<Int>()
+
+ @SubscribeEvent
+ fun onInventoryOpen(event: InventoryOpenEvent) {
+ inInventory = false
+
+ if (!isEnabled()) return
+
+ val inGuide = event.inventoryItems[40]?.getLore()?.let {
+ if (it.size == 1) {
+ it[0] == "§7To Rift Guide"
+ } else false
+ } ?: false
+ if (!inGuide) return
+
+ val highlightedItems = mutableListOf<Int>()
+ for ((slot, stack) in event.inventoryItems) {
+ val lore = stack.getLore()
+ if (lore.isNotEmpty()) {
+ if (lore.last() == "§8✖ Not completed yet!") {
+ highlightedItems.add(slot)
+ }
+ }
+ }
+ inInventory = true
+ this.highlightedItems = highlightedItems
+ }
+
+ @SubscribeEvent
+ fun onInventoryClose(event: InventoryCloseEvent) {
+ inInventory = false
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!isEnabled()) return
+ if (!inInventory) return
+
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ if (slot.slotIndex in highlightedItems) {
+ slot highlight LorenzColor.YELLOW
+ }
+ }
+ }
+
+ fun isEnabled() = RiftAPI.inRift() && config.highlightGuide
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt
index c95393ac2..6fe16c981 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt
@@ -1,7 +1,6 @@
package at.hannibal2.skyhanni.features.rift
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -9,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.TimeUtils
+import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class RiftTimer {
@@ -19,7 +19,7 @@ class RiftTimer {
private val changes = mutableMapOf<Long, String>()
@SubscribeEvent
- fun onConfigLoad(event: ConfigLoadEvent) {
+ fun onJoinWorld(ignored: WorldEvent.Load) {
display = emptyList()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 575a2e4fe..ccaeee6ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -40,7 +40,7 @@ object CopyErrorCommand {
Minecraft.getMinecraft().thePlayer ?: throw Error(message, error)
val pair = error.stackTrace[0].let { it.fileName to it.lineNumber }
-// if (cache.getIfPresent(pair) != null) return
+ if (cache.getIfPresent(pair) != null) return
cache.put(pair, Unit)
val fullStackTrace = error.getExactStackTrace(true).joinToString("\n")