Skip to content

Commit

Permalink
idk, that might just be it, tired of debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
commandblock2 committed Apr 17, 2020
1 parent 0969648 commit 171f17c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,26 @@ class ReachAura : Module()

// PPS:packets per sec
private val pPS = IntegerValue("PPS", 18, 0, 50)
private val disableOnReset = BoolValue("DisableOnReset", false)
val pulse = BoolValue("Pulse",true)

private val rangeValue = FloatValue("Range", 20f, 1f, 100f)
private val tpDistanceValue = FloatValue("TpDistance", 4.0f, 0.5f, 10.0f)
private val stopAtDistance = FloatValue("StopAtDistance", 0.0f, 0.0f, 6.0f)

private val pathFindingMode = ListValue("PathFindingMode", arrayOf("Simple",
"NaiveAstarGround", "NaiveAstarFly"), "NaiveAstarFly")
private val rayCastLessNode = BoolValue("RayCastLessNode", true)

private val targetModeValue = ListValue("TargetMode", arrayOf("Single", "Switch", "Multi"), "Switch")
private val priorityValue = ListValue("Priority", arrayOf("Health", "Distance", "Direction", "LivingTime"), "Distance")

private val renderPath = BoolValue("RenderPath", true)
private val astarTimeout = IntegerValue("AstarTimeout", 20, 10, 1000)


private val rescheduleOnMove = BoolValue("rescheduleOnMove", true)
private val rayCastLessNode = BoolValue("RayCastLessNode", true)
private val astarTimeout = IntegerValue("AstarTimeout", 20, 10, 1000)
private val disableOnReset = BoolValue("DisableOnReset", false)
private val pretend = BoolValue("Pretend", false)
val pulse = BoolValue("Pulse",true)

private var packets = 0.0
private var lastPacketPos: Vec3? = null
Expand Down Expand Up @@ -252,6 +254,8 @@ class ReachAura : Module()
@EventTarget
fun onTick(event: TickEvent)
{
var scheduled = false

if (skipTick > 0)
{
skipTick--
Expand Down Expand Up @@ -286,11 +290,25 @@ class ReachAura : Module()
if (targetModeValue.get() != "Single")
targetList.removeAt(0)

if (runAttack() && targetModeValue.get() != "Multi") //Short circuit exists in && ?
returnInitial(lastTargetPos!!)
schedule()
scheduled = true
}

packets += (pPS.get() / 20.0)

val begin = reachAuraQueue.first()
if (!scheduled && pulse.get() && rescheduleOnMove.get() && packets > reachAuraQueue.size && reachAuraQueue.size > 0)
if (begin is C03PacketPlayer.C04PacketPlayerPosition && !(begin.x.isNaN() || begin.y.isNaN() || begin.z.isNaN()) &&
(mc.thePlayer.getDistance(begin.positionX,begin.positionY,begin.z) > tpDistanceValue.get() || //if the player moves too much
target != null && lastPacketPos != null &&
target!!.getDistance(lastTargetPos!!.xCoord,lastTargetPos!!.yCoord,lastTargetPos!!.zCoord) > stopAtDistance.get()) //or the target moves too much
)
{
// reschedule
reachAuraQueue.clear()
schedule()
}

while (packets > 0 && reachAuraQueue.size > 0 && (!pulse.get() || packets > reachAuraQueue.size))
{
val first = reachAuraQueue.first()
Expand All @@ -309,6 +327,12 @@ class ReachAura : Module()
}
}

private fun schedule()
{
if (runAttack() && targetModeValue.get() != "Multi") //Short circuit exists in && ?
returnInitial(lastTargetPos!!)
}

private fun pathFindToCoord(fromX: Double, fromY: Double, fromZ: Double,
toX: Double, toY: Double, toZ: Double, fullPath: Boolean = false): MutableList<Vector3d>?
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,20 @@ object BlockUtils : MinecraftInstance() {
for (z in MathHelper.floor_double(axisAlignedBB.minZ) until
MathHelper.floor_double(axisAlignedBB.maxZ) + 1)
{
val blockPos = BlockPos(x.toDouble(), axisAlignedBB.minY, z.toDouble())
val block = getBlock(blockPos)

if (collidable.collideBlock(block))
for (y in MathHelper.floor_double(axisAlignedBB.minY) until
MathHelper.floor_double(axisAlignedBB.maxY) + 1)
{
val boundingBox = block?.getCollisionBoundingBox(mc.theWorld, blockPos, getState(blockPos))
?: continue
val blockPos = BlockPos(x.toDouble(), y.toDouble(), z.toDouble())
val block = getBlock(blockPos)

if (mc.thePlayer.entityBoundingBox.intersectsWith(boundingBox))
return true
if (collidable.collideBlock(block))
{
val boundingBox = block?.getCollisionBoundingBox(mc.theWorld, blockPos, getState(blockPos))
?: continue

if (mc.thePlayer.entityBoundingBox.intersectsWith(boundingBox))
return true
}
}
}
}
Expand Down

0 comments on commit 171f17c

Please sign in to comment.