From bc918a892b91c64bba37684250fc95fffb0fa77e Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 19 Aug 2026 18:43:41 +0300 Subject: [PATCH 1/5] made the popup for modules not open when clicking them with the left mouse button --- src/main/kotlin/com/lambda/gui/components/ModuleEntry.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/gui/components/ModuleEntry.kt b/src/main/kotlin/com/lambda/gui/components/ModuleEntry.kt index da2c8d712..7c73ae9ab 100644 --- a/src/main/kotlin/com/lambda/gui/components/ModuleEntry.kt +++ b/src/main/kotlin/com/lambda/gui/components/ModuleEntry.kt @@ -43,7 +43,7 @@ class ModuleEntry(val module: Module): Layout { if (isMouseReleased() && suppressedEntryId == entryId) suppressedEntryId = null ImGui.setNextWindowSizeConstraints(0f, 0f, Float.MAX_VALUE, io.displaySize.y * 0.5f) - popupContextItem(popupId, ImGuiPopupFlags.None) { + popupContextItem(popupId, ImGuiPopupFlags.MouseButtonRight) { buildConfigSettingsContext(module) } } From 60614c03ab96bca5ac94758c5910515e64c34ca2 Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 19 Aug 2026 23:11:30 +0300 Subject: [PATCH 2/5] Port the targetstrafe plugin from lambda 1.12.2 and add functionality to change x, y and z of the player on pre move event --- .../mixin/entity/ClientPlayerEntityMixin.java | 7 +- .../lambda/mixin/input/KeyBindingMixin.java | 1 - .../com/lambda/event/events/MovementEvent.kt | 8 +- .../module/modules/movement/TargetStrafe.kt | 204 ++++++++++++++---- 4 files changed, 167 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java b/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java index f9a6bf5a3..c8bd52b47 100644 --- a/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java +++ b/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java @@ -90,9 +90,12 @@ private void onOpenEditSignScreen(SignBlockEntity sign, boolean front, CallbackI @WrapOperation(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V")) private void wrapMove(ClientPlayerEntity instance, MovementType movementType, Vec3d vec3d, Operation original) { - EventFlow.post(new MovementEvent.Player.Pre(movementType, vec3d)); + MovementEvent.Player.Pre preEvent = new MovementEvent.Player.Pre(movementType, vec3d); + EventFlow.post(preEvent); + vec3d = preEvent.getMovement(); original.call(instance, movementType, vec3d); - EventFlow.post(new MovementEvent.Player.Post(movementType, vec3d)); + MovementEvent.Player.Post postEvent = new MovementEvent.Player.Post(movementType, vec3d); + EventFlow.post(postEvent); } @WrapOperation(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V")) diff --git a/src/main/java/com/lambda/mixin/input/KeyBindingMixin.java b/src/main/java/com/lambda/mixin/input/KeyBindingMixin.java index 02569e68b..24954cb22 100644 --- a/src/main/java/com/lambda/mixin/input/KeyBindingMixin.java +++ b/src/main/java/com/lambda/mixin/input/KeyBindingMixin.java @@ -36,7 +36,6 @@ boolean modifyIsPressed(boolean original) { if (Sprint.INSTANCE.isEnabled()) return true; if (Speed.INSTANCE.isEnabled() && Speed.getMode() == Speed.Mode.GrimStrafe) return true; - if (TargetStrafe.INSTANCE.isEnabled() && TargetStrafe.isActive()) return true; return original; } } diff --git a/src/main/kotlin/com/lambda/event/events/MovementEvent.kt b/src/main/kotlin/com/lambda/event/events/MovementEvent.kt index 98c72d532..9ec5e75d9 100644 --- a/src/main/kotlin/com/lambda/event/events/MovementEvent.kt +++ b/src/main/kotlin/com/lambda/event/events/MovementEvent.kt @@ -25,7 +25,7 @@ import net.minecraft.entity.LivingEntity import net.minecraft.entity.MovementType import net.minecraft.util.math.Vec3d -sealed class MovementEvent { +abstract class MovementEvent { /** * Represents player movement update events. * This event will even be triggered if the player is not moving. @@ -37,18 +37,18 @@ sealed class MovementEvent { /** * Event triggered before player movement. * - * @property movementType The type of movement. + * @property movement Type The type of movement. * @property movement The movement vector. */ data class Pre( override val movementType: MovementType, - override val movement: Vec3d, + override var movement: Vec3d, ) : Player(), ICancellable by Cancellable() /** * Event triggered after player movement. * - * @property movementType The type of movement. + * @property movement Type The type of movement. * @property movement The movement vector. */ data class Post( diff --git a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt index 57ece652e..087fa7d9f 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt @@ -17,80 +17,192 @@ package com.lambda.module.modules.movement -import com.lambda.event.events.RotationEvent +import com.lambda.context.SafeContext +import com.lambda.event.events.MovementEvent +import com.lambda.event.events.RenderEvent import com.lambda.event.events.TickEvent import com.lambda.event.listener.SafeListener.Companion.listen +import com.lambda.interaction.managers.rotating.Rotation import com.lambda.interaction.managers.rotating.Rotation.Companion.rotationTo import com.lambda.module.Module import com.lambda.module.modules.combat.KillAura import com.lambda.module.tag.ModuleTag -import com.lambda.util.math.distSq -import com.lambda.util.player.MovementUtils.update -import kotlin.math.pow +import net.minecraft.entity.effect.StatusEffects +import net.minecraft.util.math.Vec3d +import kotlin.math.cos +import kotlin.math.sin +import kotlin.math.sqrt object TargetStrafe : Module( name = "TargetStrafe", - description = "Automatically strafes around entities", + description = "Strafes around a target in a circle. The default settings work great for old NCP.", tag = ModuleTag.MOVEMENT, ) { - private val targetDistance by setting("Strafe Distance", 1.0, 0.0..5.0, 0.1) - private val jitterCompensation by setting("Jitter Compensation", 0.0, 0.0..1.0, 0.1) - private val stabilize by setting("Stabilize", StabilizationMode.Normal) - - enum class StabilizationMode { - None, - Weak, - Normal, - Strong - } + private val autoJump by setting("AutoJump", true) + private val distanceSetting by setting("PreferredDistance", 1f, 0f..6f, 0.1f) + private val maxDistance by setting("MaxDistance", 10f, 1f..32f, 0.5f) + private val turnAmount by setting("TurnAmount", 5f, 1f..90f, 0.5f) + private val hSpeed by setting("HSpeed", 0.2873f, 0.001f..10.0f, 0.0001f) + + private val needsAura by setting("NeedsAura", true) + private val antiStuck by setting("AntiStuck", true) + + // private val renderCircle by setting("RenderCircle", true) + // private val renderThickness by setting("RenderThickness", 2f, 0.5f..8f, 0.5f, visibility = { renderCircle }) - private var forwardDirection = 1.0 - private var strafeDirection = 1.0 + private var direction = 1 - @JvmStatic - val isActive get() = isEnabled && KillAura.isEnabled && KillAura.target != null + private var currentDistance = 0.toDouble() + private var currentTargetVec: Vec3d? = null + + private var strafing = false init { listen { - if (player.horizontalCollision) strafeDirection *= -1 - if (KillAura.target == null) { - forwardDirection = 1.0 - strafeDirection = 1.0 + if (strafing && autoJump && player.isOnGround) { + player.jump() + } + } + + listen { event -> + if (mc.player!!.horizontalCollision && antiStuck) { + switchDirection() + } + val strafe = canStrafe() + + if (strafe) { + val rotations = KillAura.target?.let { it1 -> player.eyePos!!.rotationTo(it1.pos) } ?: return@listen + KillAura.target?.let { it1 -> doStrafeAtSpeed(event, rotations.yawF, it1.pos) } + val r: Rotation + + strafing = true + } else { + strafing = false } } - listen { event -> - KillAura.target?.let { target -> - event.strafeYaw = player.eyePos.rotationTo(target.boundingBox.center).yaw + // listen { + // if (strafing && renderCircle) { + // if (currentTargetVec == null) { + // return@listen + // } + // /* + // todo: make rendering work + // drawCircle(currentTargetVec!!, distanceSetting.toDouble(), distanceColor, 360) + // drawCircle(currentTargetVec!!, currentDistance, playerDistanceColor, 360) + // */ + // } + // } + + } - val distSq = player.pos distSq target.pos - val keepRange = 0.5 * jitterCompensation + private fun SafeContext.doStrafeAtSpeed(event: MovementEvent.Player.Pre, rotation: Float, target: Vec3d): Boolean { - forwardDirection = when { - distSq > (targetDistance + keepRange).pow(2) -> 1.0 - distSq < (targetDistance - keepRange).pow(2) -> -1.0 - else -> forwardDirection - } - // Premium code, do not touch it bites - var shouldStabilize = when (stabilize) { - StabilizationMode.None -> false - StabilizationMode.Weak -> player.age % 4 == 0 // 1/4 - StabilizationMode.Normal -> player.age % 2 == 0 // 2/4 - StabilizationMode.Strong -> player.age % 4 != 0 // 3/4 - } + var playerSpeed = hSpeed + var jumpVelocity = 0.405 - shouldStabilize = shouldStabilize && distSq > (targetDistance + 0.5).pow(2) + var rotationYaw = rotation + (90f * direction) - val strafe = if (shouldStabilize) 0.0 else strafeDirection - event.input.update(forwardDirection, strafe, jump = true) + + val disX = player.pos.x - target.x + val disZ = player.pos.z - target.z + + val distance = sqrt(disX * disX + disZ * disZ) + + if (distance < maxDistance) { + if (distance > distanceSetting) { + rotationYaw -= turnAmount * direction + } else if (distance < distanceSetting) { + rotationYaw += turnAmount * direction } + } else { + rotationYaw = rotation } - onEnable { - forwardDirection = 1.0 - strafeDirection = 1.0 + currentDistance = distance + + + // jump boost + + val jumpboost = player.getStatusEffect(StatusEffects.JUMP_BOOST) + if (jumpboost != null) { + jumpVelocity *= jumpboost.amplifier } + + // speed + + val speed = player.getStatusEffect(StatusEffects.SPEED) + if (speed != null) { + + playerSpeed *= 1.0f + 0.2f * (speed.amplifier + 1) + } + + event.movement = Vec3d(playerSpeed * cos(Math.toRadians((rotationYaw + 90.0f).toDouble())), event.movement.y, playerSpeed * sin(Math.toRadians((rotationYaw + 90.0f).toDouble()))) + + + return false + } + + private fun canStrafe(): Boolean { + if ((KillAura.isEnabled || !needsAura) && KillAura.target != null) { + return true + } + return false } + + private fun switchDirection() { + direction = -direction + } + + // private fun drawCircle(center: Vec3d, radius: Double, color: Color, precision: Int) { + + + // val linesToDraw = ArrayList>() + + // val magic = precision / 360 + + // var lastPos = center.add(0.0, 0.0, radius) + + + // for (i in 0..precision) { + + // val yaw = i * magic + + // val x = radius * cos(Math.toRadians((yaw + 90.0f).toDouble())) + // val z = radius * sin(Math.toRadians((yaw + 90.0f).toDouble())) + + // val newPos = center.add(x, 0.0, z) + // linesToDraw.add(Pair(lastPos, newPos)) + // lastPos = newPos + // } + + // val tessellator: Tessellator? + // try { + // tessellator = Tessellator.getInstance() + // } catch (e: NoSuchFieldError) { + // e.printStackTrace() + // return + // } + // val buffer: BufferBuilder = tessellator.buffer + + // GL11.glLineWidth(renderThickness) + // //GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_SMOOTH) + // GlStateManager.disableDepth() + + // buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR) + // for (pair in linesToDraw) { + // try { + // buffer.pos(pair.first.x, center.y, pair.first.z).color(color.r, color.g, color.b, color.a).endVertex() + // buffer.pos(pair.second.x, center.y, pair.second.z).color(color.r, color.g, color.b, color.a).endVertex() + // } catch (e: NullPointerException) { + // } + // } + // tessellator.draw() + + + // GlStateManager.enableDepth() + // GL11.glLineWidth(1f) + // } } From 719c2337a1d745285c1a165acaed843712286d8e Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 20 Aug 2026 15:33:16 +0300 Subject: [PATCH 3/5] Added rendering back based on what Printer does, added setting for circle color --- .../module/modules/movement/TargetStrafe.kt | 120 +++++------------- 1 file changed, 35 insertions(+), 85 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt index 087fa7d9f..7e540e4f2 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt @@ -17,18 +17,22 @@ package com.lambda.module.modules.movement +import com.lambda.config.ConfigEditor.forEachSetting +import com.lambda.config.ConfigEditor.hideAllExcept +import com.lambda.config.blocks.WorldLineSettings +import com.lambda.config.withEdits import com.lambda.context.SafeContext import com.lambda.event.events.MovementEvent -import com.lambda.event.events.RenderEvent import com.lambda.event.events.TickEvent import com.lambda.event.listener.SafeListener.Companion.listen -import com.lambda.interaction.managers.rotating.Rotation +import com.lambda.graphics.mc.renderer.ImmediateRenderer.Companion.immediateRenderer import com.lambda.interaction.managers.rotating.Rotation.Companion.rotationTo import com.lambda.module.Module import com.lambda.module.modules.combat.KillAura import com.lambda.module.tag.ModuleTag import net.minecraft.entity.effect.StatusEffects import net.minecraft.util.math.Vec3d +import java.awt.Color import kotlin.math.cos import kotlin.math.sin import kotlin.math.sqrt @@ -47,8 +51,19 @@ object TargetStrafe : Module( private val needsAura by setting("NeedsAura", true) private val antiStuck by setting("AntiStuck", true) - // private val renderCircle by setting("RenderCircle", true) - // private val renderThickness by setting("RenderThickness", 2f, 0.5f..8f, 0.5f, visibility = { renderCircle }) + private val renderCircle by setting("RenderCircle", true) + private val renderCircleColor by setting("RenderCircleColor", Color(255, 255, 255, 100), visibility = { renderCircle }) + private val renderThickness by configBlock(WorldLineSettings(this)) + .withEdits { + hideAllExcept( + ::distanceScaling, + ::worldWidthSetting, + ::screenWidthSetting + ) + forEachSetting { + visibility { old -> { old() && renderCircle } } + } + } private var direction = 1 @@ -59,22 +74,19 @@ object TargetStrafe : Module( init { listen { - if (strafing && autoJump && player.isOnGround) { player.jump() } } listen { event -> - if (mc.player!!.horizontalCollision && antiStuck) { + if (player.horizontalCollision && antiStuck) { switchDirection() } - val strafe = canStrafe() - - if (strafe) { - val rotations = KillAura.target?.let { it1 -> player.eyePos!!.rotationTo(it1.pos) } ?: return@listen + if (canStrafe()) { + val rotations = KillAura.target?.let { it1 -> player.eyePos?.rotationTo(it1.pos) } ?: return@listen KillAura.target?.let { it1 -> doStrafeAtSpeed(event, rotations.yawF, it1.pos) } - val r: Rotation + currentTargetVec = KillAura.target?.pos strafing = true } else { @@ -82,27 +94,22 @@ object TargetStrafe : Module( } } - // listen { - // if (strafing && renderCircle) { - // if (currentTargetVec == null) { - // return@listen - // } - // /* - // todo: make rendering work - // drawCircle(currentTargetVec!!, distanceSetting.toDouble(), distanceColor, 360) - // drawCircle(currentTargetVec!!, currentDistance, playerDistanceColor, 360) - // */ - // } - // } - + immediateRenderer("TargetStrafe immediate renderer") { + if (strafing && renderCircle) { + circleLine( + currentTargetVec ?: return@immediateRenderer, + distanceSetting.toDouble(), + renderCircleColor, + renderThickness.width, + segments = 64 + ) + } + } } private fun SafeContext.doStrafeAtSpeed(event: MovementEvent.Player.Pre, rotation: Float, target: Vec3d): Boolean { - - var playerSpeed = hSpeed var jumpVelocity = 0.405 - var rotationYaw = rotation + (90f * direction) @@ -125,14 +132,12 @@ object TargetStrafe : Module( // jump boost - val jumpboost = player.getStatusEffect(StatusEffects.JUMP_BOOST) if (jumpboost != null) { jumpVelocity *= jumpboost.amplifier } // speed - val speed = player.getStatusEffect(StatusEffects.SPEED) if (speed != null) { @@ -140,69 +145,14 @@ object TargetStrafe : Module( } event.movement = Vec3d(playerSpeed * cos(Math.toRadians((rotationYaw + 90.0f).toDouble())), event.movement.y, playerSpeed * sin(Math.toRadians((rotationYaw + 90.0f).toDouble()))) - - return false } private fun canStrafe(): Boolean { - if ((KillAura.isEnabled || !needsAura) && KillAura.target != null) { - return true - } - return false + return (KillAura.isEnabled || !needsAura) && KillAura.target != null } private fun switchDirection() { direction = -direction } - - // private fun drawCircle(center: Vec3d, radius: Double, color: Color, precision: Int) { - - - // val linesToDraw = ArrayList>() - - // val magic = precision / 360 - - // var lastPos = center.add(0.0, 0.0, radius) - - - // for (i in 0..precision) { - - // val yaw = i * magic - - // val x = radius * cos(Math.toRadians((yaw + 90.0f).toDouble())) - // val z = radius * sin(Math.toRadians((yaw + 90.0f).toDouble())) - - // val newPos = center.add(x, 0.0, z) - // linesToDraw.add(Pair(lastPos, newPos)) - // lastPos = newPos - // } - - // val tessellator: Tessellator? - // try { - // tessellator = Tessellator.getInstance() - // } catch (e: NoSuchFieldError) { - // e.printStackTrace() - // return - // } - // val buffer: BufferBuilder = tessellator.buffer - - // GL11.glLineWidth(renderThickness) - // //GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_SMOOTH) - // GlStateManager.disableDepth() - - // buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR) - // for (pair in linesToDraw) { - // try { - // buffer.pos(pair.first.x, center.y, pair.first.z).color(color.r, color.g, color.b, color.a).endVertex() - // buffer.pos(pair.second.x, center.y, pair.second.z).color(color.r, color.g, color.b, color.a).endVertex() - // } catch (e: NullPointerException) { - // } - // } - // tessellator.draw() - - - // GlStateManager.enableDepth() - // GL11.glLineWidth(1f) - // } } From be96cf23fc82b930cd626f23e7d222375cde9b1e Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 20 Aug 2026 15:35:16 +0300 Subject: [PATCH 4/5] Remove unusued jump boost thing --- .../com/lambda/module/modules/movement/TargetStrafe.kt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt index 7e540e4f2..cf58287bc 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt @@ -109,7 +109,6 @@ object TargetStrafe : Module( private fun SafeContext.doStrafeAtSpeed(event: MovementEvent.Player.Pre, rotation: Float, target: Vec3d): Boolean { var playerSpeed = hSpeed - var jumpVelocity = 0.405 var rotationYaw = rotation + (90f * direction) @@ -130,13 +129,6 @@ object TargetStrafe : Module( currentDistance = distance - - // jump boost - val jumpboost = player.getStatusEffect(StatusEffects.JUMP_BOOST) - if (jumpboost != null) { - jumpVelocity *= jumpboost.amplifier - } - // speed val speed = player.getStatusEffect(StatusEffects.SPEED) if (speed != null) { From a00801b2d1e306c58afa426d09f705b4d29a66e1 Mon Sep 17 00:00:00 2001 From: Matias Date: Thu, 20 Aug 2026 17:46:27 +0300 Subject: [PATCH 5/5] clean up --- src/main/kotlin/com/lambda/event/events/MovementEvent.kt | 2 +- .../kotlin/com/lambda/module/modules/movement/TargetStrafe.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/event/events/MovementEvent.kt b/src/main/kotlin/com/lambda/event/events/MovementEvent.kt index 9ec5e75d9..7a0d6c6e8 100644 --- a/src/main/kotlin/com/lambda/event/events/MovementEvent.kt +++ b/src/main/kotlin/com/lambda/event/events/MovementEvent.kt @@ -25,7 +25,7 @@ import net.minecraft.entity.LivingEntity import net.minecraft.entity.MovementType import net.minecraft.util.math.Vec3d -abstract class MovementEvent { +sealed class MovementEvent { /** * Represents player movement update events. * This event will even be triggered if the player is not moving. diff --git a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt index cf58287bc..116e68521 100644 --- a/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt +++ b/src/main/kotlin/com/lambda/module/modules/movement/TargetStrafe.kt @@ -52,7 +52,7 @@ object TargetStrafe : Module( private val antiStuck by setting("AntiStuck", true) private val renderCircle by setting("RenderCircle", true) - private val renderCircleColor by setting("RenderCircleColor", Color(255, 255, 255, 100), visibility = { renderCircle }) + private val renderCircleColor by setting("RenderCircleColor", Color(255, 255, 255, 100)) { renderCircle } private val renderThickness by configBlock(WorldLineSettings(this)) .withEdits { hideAllExcept( @@ -67,7 +67,7 @@ object TargetStrafe : Module( private var direction = 1 - private var currentDistance = 0.toDouble() + private var currentDistance = 0.0 private var currentTargetVec: Vec3d? = null private var strafing = false