aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-09-13 20:23:57 +0200
committerGitHub <noreply@github.com>2024-09-13 20:23:57 +0200
commit5e01624dcc315a2bf7665fc808b1113fa4c9e0d8 (patch)
tree6a97c6970fecd2d517eac80c1aa391eee42addd2 /src/main/java/at/hannibal2/skyhanni/test
parent691d2551cf722b76c1894c814d1f6c2e98fe17d6 (diff)
downloadskyhanni-5e01624dcc315a2bf7665fc808b1113fa4c9e0d8.tar.gz
skyhanni-5e01624dcc315a2bf7665fc808b1113fa4c9e0d8.tar.bz2
skyhanni-5e01624dcc315a2bf7665fc808b1113fa4c9e0d8.zip
Feature: Graphs Pathfinding (#2468)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt19
2 files changed, 23 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
index e720b57ca..81a85283e 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/GraphEditor.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandGraphs
import at.hannibal2.skyhanni.data.model.Graph
import at.hannibal2.skyhanni.data.model.GraphNode
import at.hannibal2.skyhanni.data.model.GraphNodeTag
@@ -39,6 +40,7 @@ import at.hannibal2.skyhanni.utils.renderables.buildSearchableScrollable
import at.hannibal2.skyhanni.utils.renderables.toSearchable
import kotlinx.coroutines.runBlocking
import net.minecraft.client.settings.KeyBinding
+import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
import java.awt.Color
@@ -104,12 +106,12 @@ object GraphEditor {
private val edgeDijkstraColor = LorenzColor.DARK_BLUE.addOpacity(150)
private val edgeSelectedColor = LorenzColor.DARK_RED.addOpacity(150)
- val scrollValue = ScrollValue()
- val textInput = TextInput()
- var nodesDisplay = emptyList<Searchable>()
+ private val scrollValue = ScrollValue()
+ private val textInput = TextInput()
+ private var nodesDisplay = emptyList<Searchable>()
var lastUpdate = SimpleTimeMark.farPast()
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
fun onRender(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return
nodes.forEach { event.drawNode(it) }
@@ -196,7 +198,7 @@ object GraphEditor {
val list = getNodeNames()
val size = list.size
addString("§eGraph Nodes: $size")
- val height = (size * 10).coerceAtMost(150)
+ val height = (size * 10).coerceAtMost(250)
if (list.isNotEmpty()) {
add(list.buildSearchableScrollable(height, textInput, scrollValue, velocity = 10.0))
}
@@ -537,7 +539,11 @@ object GraphEditor {
ChatUtils.chat("Copied nothing since the graph is empty.")
return
}
- val json = compileGraph().toJson()
+ val compileGraph = compileGraph()
+ if (config.useAsIslandArea) {
+ IslandGraphs.setNewGraph(compileGraph)
+ }
+ val json = compileGraph.toJson()
OSUtils.copyToClipboard(json)
ChatUtils.chat("Copied Graph to Clipboard.")
if (config.showsStats) {
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index d3a5e0bce..9e95df881 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.core.config.Position
import at.hannibal2.skyhanni.data.HypixelData
+import at.hannibal2.skyhanni.data.IslandGraphs
import at.hannibal2.skyhanni.events.GuiKeyPressEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -120,12 +121,17 @@ object SkyHanniDebugsAndTests {
val x = args[0].toDouble()
val y = args[1].toDouble()
val z = args[2].toDouble()
- testLocation = LorenzVec(x, y, z)
+ val location = LorenzVec(x, y, z)
+ testLocation = location
+ if (args.getOrNull(3) == "pathfind") {
+ IslandGraphs.pathFind(location)
+ }
ChatUtils.chat("set test waypoint")
}
fun testCommand(args: Array<String>) {
- SoundUtils.playBeepSound()
+
+
// val a = Thread { OSUtils.copyToClipboard("123") }
// val b = Thread { OSUtils.copyToClipboard("456") }
// a.start()
@@ -509,8 +515,7 @@ object SkyHanniDebugsAndTests {
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!LorenzUtils.inSkyBlock) return
- @Suppress("ConstantConditionIf")
- if (false) {
+ @Suppress("ConstantConditionIf") if (false) {
itemRenderDebug()
}
@@ -545,8 +550,7 @@ object SkyHanniDebugsAndTests {
@SubscribeEvent
fun onGuiRenderChestGuiOverlayRender(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
- @Suppress("ConstantConditionIf")
- if (false) {
+ @Suppress("ConstantConditionIf") if (false) {
dragAbleTest()
}
}
@@ -594,8 +598,7 @@ object SkyHanniDebugsAndTests {
}.editCopy {
this.add(
0,
- generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) }
- .toList(),
+ generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) }.toList(),
)
}
config.debugItemPos.renderRenderables(