File tree Expand file tree Collapse file tree 4 files changed +26
-9
lines changed
common/src/main/kotlin/com/lambda Expand file tree Collapse file tree 4 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import net.minecraft.util.math.BlockPos
1919import org.apache.logging.log4j.LogManager
2020import org.apache.logging.log4j.Logger
2121import java.awt.Color
22- import java.lang.Thread.sleep
2322import 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}
Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments