mirror of https://github.com/kami-blue/client
enh: Option to show Baritone path on Radar (#2170)
Co-authored-by: lv <~@l1v.in>
This commit is contained in:
parent
936df66e77
commit
8f74136c6f
|
@ -1,9 +1,15 @@
|
||||||
package org.kamiblue.client.module.modules.client
|
package org.kamiblue.client.module.modules.client
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
import org.kamiblue.client.event.events.BaritoneSettingsInitEvent
|
import org.kamiblue.client.event.events.BaritoneSettingsInitEvent
|
||||||
|
import org.kamiblue.client.event.events.RenderRadarEvent
|
||||||
import org.kamiblue.client.module.Category
|
import org.kamiblue.client.module.Category
|
||||||
import org.kamiblue.client.module.Module
|
import org.kamiblue.client.module.Module
|
||||||
import org.kamiblue.client.util.BaritoneUtils
|
import org.kamiblue.client.util.BaritoneUtils
|
||||||
|
import org.kamiblue.client.util.color.ColorHolder
|
||||||
|
import org.kamiblue.client.util.graphics.RenderUtils2D
|
||||||
|
import org.kamiblue.client.util.math.Vec2d
|
||||||
|
import org.kamiblue.client.util.threads.safeListener
|
||||||
import org.kamiblue.event.listener.listener
|
import org.kamiblue.event.listener.listener
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,10 +22,12 @@ internal object Baritone : Module(
|
||||||
showOnArray = false,
|
showOnArray = false,
|
||||||
alwaysEnabled = true
|
alwaysEnabled = true
|
||||||
) {
|
) {
|
||||||
|
private val showOnRadar by setting("Show Path on Radar", true, description = "Show the current path on radar.")
|
||||||
|
private val color by setting("Path Color", ColorHolder(32, 250, 32), visibility = { showOnRadar })
|
||||||
private val allowBreak = setting("Allow Break", true)
|
private val allowBreak = setting("Allow Break", true)
|
||||||
private val allowSprint = setting("Allow Sprint", true)
|
private val allowSprint = setting("Allow Sprint", true)
|
||||||
private val allowPlace = setting("Allow Place", true)
|
private val allowPlace = setting("Allow Place", true)
|
||||||
val allowInventory = setting("Allow Inventory", false)
|
private val allowInventory = setting("Allow Inventory", false)
|
||||||
private val freeLook = setting("Free Look", true)
|
private val freeLook = setting("Free Look", true)
|
||||||
private val allowDownwardTunneling = setting("Downward Tunneling", true)
|
private val allowDownwardTunneling = setting("Downward Tunneling", true)
|
||||||
private val allowParkour = setting("Allow Parkour", true)
|
private val allowParkour = setting("Allow Parkour", true)
|
||||||
|
@ -38,6 +46,29 @@ internal object Baritone : Module(
|
||||||
listener<BaritoneSettingsInitEvent> {
|
listener<BaritoneSettingsInitEvent> {
|
||||||
sync()
|
sync()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
safeListener<RenderRadarEvent> {
|
||||||
|
if (!showOnRadar || !BaritoneUtils.isPathing) return@safeListener
|
||||||
|
|
||||||
|
val path = BaritoneUtils.primary?.pathingBehavior?.path ?: return@safeListener
|
||||||
|
|
||||||
|
if (!path.isPresent) return@safeListener
|
||||||
|
|
||||||
|
val playerOffset = Vec2d(player.position.x.toDouble(), player.position.z.toDouble())
|
||||||
|
|
||||||
|
for (movement in path.get().movements()) {
|
||||||
|
val positionFrom = getPos(movement.src, playerOffset, it.scale)
|
||||||
|
val positionTo = getPos(movement.dest, playerOffset, it.scale)
|
||||||
|
|
||||||
|
if (positionFrom.length() < it.radius && positionTo.length() < it.radius) {
|
||||||
|
RenderUtils2D.drawLine(it.vertexHelper, positionFrom, positionTo, color = color, lineWidth = 3f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getPos(blockPos: BlockPos, playerOffset: Vec2d, scale: Float): Vec2d {
|
||||||
|
return Vec2d(blockPos.x.toDouble(), blockPos.z.toDouble()).minus(playerOffset).div(scale.toDouble())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sync() {
|
private fun sync() {
|
||||||
|
|
Loading…
Reference in New Issue