Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Burrow rotate mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna5ama committed Sep 11, 2023
1 parent a2219d4 commit b99c983
Showing 1 changed file with 57 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import dev.luna5ama.trollhack.module.modules.movement.AutoCenter
import dev.luna5ama.trollhack.util.EntityUtils.betterPosition
import dev.luna5ama.trollhack.util.EntityUtils.isFakeOrSelf
import dev.luna5ama.trollhack.util.EntityUtils.spoofSneak
import dev.luna5ama.trollhack.util.and
import dev.luna5ama.trollhack.util.atValue
import dev.luna5ama.trollhack.util.combat.CrystalUtils
import dev.luna5ama.trollhack.util.interfaces.DisplayEnum
Expand Down Expand Up @@ -46,6 +47,7 @@ import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import kotlin.math.abs
import kotlin.random.Random

internal object Burrow : Module(
name = "Burrow",
Expand All @@ -59,7 +61,15 @@ internal object Burrow : Module(
private val timer by setting("Timer", 4.0f, 1.0f..8.0f, 0.5f, mode0.atValue(Mode.JUMP))
private val breakCrystal by setting("Break Crystal", true)
private val autoCenter by setting("Auto Center", true)
private val rubberY by setting("Rubber Y", 20.0f, -20.0f..20.0f, 0.5f, mode0.atValue(Mode.JUMP))
private val setBackMode by setting("Set Back Mode", SetBackMode.MOVE)
private val rotatePackets by setting("Rotate Packets", 20, 0..100, 1, ::setBackMode.atValue(SetBackMode.ROTATE))
private val rubberY by setting(
"Rubber Y",
20.0f,
-20.0f..20.0f,
0.5f,
::setBackMode.atValue(SetBackMode.MOVE) and mode0.atValue(Mode.JUMP)
)
private val timeoutTicks by setting("Timeout Ticks", 10, 0..100, 5, mode0.notAtValue(Mode.ANVIL))

private enum class BurrowBlock(override val displayName: String, val block: Block) : DisplayEnum {
Expand All @@ -74,6 +84,11 @@ internal object Burrow : Module(
ANVIL("Anvil")
}

private enum class SetBackMode(override val displayName: String) : DisplayEnum {
MOVE("Move"),
ROTATE("Rotate"),
}

var override: BlockPos? = null
private var postBlockPos: BlockPos? = null
private var timeout: Long = 0L
Expand Down Expand Up @@ -222,33 +237,48 @@ internal object Burrow : Module(

placeBlock(it, blockPos)

connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 1.2426308013947485,
position.z,
false
)
)
if (velocityTime > System.currentTimeMillis()) {
connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 3.3400880035762786,
position.z,
false
when (setBackMode) {
SetBackMode.MOVE -> {
connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 1.2426308013947485,
position.z,
false
)
)
)
connection.sendPacket(CPacketPlayer.Position(position.x, position.y - 1.0, position.z, false))
} else {
connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 2.3400880035762786,
position.z,
false
)
)
if (velocityTime > System.currentTimeMillis()) {
connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 3.3400880035762786,
position.z,
false
)
)
connection.sendPacket(CPacketPlayer.Position(position.x, position.y - 1.0, position.z, false))
} else {
connection.sendPacket(
CPacketPlayer.Position(
position.x,
position.y + 2.3400880035762786,
position.z,
false
)
)
}
}
SetBackMode.ROTATE -> {
repeat(rotatePackets) {
connection.sendPacket(
CPacketPlayer.Rotation(
Random.nextDouble(-360.0, 360.0).toFloat(),
Random.nextDouble(-90.0, 90.0).toFloat(),
false
)
)
}
}
}
}

Expand Down

0 comments on commit b99c983

Please sign in to comment.