aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt (renamed from src/main/java/at/hannibal2/skyhanni/test/WaypointSaver.kt)28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/WaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
index cc3ae7e9f..1020a5a9c 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/WaypointSaver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
@@ -1,8 +1,9 @@
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.*
+import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox
+import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.client.gui.inventory.GuiEditSign
@@ -12,10 +13,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import org.lwjgl.input.Keyboard
-class WaypointSaver {
+class ParkourWaypointSaver {
private val config get() = SkyHanniMod.feature.dev.waypoint
private var timeLastSaved: Long = 0
private var locations = mutableListOf<LorenzVec>()
+ private var parkourHelper: ParkourHelper? = null
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
@@ -31,7 +33,7 @@ class WaypointSaver {
val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey()
if (config.deleteKey == key) {
locations = locations.dropLast(1).toMutableList()
- locations.copyLocations()
+ update()
}
if (config.saveKey == key) {
val newLocation = LocationUtils.playerLocation().roundLocation()
@@ -39,7 +41,15 @@ class WaypointSaver {
if (newLocation == locations.last()) return
}
locations.add(newLocation)
- locations.copyLocations()
+ update()
+ }
+ }
+
+ private fun update() {
+ locations.copyLocations()
+ parkourHelper = ParkourHelper(locations, emptyList()).also {
+ it.showEverything = true
+ it.rainbowColor = true
}
}
@@ -58,8 +68,14 @@ class WaypointSaver {
@SubscribeEvent
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
- for (location in locations) {
- event.drawWaypointFilled(location, LorenzColor.GREEN.toColor())
+
+ if (locations.size > 2) {
+ parkourHelper?.render(event)
+ } else {
+ for (location in locations) {
+ val aabb = location.boundingToOffset(1.0, 1.0, 1.0).expandBlock()
+ event.drawFilledBoundingBox(aabb, LorenzColor.GREEN.toColor(), 1f)
+ }
}
}
} \ No newline at end of file