Skip to content

Commit 948281c

Browse files
committed
Merge branch 'master' into feature/renderer
2 parents da9c8ff + cf31ae6 commit 948281c

File tree

21 files changed

+200
-210
lines changed

21 files changed

+200
-210
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ val yarnMappings: String by project
1616
val libs = file("libs")
1717

1818
plugins {
19-
kotlin("jvm") version "1.9.24"
19+
kotlin("jvm") version "2.0.0"
2020
id("org.jetbrains.dokka") version "1.9.20"
2121
id("architectury-plugin") version "3.4-SNAPSHOT"
2222
id("dev.architectury.loom") version "1.6-SNAPSHOT" apply false

common/src/main/java/com/lambda/mixin/items/TridentMixin.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@
1111
public class TridentMixin {
1212
// Forge doesn't support the @ModityArgs annotation, so we have to chain multiple @ModifyArg
1313
@ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 0)
14-
private double modifyVelocity0(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; }
14+
private double modifyVelocity0(double velocity) {
15+
return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity;
16+
}
1517

1618
@ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 1)
17-
private double modifyVelocity1(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; }
19+
private double modifyVelocity1(double velocity) {
20+
return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity;
21+
}
1822

1923
@ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 2)
20-
private double modifyVelocity2(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; }
24+
private double modifyVelocity2(double velocity) {
25+
return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity;
26+
}
2127

2228
@ModifyExpressionValue(method = {"onStoppedUsing", "use"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isTouchingWaterOrRain()Z"))
23-
private boolean modifyIsTouchingWaterOrRain(boolean original) { return TridentBoost.INSTANCE.isEnabled() ? TridentBoost.INSTANCE.getForceUse() : original; }
29+
private boolean modifyIsTouchingWaterOrRain(boolean original) {
30+
return TridentBoost.INSTANCE.isEnabled() && TridentBoost.getForceUse() || original;
31+
}
2432
}

common/src/main/java/com/lambda/mixin/render/CameraMixin.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
import com.lambda.interaction.RotationManager;
44
import com.lambda.module.modules.player.Freecam;
5+
import com.lambda.module.modules.render.CameraTweaks;
56
import net.minecraft.client.render.Camera;
67
import net.minecraft.entity.Entity;
78
import net.minecraft.world.BlockView;
89
import org.spongepowered.asm.mixin.Mixin;
910
import org.spongepowered.asm.mixin.Shadow;
1011
import org.spongepowered.asm.mixin.injection.At;
1112
import org.spongepowered.asm.mixin.injection.Inject;
13+
import org.spongepowered.asm.mixin.injection.ModifyArg;
1214
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1316

1417
@Mixin(Camera.class)
1518
public abstract class CameraMixin {
@@ -36,4 +39,20 @@ private void injectQuickPerspectiveSwap(BlockView area, Entity focusedEntity, bo
3639
if (rot == null) return;
3740
setRotation(rot.getYawF(), rot.getPitchF());
3841
}
42+
43+
@Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true)
44+
private void onClipToSpace(double desiredCameraDistance, CallbackInfoReturnable<Double> info) {
45+
if (CameraTweaks.getNoClipCam()) {
46+
info.setReturnValue(desiredCameraDistance);
47+
}
48+
}
49+
50+
@ModifyArg(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(D)D"))
51+
private double onDistanceUpdate(double desiredCameraDistance) {
52+
if (CameraTweaks.INSTANCE.isEnabled()) {
53+
return CameraTweaks.getCamDistance();
54+
}
55+
56+
return desiredCameraDistance;
57+
}
3958
}

common/src/main/java/com/lambda/mixin/world/WorldMixin.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/module/modules/render/FakePlayer.kt renamed to common/src/main/kotlin/com/lambda/module/modules/combat/FakePlayer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.lambda.module.modules.render
1+
package com.lambda.module.modules.combat
22

33
import com.lambda.module.Module
44
import com.lambda.module.tag.ModuleTag
@@ -10,7 +10,7 @@ import java.util.*
1010
object FakePlayer : Module(
1111
name = "FakePlayer",
1212
description = "Spawns a fake player",
13-
defaultTags = setOf(ModuleTag.MISC, ModuleTag.RENDER)
13+
defaultTags = setOf(ModuleTag.COMBAT, ModuleTag.RENDER)
1414
) {
1515
private val playerName by setting("Name", "Steve")
1616

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.lambda.module.modules.debug
2+
3+
import com.lambda.module.Module
4+
import com.lambda.module.tag.ModuleTag
5+
6+
object RenderTest : Module(
7+
name = "RenderTest",
8+
description = "RenderTest",
9+
defaultTags = setOf(ModuleTag.DEBUG)
10+
) {
11+
private val test1 by setting("Toggle visibility", true)
12+
private val test21 by setting("Hallo 1", true, visibility = ::test1)
13+
private val test22 by setting("Hallo Slider", 1.0, 0.0..5.0, 0.5, visibility = ::test1)
14+
private val test23 by setting("Hallo String", "bruh", visibility = ::test1)
15+
private val test31 by setting("Holla huh 1", true, visibility = { !test1 })
16+
private val test32 by setting("Holla buh 2", true, visibility = { !test1 })
17+
18+
private val filled = DynamicFilledRenderer()
19+
private val outline = DynamicOutlineRenderer()
20+
private val color = Color(60, 200, 60)
21+
22+
init {
23+
filled.build {
24+
val flag = mc.crosshairTarget?.blockResult?.blockPos?.let { box = Box(it) } != null
25+
color = color.setAlpha((color.a + flag.toIntSign() * 0.05).coerceAtMost(0.2))
26+
}
27+
28+
outline.build {
29+
val block = mc.crosshairTarget?.blockResult
30+
val flag = block?.blockPos?.let { box = Box(it) } != null
31+
color = color.setAlpha(color.a + flag.toIntSign() * 0.2)
32+
sides = block?.side?.mask ?: sides
33+
}
34+
35+
listener<TickEvent.Pre> {
36+
filled.update()
37+
outline.update()
38+
}
39+
40+
listener<RenderEvent.World> {
41+
filled.render()
42+
outline.render()
43+
}
44+
}
45+
}

common/src/main/kotlin/com/lambda/module/modules/movement/EntityControl.kt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,35 @@ import com.lambda.util.world.WorldUtils.getEntities
99
import net.minecraft.entity.passive.AbstractHorseEntity
1010
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
1111

12+
// ToDo: Rework this module. All mountables should work, solution should be more elegant.
1213
object EntityControl : Module(
1314
name = "EntityControl",
1415
description = "Control mountable entities",
15-
defaultTags = setOf(ModuleTag.MOVEMENT, ModuleTag.BYPASS)
16+
defaultTags = setOf(ModuleTag.MOVEMENT)
1617
) {
17-
private val page by setting("Page", Page.General)
18+
private val page by setting("Page", Page.GENERAL)
1819

1920
/* General */
20-
private val forceMount by setting("Force Mount", true, description = "Attempts to force mount chested entities.", visibility = { page == Page.General })
21+
private val forceMount by setting("Force Mount", true, description = "Attempts to force mount chested entities.", visibility = { page == Page.GENERAL }).apply {
22+
onValueChange { _, _ ->
23+
horses.forEach { horse -> horse.updateSaddle() }
24+
}
25+
}
2126

2227
/* Movement */
23-
private val speed by setting("Entity Speed", 2.0, 0.1..10.0, 0.1, description = "Speed for entities.", visibility = { page == Page.Movement })
28+
private val speed by setting("Entity Speed", 2.0, 0.1..10.0, 0.1, description = "Speed for entities.", visibility = { page == Page.MOVEMENT })
2429

2530
private enum class Page {
26-
General, Movement
31+
GENERAL, MOVEMENT
2732
}
2833

29-
private val theHonses = mutableListOf<AbstractHorseEntity>() // Petah, the honse is here
34+
private val horses = mutableListOf<AbstractHorseEntity>()
3035

3136
init {
3237
listener<TickEvent.Pre> {
33-
getEntities(player.pos, 8.0, theHonses, { horse, _ -> horse.setHorseFlag(4, true) })
38+
if (forceMount) {
39+
getEntities(player.pos, 8.0, horses, { horse, _ -> horse.setHorseFlag(4, true) })
40+
}
3441
}
3542

3643
/*listener<MovementEvent.Pre> {
@@ -53,8 +60,7 @@ object EntityControl : Module(
5360
}
5461

5562
onDisable {
56-
theHonses.forEach { horse -> horse.updateSaddle() }
57-
theHonses.clear()
63+
horses.clear()
5864
}
5965
}
6066
}

common/src/main/kotlin/com/lambda/module/modules/movement/RocketExtend.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
1515
object RocketExtend : Module(
1616
name = "RocketExtend",
1717
description = "Extends rocket length on grim",
18-
defaultTags = setOf(ModuleTag.MOVEMENT)
18+
defaultTags = setOf(ModuleTag.MOVEMENT, ModuleTag.GRIM)
1919
) {
2020
private var extendedRockets = mutableListOf<FireworkRocketEntity>()
2121
private var pingPacket: CommonPongC2SPacket? = null
2222
private var lastPingTime = -1L
23-
private val keepAliveTime by setting("Keepalive timeout", 45, 0..60, 1, unit = " s")
23+
private val keepAliveTime by setting("Keepalive Timeout", 45, 0..60, 1, unit = " s")
2424

2525
init {
2626
listener<PacketEvent.Receive.Pre> { event ->
2727
if (event.packet is PlayerPositionLookS2CPacket) reset()
2828

2929
if (event.packet is EntitiesDestroyS2CPacket) {
3030
event.packet.entityIds.map(world::getEntityById)
31-
.filterPointer(extendedRockets, { _, id -> event.packet.entityIds.removeInt(id) }) { rocket -> rocket.shooter == player }
31+
.filterPointer(extendedRockets, { _, id -> event.packet.entityIds.removeInt(id) }) { rocket ->
32+
rocket.shooter == player
33+
}
3234
}
3335
}
3436

common/src/main/kotlin/com/lambda/module/modules/movement/SafeWalk.kt

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,57 @@ import com.lambda.event.events.MovementEvent
44
import com.lambda.event.listener.SafeListener.Companion.listener
55
import com.lambda.module.Module
66
import com.lambda.module.tag.ModuleTag
7+
import net.minecraft.entity.LivingEntity
78

89
object SafeWalk : Module(
910
name = "SafeWalk",
1011
description = "Keeps you at the edge",
11-
defaultTags = setOf(ModuleTag.MOVEMENT)
12+
defaultTags = setOf(ModuleTag.MOVEMENT, ModuleTag.GRIM)
1213
) {
13-
private val realisticCollision by setting("Collide", true, "Realistic collision on the edge")
14+
private val sneakOnLedge by setting("Sneak On Ledge", true)
15+
private val ledgeDistance by setting("Ledge Distance", 0.25, 0.0..0.5, 0.05, unit = " blocks")
16+
private val stepHeight by setting("Minimum Step Height", 1.0, 0.0..4.0, 0.1, unit = " blocks")
1417

1518
init {
16-
// listener<MovementEvent.Post> {
17-
// if (realisticCollision) player.velocity = Vec3d.ZERO
18-
// }
19+
listener<MovementEvent.InputUpdate> {
20+
if (sneakOnLedge && player.isOnGround && player.isNearLedge(ledgeDistance, stepHeight)) {
21+
it.input.sneaking = true
22+
}
23+
}
1924

2025
listener<MovementEvent.ClipAtLedge> {
21-
it.clip = true
26+
if (!sneakOnLedge) it.clip = true
2227
}
2328
}
29+
30+
private fun LivingEntity.isNearLedge(distance: Double, stepHeight: Double): Boolean {
31+
fun checkDirection(deltaX: Double, deltaZ: Double): Boolean {
32+
var dx = deltaX
33+
var dz = deltaZ
34+
while (dx != 0.0 || dz != 0.0) {
35+
if (world.isSpaceEmpty(this, boundingBox.offset(dx, -stepHeight, dz))) {
36+
return true
37+
}
38+
if (dx != 0.0) dx = adjustDelta(dx)
39+
if (dz != 0.0) dz = adjustDelta(dz)
40+
}
41+
return false
42+
}
43+
44+
return checkDirection(distance, 0.0) || // Positive X
45+
checkDirection(-distance, 0.0) || // Negative X
46+
checkDirection(0.0, distance) || // Positive Z
47+
checkDirection(0.0, -distance) || // Negative Z
48+
checkDirection(distance, distance) || // Positive X, Positive Z
49+
checkDirection(-distance, distance) || // Negative X, Positive Z
50+
checkDirection(distance, -distance) || // Positive X, Negative Z
51+
checkDirection(-distance, -distance) // Negative X, Negative Z
52+
}
53+
54+
private fun adjustDelta(delta: Double) =
55+
when {
56+
delta < 0.05 && delta >= -0.05 -> 0.0
57+
delta > 0.0 -> delta - 0.05
58+
else -> delta + 0.05
59+
}
2460
}

common/src/main/kotlin/com/lambda/module/modules/movement/Speed.kt

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ import com.lambda.util.player.MovementUtils.moveYaw
1717
import com.lambda.util.player.MovementUtils.setSpeed
1818
import kotlin.math.max
1919

20+
// ToDo: Revisit and implement grim strafing
2021
object Speed : Module(
2122
name = "Speed",
2223
description = "Fastest module",
2324
defaultTags = setOf(ModuleTag.MOVEMENT)
2425
) {
25-
private val mode by setting("Mode", Mode.MATRIX_STRAFE_1)
26+
private val mode by setting("Mode", Mode.NCP_STRAFE)
2627

2728
// NCP
2829
private val ncpBaseSpeed by setting("Base Speed", 0.2873, 0.1..0.3, 0.0001, visibility = { mode == Mode.NCP_STRAFE })
@@ -40,13 +41,9 @@ object Speed : Module(
4041
private var ncpSpeed = ncpBaseSpeed
4142
private var lastDistance = 0.0
4243

43-
// Matrix
44-
private var matrixSprint = false
45-
4644
private enum class Mode {
4745
NCP_STRAFE,
48-
MATRIX_STRAFE_1,
49-
MATRIX_STRAFE_2,
46+
GRIM_STRAFE,
5047
}
5148

5249
private enum class NCPPhase {
@@ -107,21 +104,8 @@ object Speed : Module(
107104

108105
setSpeed(moveSpeed)
109106
}
110-
111-
Mode.MATRIX_STRAFE_1, Mode.MATRIX_STRAFE_2 -> {
112-
if (!isInputting) return@listener
113-
114-
var speed = player.motionDelta
115-
116-
if (speed > 0.21) {
117-
if (mode == Mode.MATRIX_STRAFE_2) return@listener
118-
speed *= 0.9999 // Memetrix
119-
}
120-
121-
if (!player.horizontalCollision)
122-
speed = max(speed, 0.1)
123-
124-
setSpeed(speed)
107+
Mode.GRIM_STRAFE -> {
108+
// ToDo: Implement
125109
}
126110
}
127111
}
@@ -141,25 +125,10 @@ object Speed : Module(
141125

142126
when (mode) {
143127
Mode.NCP_STRAFE -> it.cancel()
144-
Mode.MATRIX_STRAFE_1, Mode.MATRIX_STRAFE_2 -> {
145-
if (!isInputting) return@listener
146-
147-
if (player.isSprinting) {
148-
addSpeed(-0.2, player.moveYaw.toRadian().toDouble())
149-
}
150-
151-
addSpeed(0.2)
152-
}
128+
Mode.GRIM_STRAFE -> {}
153129
}
154130
}
155131

156-
listener<PlayerPacketEvent.Pre> {
157-
if (!shouldWork()) return@listener
158-
if (mode != Mode.MATRIX_STRAFE_1 || !isInputting) return@listener
159-
it.isSprinting = matrixSprint
160-
matrixSprint = !matrixSprint
161-
}
162-
163132
onEnable {
164133
ncpPhase = NCPPhase.SLOWDOWN
165134
ncpSpeed = ncpBaseSpeed

0 commit comments

Comments
 (0)