Skip to content

Commit b515d94

Browse files
committed
Merge branch 'master' into syncedPlayerInventoryManager
2 parents 55b9743 + d423693 commit b515d94

File tree

2 files changed

+92
-4
lines changed

2 files changed

+92
-4
lines changed

src/main/kotlin/com/lambda/client/gui/hudgui/elements/client/ModuleList.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ internal object ModuleList : HudElement(
3434
private val rainbow by setting("Rainbow", true)
3535
private val rainbowLength by setting("Rainbow Length", 10.0f, 1.0f..20.0f, 0.5f, { rainbow })
3636
private val indexedHue by setting("Indexed Hue", 0.5f, 0.0f..1.0f, 0.05f, { rainbow })
37+
private val saturation by setting("Saturation", 1.0f, 0.0f..1.0f, 0.05f, { rainbow })
38+
private val brightness by setting("Brightness", 1.0f, 0.0f..1.0f, 0.05f, { rainbow })
3739
private val primary by setting("Primary Color", ColorHolder(155, 144, 255), false)
3840
private val secondary by setting("Secondary Color", ColorHolder(255, 255, 255), false)
3941

@@ -103,7 +105,6 @@ internal object ModuleList : HudElement(
103105
}
104106

105107
private fun drawModuleList() {
106-
val primaryHsb = Color.RGBtoHSB(primary.r, primary.g, primary.b, null)
107108
val lengthMs = rainbowLength * 1000.0f
108109
val timedHue = System.currentTimeMillis() % lengthMs.toLong() / lengthMs
109110

@@ -127,7 +128,7 @@ internal object ModuleList : HudElement(
127128

128129
if (rainbow) {
129130
val hue = timedHue + indexedHue * 0.05f * index++
130-
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, primaryHsb[1], primaryHsb[2]))
131+
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, saturation, brightness))
131132
module.newTextLine(color).drawLine(progress, true, HAlign.LEFT, FontRenderAdapter.useCustomFont)
132133
} else {
133134
textLine.drawLine(progress, true, HAlign.LEFT, FontRenderAdapter.useCustomFont)

src/main/kotlin/com/lambda/client/module/modules/movement/AntiLevitation.kt

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,107 @@
11
package com.lambda.client.module.modules.movement
22

3+
import com.lambda.client.event.events.PlayerTravelEvent
4+
import com.lambda.client.manager.managers.TimerManager.modifyTimer
5+
import com.lambda.client.manager.managers.TimerManager.resetTimer
36
import com.lambda.client.module.Category
47
import com.lambda.client.module.Module
8+
import com.lambda.client.util.MovementUtils
9+
import com.lambda.client.util.MovementUtils.calcMoveYaw
10+
import com.lambda.client.util.MovementUtils.isMoving
11+
import com.lambda.client.util.MovementUtils.setSpeed
12+
import com.lambda.client.util.text.MessageSendHelper
513
import com.lambda.client.util.threads.safeListener
614
import net.minecraft.init.MobEffects
715
import net.minecraftforge.fml.common.gameevent.TickEvent
16+
import kotlin.math.cos
17+
import kotlin.math.sin
818

919
object AntiLevitation : Module(
1020
name = "AntiLevitation",
11-
description = "Removes levitation potion effect",
21+
description = "Removes levitation effect (boring) or abuse it (epic)",
1222
category = Category.MOVEMENT
1323
) {
24+
private val mode by setting("Mode", Mode.LEGIT, description = "The AntiLevitation mode")
25+
26+
/* Flight mode */
27+
private val vertical by setting("Only Vertical", false, { mode == Mode.FLIGHT }, description = "doesn't apply extra speed when enabled")
28+
private val yMotion by setting("Y Motion", 0.002f, 0.0f..0.02f, 0.001f, { mode == Mode.FLIGHT }, description = "The Y Motion that is applied when moving to bypass the anticheat")
29+
private val speed by setting("Speed", 0.28f, 0.15f..0.3f, 0.005f, { !vertical && mode == Mode.FLIGHT }, description = "The speed you fly at")
30+
private val timer by setting("Timer Boost", true, { !vertical && mode == Mode.FLIGHT }, description = "Use timer for a slight speed boost")
31+
private val timerSpeed by setting("Timer Speed", 1.15f, 1.1f..1.2f, 0.01f, { timer && !vertical && mode == Mode.FLIGHT }, description = "The timer modifier")
32+
33+
/* Legit mode */
34+
private val legitYMotion by setting("Motion Up", 0.018f, 0.001f..0.1f, 0.001f, { mode == Mode.LEGIT }, description = "The Y Motion that is applied when moving to bypass the anticheat")
35+
private val boost by setting("Sprint Boost", true, { mode == Mode.LEGIT }, description = "Gives you extra motion when control is pressed")
36+
37+
/* Jump motion (used by flight mode and legit mode) */
38+
private val jumpMotion by setting("Jump Motion", 0.099f, 0.090f..0.10f, 0.001f, { mode == Mode.FLIGHT || mode == Mode.LEGIT }, description = "The Y Motion that is applied when you press space")
39+
40+
private var ready = false
41+
42+
private enum class Mode {
43+
REMOVE, FLIGHT, LEGIT
44+
}
45+
1446
init {
47+
onDisable {
48+
ready = false
49+
resetTimer()
50+
}
51+
1552
safeListener<TickEvent.ClientTickEvent> {
1653
if (player.isPotionActive(MobEffects.LEVITATION)) {
17-
player.removeActivePotionEffect(MobEffects.LEVITATION)
54+
if (mode != Mode.REMOVE && !ready) {
55+
ready = true
56+
MessageSendHelper.sendChatMessage("You can now fly.")
57+
}
58+
if (mode == Mode.REMOVE) {
59+
player.removeActivePotionEffect(MobEffects.LEVITATION)
60+
MessageSendHelper.sendChatMessage("Removed levitation effect.")
61+
}
62+
} else {
63+
if (ready) {
64+
resetTimer()
65+
MessageSendHelper.sendWarningMessage("Levitation ran out. Brace for impact....")
66+
player.setVelocity(0.0, 0.0, 0.0)
67+
ready = false
68+
}
69+
}
70+
}
71+
72+
safeListener<PlayerTravelEvent> {
73+
if (!ready) return@safeListener
74+
75+
if (mode == Mode.FLIGHT) {
76+
if (MovementUtils.isInputting && !vertical) {
77+
player.isSprinting = false //disables sprinting so you can't go too fast
78+
setSpeed(speed.toDouble())
79+
if (timer && !vertical) modifyTimer(50.0f / timerSpeed)
80+
} else {
81+
player.motionY = 0.0
82+
/* Make the motion slowly become 0, so it flattens out smooth */
83+
player.motionX *= 0.8
84+
player.motionZ *= 0.8
85+
}
86+
87+
if (MovementUtils.isInputting || player.isMoving) {
88+
player.motionY = yMotion.toDouble()
89+
}
90+
91+
if (mc.gameSettings.keyBindJump.isKeyDown) player.motionY = jumpMotion.toDouble()
92+
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = -0.49
93+
} else if (mode == Mode.LEGIT) {
94+
/* Override vanilla motion with our own motion */
95+
player.motionY = legitYMotion.toDouble()
96+
97+
if (mc.gameSettings.keyBindJump.isKeyDown) player.motionY = jumpMotion.toDouble()
98+
if (mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = 0.005
99+
100+
if (mc.gameSettings.keyBindSprint.isKeyDown && player.isSprinting && boost) { //player must be sprinting so you can only boost when you press W
101+
val yaw = calcMoveYaw()
102+
player.motionX = -sin(yaw) * 0.26
103+
player.motionZ = cos(yaw) * 0.26
104+
}
18105
}
19106
}
20107
}

0 commit comments

Comments
 (0)