Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c1db6fe
Wtf
bladekt Jul 5, 2024
d1ba8a0
Offline crash fix
bladekt Jul 6, 2024
d76c471
Settings font scaling
bladekt Jul 6, 2024
6000a84
Gui window docking & hud serialization fix
bladekt Jul 6, 2024
90c92a1
No vertex caching for custom static esp
bladekt Jul 6, 2024
45f689d
Docking grid
bladekt Jul 8, 2024
cfe04d4
Travel events
bladekt Jul 9, 2024
5c258b8
TargetStrafe
bladekt Jul 9, 2024
b1ca0d8
TargetStrafe improvements
bladekt Jul 10, 2024
1392101
Matrices premuliplying
bladekt Jul 10, 2024
47929ff
Projection, Particles, Speed fixes
bladekt Jul 11, 2024
e57a611
Simple jesus
bladekt Jul 16, 2024
99d4b8f
Refactored movement handlers
bladekt Jul 16, 2024
391adc8
many ncp jesus modes
bladekt Jul 17, 2024
08f880a
Laying particles
bladekt Jul 19, 2024
26b9e7d
Targeting Config
bladekt Jul 21, 2024
3c1ca3d
Kill aura
bladekt Jul 22, 2024
bd7ac3e
Strafe event fix for silent rotations
bladekt Jul 24, 2024
594c913
Criticals
bladekt Jul 26, 2024
e802a53
NoFall
bladekt Jul 26, 2024
72f88ad
Grim TickShift, Blink
bladekt Jul 26, 2024
54b93ad
fix: Check for open connection
emyfops Jul 26, 2024
7407fad
refactor: packet event types
emyfops Jul 27, 2024
2906fe3
feat: static & dynamic delay mode
emyfops Jul 27, 2024
f87fc2b
Gui window skrilling
bladekt Jul 28, 2024
d94821b
fix: Check for open connection
emyfops Jul 26, 2024
5883c88
refactor: packet event types
emyfops Jul 27, 2024
b0995e7
feat: static & dynamic delay mode
emyfops Jul 27, 2024
e862bf4
Merge remote-tracking branch 'origin/feature/renderer' into feature/r…
bladekt Jul 28, 2024
4b950ba
Tick Shift renderer & refactor
bladekt Jul 30, 2024
3396537
Destroyable listener
emyfops Jul 31, 2024
ad8946e
Better destroyable listeners
emyfops Jul 31, 2024
146957d
Workaround #47
emyfops Aug 1, 2024
db4a961
Fix: Setting unit at the end of inputbar string
bladekt Aug 2, 2024
b50193f
BackTrack
bladekt Aug 3, 2024
5dc06b7
HUD hiding
bladekt Aug 3, 2024
e74746b
Merge remote-tracking branch 'origin/master' into feature/renderer
Avanatiker Aug 4, 2024
3500a1b
Merge remote-tracking branch 'origin/feature/renderer' into feature/r…
bladekt Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions common/src/main/java/com/lambda/mixin/ClientConnectionMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkSide;
import net.minecraft.network.listener.ClientPacketListener;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.listener.ServerPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
import net.minecraft.text.Text;
Expand All @@ -25,14 +27,18 @@ public class ClientConnectionMixin {

@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
private void sendingPacket(Packet<?> packet, final CallbackInfo callbackInfo) {
if (EventFlow.post(new PacketEvent.Send.Pre(packet)).isCanceled()) {
if (side != NetworkSide.SERVERBOUND) return;

if (EventFlow.post(new PacketEvent.Send.Pre((Packet<ServerPacketListener>) packet)).isCanceled()) {
callbackInfo.cancel();
}
}

@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("RETURN"))
private void sendingPacketPost(Packet<?> packet, final CallbackInfo callbackInfo) {
EventFlow.post(new PacketEvent.Send.Post(packet));
if (side != NetworkSide.SERVERBOUND) return;

EventFlow.post(new PacketEvent.Send.Post((Packet<ServerPacketListener>) packet));
}

@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE), cancellable = true, require = 1)
Expand All @@ -42,7 +48,8 @@ private void receivingPacket(
CallbackInfo callbackInfo
) {
if (side != NetworkSide.CLIENTBOUND) return;
if (EventFlow.post(new PacketEvent.Receive.Pre(packet)).isCanceled()) {

if (EventFlow.post(new PacketEvent.Receive.Pre((Packet<ClientPacketListener>) packet)).isCanceled()) {
callbackInfo.cancel();
}
}
Expand All @@ -55,7 +62,7 @@ private void receivingPacketPost(
) {
if (side != NetworkSide.CLIENTBOUND) return;

EventFlow.post(new PacketEvent.Receive.Post(packet));
EventFlow.post(new PacketEvent.Receive.Post((Packet<ClientPacketListener>) packet));
}

@Inject(method = "connect(Ljava/lang/String;ILnet/minecraft/network/listener/PacketListener;Lnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import com.lambda.event.events.ScreenEvent;
import com.lambda.event.events.ScreenHandlerEvent;
import com.lambda.event.events.TickEvent;
import com.lambda.interaction.RotationManager;
import com.lambda.module.modules.player.Interact;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import org.jetbrains.annotations.Nullable;
Expand All @@ -27,6 +27,7 @@ public class MinecraftClientMixin {
@Inject(method = "tick", at = @At("HEAD"))
void onTickPre(CallbackInfo ci) {
EventFlow.post(new TickEvent.Pre());
RotationManager.update();
}

@Inject(method = "tick", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.lambda.mixin.entity;

import com.lambda.event.EventFlow;
import com.lambda.event.events.AttackEvent;
import com.lambda.event.events.InteractionEvent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
Expand All @@ -13,6 +16,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ClientPlayerInteractionManager.class)
Expand All @@ -27,4 +31,14 @@ public void interactBlockHead(final ClientPlayerEntity player, final Hand hand,
if (client.world == null) return;
EventFlow.post(new InteractionEvent.Block(client.world, hitResult));
}

@Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true)
void onAttackPre(PlayerEntity player, Entity target, CallbackInfo ci) {
if (EventFlow.post(new AttackEvent.Pre(target)).isCanceled()) ci.cancel();
}

@Inject(method = "attackEntity", at = @At("TAIL"))
void onAttackPost(PlayerEntity player, Entity target, CallbackInfo ci) {
EventFlow.post(new AttackEvent.Post(target));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.lambda.Lambda;
import com.lambda.event.EventFlow;
import com.lambda.event.events.MovementEvent;
import com.lambda.event.events.TickEvent;
import com.lambda.interaction.PlayerPacketManager;
import com.lambda.interaction.RotationManager;
import net.minecraft.client.input.Input;
Expand Down Expand Up @@ -55,6 +56,7 @@ void onMove(MovementType movementType, Vec3d movement, CallbackInfo ci) {
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V"))
void processMovement(Input input, boolean slowDown, float slowDownFactor) {
input.tick(slowDown, slowDownFactor);
RotationManager.BaritoneProcessor.processPlayerMovement(input, slowDown, slowDownFactor);
EventFlow.post(new MovementEvent.InputUpdate(input, slowDown, slowDownFactor));
}

Expand All @@ -70,6 +72,16 @@ void sendBegin(CallbackInfo ci) {
autoJumpEnabled = Lambda.getMc().options.getAutoJump().getValue();
}

@Inject(method = "tick", at = @At(value = "HEAD"))
void onTickPre(CallbackInfo ci) {
EventFlow.post(new TickEvent.Player.Pre());
}

@Inject(method = "tick", at = @At(value = "RETURN"))
void onTickPost(CallbackInfo ci) {
EventFlow.post(new TickEvent.Player.Post());
}

@Redirect(method = "tickNewAi", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
float fixHeldItemYaw(ClientPlayerEntity instance) {
return Objects.requireNonNullElse(RotationManager.getHandYaw(), instance.getYaw());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ void onJump(CallbackInfo ci) {
self.velocityDirty = true;
}

@Inject(method = "travel", at = @At("HEAD"), cancellable = true)
void onTravelPre(Vec3d movementInput, CallbackInfo ci) {
LivingEntity self = (LivingEntity) (Object) this;
if (self != Lambda.getMc().player) return;

if (EventFlow.post(new MovementEvent.Travel.Pre()).isCanceled()) ci.cancel();
}

@Inject(method = "travel", at = @At("TAIL"))
void onTravelPost(Vec3d movementInput, CallbackInfo ci) {
LivingEntity self = (LivingEntity) (Object) this;
if (self != Lambda.getMc().player) return;

EventFlow.post(new MovementEvent.Travel.Post());
}

@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
private float hookModifyFallFlyingPitch(LivingEntity entity) {
Float pitch = RotationManager.getMovementPitch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ private float injectHeadYaw(PlayerEntity instance) {
Float yaw = RotationManager.getRenderYaw();
return (yaw != null) ? yaw : instance.getYaw();
}

@Redirect(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getYaw()F"))
private float injectAttackFix(PlayerEntity instance) {
if ((Object) this != MinecraftClient.getInstance().player) {
return instance.getYaw();
}

Float yaw = RotationManager.getMovementYaw();
return (yaw != null) ? yaw : instance.getYaw();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.lambda.module.modules.movement.Speed;
import com.lambda.module.modules.movement.Sprint;
import com.lambda.module.modules.movement.TargetStrafe;
import net.minecraft.client.option.KeyBinding;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -19,5 +20,6 @@ void autoSprint(CallbackInfoReturnable<Boolean> cir) {

if (Sprint.INSTANCE.isEnabled()) cir.setReturnValue(true);
if (Speed.INSTANCE.isEnabled() && Speed.getMode() == Speed.Mode.GRIM_STRAFE) cir.setReturnValue(true);
if (TargetStrafe.INSTANCE.isEnabled() && TargetStrafe.isActive()) cir.setReturnValue(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RenderTickCounterMixin {

@Inject(method = "beginRenderTick", at = @At("HEAD"), cancellable = true)
private void beginRenderTick(long timeMillis, CallbackInfoReturnable<Integer> ci) {
lastFrameDuration = (timeMillis - prevTimeMillis) / TimerManager.getTickLength();
lastFrameDuration = (timeMillis - prevTimeMillis) / TimerManager.INSTANCE.getLength();
prevTimeMillis = timeMillis;
tickDelta += lastFrameDuration;
int i = (int) tickDelta;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.lambda.mixin.world;

import com.google.common.collect.AbstractIterator;
import com.lambda.event.EventFlow;
import com.lambda.event.events.WorldEvent;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockCollisionSpliterator;
import net.minecraft.world.BlockView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(BlockCollisionSpliterator.class)
public abstract class BlockCollisionSpliteratorMixin <T extends AbstractIterator<T>> {
@Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"))
private VoxelShape collisionShapeRedirect(BlockState instance, BlockView blockView, BlockPos blockPos, ShapeContext shapeContext) {
VoxelShape collisionShape = instance.getCollisionShape(blockView, blockPos, shapeContext);
WorldEvent.Collision event = EventFlow.post(new WorldEvent.Collision(blockPos, instance, collisionShape));
return event.getShape();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.lambda.config.groups

import com.lambda.config.Configurable
import com.lambda.util.world.raycast.RayCastMask

class InteractionSettings(
c: Configurable,
defaultReach: Double = 4.9,
vis: () -> Boolean = { true },
) : InteractionConfig {
override val reach by c.setting("Reach", 4.9, 0.1..10.0, 0.1, "Players reach / range", " blocks", vis)
override val reach by c.setting("Reach", defaultReach, 0.1..10.0, 0.1, "Players reach / range", " blocks", vis)
override val useRayCast by c.setting("Raycast", false, "Verify hit vector with ray casting (for very strict ACs)", vis)
override val resolution by c.setting("Resolution", 5, 1..20, 1, "How many raycast checks per surface (will be squared)") { vis() && useRayCast }
override val resolution by c.setting("Resolution", 10, 1..30, 1, "How many raycast checks per surface (will be squared)") { vis() && useRayCast }
override val swingHand by c.setting("Swing Hand", true, "Swing hand on interactions", vis)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RotationSettings(
/**
* If true, rotation will be instant without any transition. If false, rotation will transition over time.
*/
private var instant by c.setting("Instant Rotation", true, "Instantly rotate", vis)
var instant by c.setting("Instant Rotation", true, "Instantly rotate", vis)

/**
* The mean (average/base) value used to calculate rotation speed.
Expand Down
100 changes: 100 additions & 0 deletions common/src/main/kotlin/com/lambda/config/groups/Targeting.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.lambda.config.groups

import com.lambda.config.Configurable
import com.lambda.context.SafeContext
import com.lambda.interaction.rotation.Rotation.Companion.dist
import com.lambda.interaction.rotation.Rotation.Companion.rotation
import com.lambda.interaction.rotation.Rotation.Companion.rotationTo
import com.lambda.threading.runSafe
import com.lambda.util.math.VecUtils.distSq
import com.lambda.util.world.WorldUtils.getFastEntities
import net.minecraft.client.network.ClientPlayerEntity
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.mob.MobEntity
import net.minecraft.entity.passive.PassiveEntity

abstract class Targeting(
c: Configurable,
vis: () -> Boolean = { true },
defaultRange: Double,
maxRange: Double
) : TargetingConfig {
override val targetingRange by c.setting("Targeting Range", defaultRange, 1.0..maxRange, 0.05) { vis() }

override val players by c.setting("Players", true) { vis() }
private val mobs by c.setting("Mobs", true) { vis() }
private val hostilesSetting by c.setting("Hostiles", true) { vis() && mobs }
private val animalsSetting by c.setting("Animals", true) { vis() && mobs }
override val hostiles get() = mobs && hostilesSetting
override val animals get() = mobs && animalsSetting

override val invisible by c.setting("Invisible", true) { vis() }
override val dead by c.setting("Dead", false) { vis() }

fun getEntities(): List<LivingEntity> =
mutableListOf<LivingEntity>().apply {
runSafe {
getFastEntities(
player.pos, targetingRange, this@apply,
predicate = { entity -> validate(player, entity) }
)
}
}

open fun validate(player: ClientPlayerEntity, entity: LivingEntity) = when {
!players && entity.isPlayer -> false
!animals && entity is PassiveEntity -> false
!hostiles && entity is MobEntity -> false

!invisible && entity.isInvisibleTo(player) -> false
!dead && entity.isDead -> false

else -> true
}

class Combat(
c: Configurable,
vis: () -> Boolean = { true },
) : Targeting(c, vis, 5.0, 16.0) {
val fov by c.setting("FOV Limit", 180, 5..180, 1) { vis() }
val priority by c.setting("Priority", Priority.DISTANCE) { vis() }

override fun validate(player: ClientPlayerEntity, entity: LivingEntity): Boolean {
if (fov < 180 && player.rotation dist player.eyePos.rotationTo(entity.pos) > fov) return false
return super.validate(player, entity)
}

fun getTarget(): LivingEntity? = runSafe {
var best: LivingEntity? = null
var bestFactor = Double.MAX_VALUE

val comparator = { entity: LivingEntity, _: Int ->
val factor = priority.factor(this, entity)
if (factor < bestFactor) {
best = entity
bestFactor = factor
}
}

val predicate = { entity: LivingEntity ->
validate(player, entity)
}

getFastEntities<LivingEntity>(player.pos, targetingRange, null, comparator, predicate)

return@runSafe best
}
}

class ESP(
c: Configurable,
vis: () -> Boolean = { true },
) : Targeting(c, vis, 128.0, 1024.0)

@Suppress("Unused")
enum class Priority(val factor: SafeContext.(LivingEntity) -> Double) {
DISTANCE({ player.pos distSq it.pos }),
HEALTH({ it.health.toDouble() }),
FOV({ player.rotation dist player.eyePos.rotationTo(it.pos) })
}
}
12 changes: 12 additions & 0 deletions common/src/main/kotlin/com/lambda/config/groups/TargetingConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.lambda.config.groups

interface TargetingConfig {
val targetingRange: Double

val players: Boolean
val hostiles: Boolean
val animals: Boolean

val invisible: Boolean
val dead: Boolean
}
Loading
Loading