summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-07-06 00:29:46 +1000
committerGitHub <noreply@github.com>2023-07-05 16:29:46 +0200
commit54331ff1364043630eaae020d6b56eb275eca9c1 (patch)
treeda88cdf6a084b33263d79da9e53def0a76913db3 /src/main/java/at/hannibal2/skyhanni/utils
parent0d284cf02fb68873212e5b394ebeb3509370cbfb (diff)
downloadskyhanni-54331ff1364043630eaae020d6b56eb275eca9c1.tar.gz
skyhanni-54331ff1364043630eaae020d6b56eb275eca9c1.tar.bz2
skyhanni-54331ff1364043630eaae020d6b56eb275eca9c1.zip
Merge pull request #297
* actually made it work * Merge branch 'beta' into outlines * fixing up merge * Merge branch 'beta' into outlines * merge conflicts
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt11
2 files changed, 24 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
index fd74c5d0c..1c663ac52 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock
+import at.hannibal2.skyhanni.utils.RenderUtils.outlineTopFace
import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson
import net.minecraft.client.Minecraft
import net.minecraftforge.client.event.RenderWorldLastEvent
@@ -27,6 +28,7 @@ class ParkourHelper(
var rainbowColor = false
var monochromeColor: Color = Color.WHITE
var lookAhead = 2
+ var outline = false
var showEverything = false
fun inParkour() = current != -1
@@ -92,11 +94,12 @@ class ParkourHelper(
val from = locations[shortCut.from].offsetCenter()
val to = locations[shortCut.to].offsetCenter()
event.draw3DLine(from, to, Color.RED, 3, false)
+ val textLocation = from.add(to.subtract(from).normalize())
+ event.drawDynamicText(textLocation.add(-0.5, 1.0, -0.5), "§cShortcut", 1.8)
val aabb = axisAlignedBB(locations[shortCut.to])
event.drawFilledBoundingBox(aabb, Color.RED, 1f)
- val textLocation = from.add(to.subtract(from).normalize())
- event.drawDynamicText(textLocation.add(-0.5, 1.0, -0.5), "§cShortcut", 1.8)
+ if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, true)
}
}
@@ -105,11 +108,14 @@ class ParkourHelper(
.take(lookAhead) + inProgressVec.map { it.second }) {
val isMovingPlatform = location !in locations
if (isMovingPlatform && showEverything) continue
- val aabb = if (isMovingPlatform) {
- axisAlignedBB(location).expandBlock()
- } else axisAlignedBB(location)
-
- event.drawFilledBoundingBox(aabb, colorForIndex(index), 1f)
+ if (isMovingPlatform) {
+ val aabb = axisAlignedBB(location).expandBlock()
+ event.drawFilledBoundingBox(aabb, colorForIndex(index), .6f)
+ } else {
+ val aabb = axisAlignedBB(location)
+ event.drawFilledBoundingBox(aabb, colorForIndex(index), 1f)
+ if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, true)
+ }
if (SkyHanniMod.feature.dev.waypoint.showPlatformNumber) {
if (!isMovingPlatform) {
event.drawString(location.offsetCenter().add(0, 1, 0), "§a§l$index", seeThroughBlocks = true)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index c4a4239c3..66cbb79b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -800,6 +800,17 @@ object RenderUtils {
drawFilledBoundingBox(aabb, c, alphaMultiplier, renderRelativeToCamera, drawVerticalBarriers, partialTicks)
}
+ fun RenderWorldLastEvent.outlineTopFace(boundingBox: AxisAlignedBB, lineWidth: Int, colour: Color, depth: Boolean) {
+ val cornerOne = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.minZ)
+ val cornerTwo = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ)
+ val cornerThree = LorenzVec(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ)
+ val cornerFour = LorenzVec(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ)
+ this.draw3DLine(cornerOne, cornerTwo, colour, lineWidth, depth)
+ this.draw3DLine(cornerTwo, cornerThree, colour, lineWidth, depth)
+ this.draw3DLine(cornerThree, cornerFour, colour, lineWidth, depth)
+ this.draw3DLine(cornerFour, cornerOne, colour, lineWidth, depth)
+ }
+
fun RenderWorldLastEvent.draw3DLine(
p1: LorenzVec, p2: LorenzVec, color: Color, lineWidth: Int, depth: Boolean, targetColor: Color? = null
) {