Skip to content

Commit fe691b1

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/taskflow
2 parents 55ef7d3 + 87f99e9 commit fe691b1

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

common/src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import net.minecraft.util.math.BlockPos
1919
import org.apache.logging.log4j.LogManager
2020
import org.apache.logging.log4j.Logger
2121
import java.awt.Color
22-
import java.lang.Thread.sleep
2322
import java.util.*
2423

2524

@@ -47,10 +46,10 @@ object Lambda {
4746
.registerTypeAdapter(Optional::class.java, OptionalSerializer)
4847
.create()
4948

50-
fun initialize(onRender: () -> Unit = {}) {
49+
fun initialize(block: () -> Unit) {
5150
recordRenderCall {
5251
Loader.initialize()
53-
onRender()
52+
block()
5453
}
5554
}
5655
}

common/src/main/kotlin/com/lambda/http/Request.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ data class Request(
3535
*
3636
* @param name The full name of the file to be cached.
3737
* @param maxAge The maximum age of the cached resource. Default is 4 days.
38-
*
39-
* @return A pair containing the cached file and a boolean indicating whether the file was downloaded.
4038
*/
41-
fun maybeDownload(
42-
name: String,
43-
maxAge: Duration = 7.days,
44-
): File {
39+
fun maybeDownload(name: String, maxAge: Duration = 7.days): File {
4540
val file = cache.resolve(name).createIfNotExists()
4641

4742
if (

common/src/main/kotlin/com/lambda/module/modules/client/ClickGui.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object ClickGui : Module(
4646
LambdaHudGui.close()
4747
}
4848

49-
listener<KeyPressEvent> { event ->
49+
listener<KeyPressEvent>(priority = Int.MAX_VALUE) { event ->
5050
if (mc.options.commandKey.isPressed) return@listener
5151
if (keybind == KeyCode.UNBOUND) return@listener
5252
if (event.translated != keybind) return@listener

common/src/main/kotlin/com/lambda/util/BaritoneUtils.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,26 @@ object BaritoneUtils {
1111
@JvmStatic
1212
val primary: IBaritone = baritone.primaryBaritone
1313

14+
/**
15+
* Whether Baritone is currently pathing
16+
*/
1417
val isPathing: Boolean
1518
get() = primary.pathingBehavior.isPathing
1619

20+
/**
21+
* Whether Baritone is active (pathing, calculating goal, etc.)
22+
*/
1723
val isActive: Boolean
1824
get() = primary.customGoalProcess.isActive || primary.pathingBehavior.isPathing || primary.pathingControlManager.mostRecentInControl()
1925
.orElse(null)?.isActive == true
2026

27+
/**
28+
* Sets the current Baritone goal and starts pathing
29+
*/
2130
fun setGoalAndPath(goal: Goal) = primary.customGoalProcess.setGoalAndPath(goal)
2231

32+
/**
33+
* Force cancel Baritone
34+
*/
2335
fun cancel() = primary.pathingBehavior.cancelEverything()
2436
}

common/src/main/kotlin/com/lambda/util/KeyCode.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ enum class KeyCode(val keyCode: Int) {
141141
fun fromKeyCode(keyCode: Int) = keyCodeMap[keyCode] ?: UNBOUND
142142
fun fromKeyName(name: String) = nameMap[name.lowercase()] ?: UNBOUND
143143

144+
/**
145+
* Maps a US virtual keyboard input to a [KeyCode].
146+
*
147+
* For key codes in the keypad range, the [keyCode] is directly mapped.
148+
* If the key corresponds to a printable character or letter, it is mapped
149+
* to its corresponding [KeyCode] based on the US layout.
150+
*
151+
* @param keyCode The key code to map.
152+
* @param scanCode The scan code of the key.
153+
* @return The corresponding [KeyCode].
154+
*/
144155
fun virtualMapUS(keyCode: Int, scanCode: Int): KeyCode {
145156
if (keyCode in GLFW.GLFW_KEY_KP_0..GLFW.GLFW_KEY_KP_EQUAL) return fromKeyCode(keyCode)
146157

0 commit comments

Comments
 (0)