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

Commit

Permalink
movement and stuff
Browse files Browse the repository at this point in the history
fixed the lock aim and made better movement
  • Loading branch information
MqsterMorro committed Apr 16, 2024
1 parent 8e94fb1 commit da61519
Show file tree
Hide file tree
Showing 11 changed files with 284 additions and 137 deletions.
15 changes: 15 additions & 0 deletions src/main/kotlin/dev/macrohq/swiftslayer/command/DequeCommand.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.macrohq.swiftslayer.command;

import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
import dev.macrohq.swiftslayer.util.LockRotationUtil;


@Command("deque")
public class DequeCommand{

@SubCommand
public fun pri() {
System.out.println(LockRotationUtil.getInstance().lastYaws.toString());
}
}
62 changes: 53 additions & 9 deletions src/main/kotlin/dev/macrohq/swiftslayer/command/DirectionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package dev.macrohq.swiftslayer.command

import cc.polyfrost.oneconfig.utils.commands.annotations.Command
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand
import dev.macrohq.swiftslayer.util.*
import dev.macrohq.swiftslayer.util.BlockUtil
import dev.macrohq.swiftslayer.util.PathingUtil
import dev.macrohq.swiftslayer.util.RenderUtil
import net.minecraft.client.Minecraft
import net.minecraft.util.BlockPos
import net.minecraftforge.client.event.RenderWorldLastEvent
Expand All @@ -13,36 +15,78 @@ import java.awt.Color
class DirectionTest {



var mc: Minecraft = Minecraft.getMinecraft()
@SubCommand
private fun direction(lock: Boolean) {
//gameSettings.keyBindSneak.setPressed(true)

blockPos = BlockUtil.getBlocks( SlayerUtil.getFakeBoss()!!.position.add(0, -1, 0), 2, 1, 2)[0]

enabled = lock
PathingUtil.goto(blockPos.add(0, -1, 0))
if(blockPoss.isNotEmpty()) {
PathingUtil.goto(blockPoss[0])
}

}


@SubscribeEvent
fun onWorldRender(event: RenderWorldLastEvent) {
if(enabled) {

// RenderUtil.drawBox(event, BlockUtil.getCornerBlocks(SlayerUtil.getFakeBoss()!!.position, 2, 1, 2).first, Color.GREEN, true)
// RenderUtil.drawBox(event, BlockUtil.getCornerBlocks(SlayerUtil.getFakeBoss()!!.position, 2, 1, 2).first, Color.GREEN, true)
// RenderUtil.drawBox(event, BlockUtil.getCornerBlocks(SlayerUtil.getFakeBoss()!!.position, 2, 1, 2).second, Color.GREEN, true)
if(BlockUtil.getBlocks( SlayerUtil.getFakeBoss()!!.position.add(0, -1, 0), 2, 1, 2).isEmpty().not())
for(block: BlockPos in BlockUtil.getBlocks( SlayerUtil.getFakeBoss()!!.position.add(0, -1, 0), 2, 1, 2)) {

// draw all columns that are higher than 4 blocks
/* if(BlockUtil.getColumns( mc.thePlayer.position.add(0, -1, 0), 4, 5, 4, 4).isEmpty().not()) {
for(block: BlockPos in BlockUtil.getColumns( mc.thePlayer.position.add(0, -1, 0), 4, 5, 4, 4)) {
RenderUtil.drawBox(event, block, Color.RED, true)
}
*/

// check if there are more than 2 columns higher than 4 blocks
/* if(BlockUtil.getColumns( mc.thePlayer.position.add(0, -1, 0), 4, 5, 4, 4).size >= 2) {
// get all the columns higher than 4 blocks and put in arrayList
var cornerBlocks = BlockUtil.getColumns( mc.thePlayer.position.add(0, -1, 0), 4, 5, 4, 4)
// this is where things go wrong ig
BlockUtil.getAllCornerBlocks(cornerBlocks)
for (blockPos: BlockPos in BlockUtil.getAllCornerBlocks(cornerBlocks))
RenderUtil.drawBox(event, blockPos, Color.BLUE, true)
} else {
println("nah")
}
}
*/
blockPoss.clear()
if (BlockUtil.getBlocks(mc.thePlayer.position, 15, 4, 15).isEmpty()) return

for(block: BlockPos in BlockUtil.getBlocks(mc.thePlayer.position, 15, 5, 15)) {
if(BlockUtil.isSingleCorner(block)) {
if(BlockUtil.blocksBetweenValid(block,mc.thePlayer.position.add(0, 0, 0))) {
RenderUtil.drawBox(event, block, Color.BLUE, true)
blockPoss.add(block)
}

}

}

}
/* GenericBossKiller.blockPoss = BlockUtil.getBlocks(dev.macrohq.swiftslayer.util.mc.thePlayer.position, 5, 5, 5) as ArrayList<BlockPos>
for (blockk: BlockPos in GenericBossKiller.blockPoss) {
// if(BlockUtil.blocksBetweenValid(player.position.add(0, 0, 0), blockk.add(0, 0, 0))) {
RenderUtil.drawBox(event, blockk, Color.WHITE, true)
} */
// }
}
}

companion object {
var enabled: Boolean = false
lateinit var blockPos: BlockPos
var blockPoss: ArrayList<BlockPos> = ArrayList()
}
}
19 changes: 9 additions & 10 deletions src/main/kotlin/dev/macrohq/swiftslayer/command/LockTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ package dev.macrohq.swiftslayer.command
import cc.polyfrost.oneconfig.utils.commands.annotations.Command
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand
import dev.macrohq.swiftslayer.SwiftSlayer
import dev.macrohq.swiftslayer.feature.implementation.AutoRotation
import dev.macrohq.swiftslayer.util.RotationMath
import dev.macrohq.swiftslayer.util.SlayerUtil
import net.minecraft.client.Minecraft
import net.minecraft.entity.EntityLiving
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.BlockPos
import net.minecraftforge.fml.common.Mod.EventHandler
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent

Expand All @@ -23,7 +20,6 @@ class LockTest {
private fun rotate(lock: Boolean) {
rotationTargetEntity = SlayerUtil.getFakeBoss()!!
enabled = lock
println("error or sokmething")
println(enabled)
}

Expand All @@ -32,13 +28,16 @@ class LockTest {


if (enabled) {

rotationTargetEntity = SlayerUtil.getFakeBoss()!!
val boundingBox: AxisAlignedBB = rotationTargetEntity.entityBoundingBox
val deltaX = boundingBox.maxX - boundingBox.minX
val deltaY = boundingBox.maxY - boundingBox.minY
val deltaZ = boundingBox.maxZ - boundingBox.minZ

if(rotationTargetEntity.isDead) enabled = false;

val randomPositionOnBoundingBox =
BlockPos(boundingBox.minX + deltaX , boundingBox.minY + deltaY, boundingBox.minZ + deltaZ)
rotationTargetEntity.position.add(0, (rotationTargetEntity.height*0.75).toInt(), 0)

if (Minecraft.getMinecraft().objectMouseOver.entityHit == rotationTargetEntity) return

SwiftSlayer.instance.rotation.setYaw(RotationMath.getYaw(randomPositionOnBoundingBox), SwiftSlayer.instance.config.macroLockSmoothness.toInt(), true)
SwiftSlayer.instance.rotation.setPitch(RotationMath.getPitch(randomPositionOnBoundingBox), SwiftSlayer.instance.config.macroLockSmoothness.toInt(), true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,44 +156,6 @@ class SwiftSlayerConfig : Config(Mod("SwiftSlayer", ModType.SKYBLOCK), "swiftsla
)
var macroGuiDelayRandomness: Float = 350f


// ==============================
// Pathfinder Debug Config
// ==============================
@Switch(
name = "allowJump",
category = "PF"
)
var allowJump = true


@Switch(
name = "holdSneak",
category = "PF"
)
var holdSneak = true

@Switch(
name = "allowDiagonalAscend",
category = "PF"
)
var allowDiagonalAscend = true


@Switch(
name = "allowDiagonalDescend",
category = "PF"
)
var allowDiagonalDescend = true

@Slider(
name = "maxFallHeight",
category = "PF",
min = 1f,
max = 256f
)
var maxFallHeight = 20

fun getRandomGUIMacroDelay(): Long {
return (macroGuiDelay + Math.random().toFloat() * macroGuiDelayRandomness).toLong()
}
Expand Down Expand Up @@ -231,7 +193,15 @@ class SwiftSlayerConfig : Config(Mod("SwiftSlayer", ModType.SKYBLOCK), "swiftsla
max = 10f
)
var macroLockSmoothness: Float = 4f


@Dropdown(
name = "BossKiller Movement",
category = "General",
subcategory = "Slayer",
options = ["Find corner", "Walk back"]
)
var moveementType = 0

init {
initialize()
registerKeyBind(toggleMacro) { macroManager.toggle() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Failsafe {
macroManager.disable()
}

// @SubscribeEvent
@SubscribeEvent
fun onItemChange(event: ReceivePacketEvent) {
if (!macroManager.enabled) return
if (event.packet !is S09PacketHeldItemChange) return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package dev.macrohq.swiftslayer.feature.helper

data class Angle(val yaw: Float, val pitch: Float)
data class Angle(val yaw: Float, var pitch: Float)
Loading

0 comments on commit da61519

Please sign in to comment.