Compare commits

..

No commits in common. "1eb2e5ee6c10e19590b22efeaadf6341929e1674" and "c3f5be60ed36ef322a17899e9abf198e0d848833" have entirely different histories.

3 changed files with 14 additions and 59 deletions

View File

@ -1,10 +0,0 @@
## [1.4.0] - 2024-07-23
### Chore
- Remove comments
### Feat
- *(chestesp)* Add initial implementation, halfway done

View File

@ -1,8 +1,8 @@
#Sat Apr 19 14:54:37 MDT 2025
#Sun Apr 06 20:00:32 MDT 2025
versionBase=1.5.0
loom.platform=forge
baseGroup=com.github.itzilly.sbt
mcVersion=1.8.9
org.gradle.jvmargs=-Xmx2g
buildNumber=107
buildNumber=106
modid=sbt

View File

@ -13,71 +13,36 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
object CaneMacroer {
var isMacroToggled: Boolean = false
val mc = Minecraft.getMinecraft()
val allowedScreens = listOf(GuiChat::class.java)
var activeKeys: MutableList<KeyBindingAccessor> = mutableListOf()
@SubscribeEvent
fun onTick(event: ClientTickEvent) {
if (event.phase != TickEvent.Phase.END) return
if (!isMacroToggled) return
val currentScreen = mc.currentScreen
if (currentScreen != null && allowedScreens.none { it.isInstance(currentScreen) }) {
Chatterbox.say("Macro stopped: Invalid screen")
val canRunMacro = mc.currentScreen == null || mc.currentScreen is GuiChat
if (!canRunMacro) {
isMacroToggled = false
Chatterbox.say("Disabled macro!")
stop()
return
}
val mop = mc.objectMouseOver
if (mop == null || mop.typeOfHit?.name != "BLOCK") return
val blockPos = mop.blockPos
val facing = mop.sideHit
val player = mc.thePlayer
val blockCenter = blockPos.add(0.5, 0.5, 0.5)
val distanceSq = player.getDistanceSq(blockCenter.x.toDouble(), blockCenter.y.toDouble(), blockCenter.z.toDouble())
if (distanceSq > 25) {
Chatterbox.say("Macro stopped: Too far from block")
stop()
return
}
if (isEntityBlockingView()) {
Chatterbox.say("Macro stopped: Entity in the way")
stop()
return
}
val myKey = mc.gameSettings.keyBindForward as KeyBindingAccessor
pressKey(mc.gameSettings.keyBindForward.keyCode)
mc.playerController.onPlayerDamageBlock(blockPos, facing)
player.swingItem()
}
fun stop() {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.keyCode, false)
KeyBinding.setKeyBindState(mc.gameSettings.keyBindAttack.keyCode, false)
isMacroToggled = false
}
// private fun pressKey(key: KeyBindingAccessor) {
// key.setPressed(true)
// activeKeys.add(key)
// }
private fun pressKey(keyCode: Int) {
KeyBinding.setKeyBindState(keyCode, true)
}
private fun isEntityBlockingView(): Boolean {
val lookVec = mc.thePlayer.lookVec
val eyePos = mc.thePlayer.getPositionEyes(1f)
val entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(
mc.thePlayer,
mc.thePlayer.entityBoundingBox.expand(lookVec.xCoord * 5, lookVec.yCoord * 5, lookVec.zCoord * 5)
)
return entities.any {
it.canBeCollidedWith() &&
it.entityBoundingBox.isVecInside(eyePos)
}
}
}