From 28c994566a5d6cc1187015bd513226a785aa76b0 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 14:23:19 +0100 Subject: [PATCH 01/10] use the players keybinds and use minecrafts bind handling to account for toggle binds --- .../lambda/mixin/MinecraftClientMixin.java | 15 ++++ .../com/lambda/mixin/input/KeyboardMixin.java | 14 ++++ .../module/modules/player/InventoryMove.kt | 74 ++++++------------- .../src/main/resources/lambda.accesswidener | 2 + 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java index 8e0d2bebd..8243ce532 100644 --- a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java +++ b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java @@ -23,10 +23,12 @@ import com.lambda.event.events.InventoryEvent; import com.lambda.event.events.TickEvent; import com.lambda.module.modules.player.Interact; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.option.KeyBinding; import net.minecraft.util.thread.ThreadExecutor; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -91,6 +93,19 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { } } + @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) + private void redirectUnPressAll() { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { + KeyBinding.unpressAll(); + return; + } + KeyBinding.KEYS_BY_ID.values().forEach(bind -> { + if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { + bind.reset(); + } + }); + } + @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z")) boolean injectMultiActon(ClientPlayerInteractionManager instance) { if (instance == null) return true; diff --git a/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java b/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java index 4f061e0ac..ed8d8c85e 100644 --- a/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java +++ b/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java @@ -19,12 +19,17 @@ import com.lambda.event.EventFlow; import com.lambda.event.events.KeyboardEvent; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.Keyboard; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static com.lambda.Lambda.getMc; + @Mixin(Keyboard.class) public class KeyboardMixin { @Inject(method = "onKey", at = @At("HEAD")) @@ -33,6 +38,15 @@ private void onKey(long window, int key, int scancode, int action, int modifiers EventFlow.post(new KeyboardEvent.Press(key, scancode, action, modifiers)); } + @Inject(method = "onKey", at = @At("RETURN")) + private void onKeyTail(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(getMc().currentScreen)) return; + if (InventoryMove.isKeyMovementRelated(key)) { + InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode); + KeyBinding.setKeyPressed(fromCode, action != 0); + } + } + @Inject(method = "onChar", at = @At("HEAD")) private void onChar(long window, int codePoint, int modifiers, CallbackInfo ci) { char[] chars = Character.toChars(codePoint); diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index ad4b2eb9c..522698b6a 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -17,29 +17,15 @@ package com.lambda.module.modules.player -import com.lambda.event.events.MovementEvent -import com.lambda.event.listener.SafeListener.Companion.listen +import com.lambda.Lambda.mc import com.lambda.gui.LambdaScreen -import com.lambda.interaction.request.rotation.Rotation -import com.lambda.interaction.request.rotation.RotationConfig -import com.lambda.interaction.request.rotation.RotationManager.onRotate -import com.lambda.interaction.request.rotation.RotationMode -import com.lambda.interaction.request.rotation.visibilty.lookAt import com.lambda.module.Module import com.lambda.module.tag.ModuleTag -import com.lambda.util.KeyboardUtils.isKeyPressed -import com.lambda.util.math.MathUtils.toDouble -import com.lambda.util.math.MathUtils.toFloatSign -import com.lambda.util.player.MovementUtils.buildMovementInput -import com.lambda.util.player.MovementUtils.mergeFrom import net.minecraft.client.gui.screen.ChatScreen import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.ingame.AnvilScreen import net.minecraft.client.gui.screen.ingame.CommandBlockScreen -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen import net.minecraft.client.gui.screen.ingame.SignEditScreen -import net.minecraft.client.network.ClientPlayerEntity -import org.lwjgl.glfw.GLFW.* object InventoryMove : Module( name = "InventoryMove", @@ -47,47 +33,31 @@ object InventoryMove : Module( defaultTags = setOf(ModuleTag.PLAYER, ModuleTag.MOVEMENT) ) { private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") - private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) /** * Whether the current screen has text inputs or is null */ - val Screen?.hasInputOrNull: Boolean - get() = this is ChatScreen || - this is SignEditScreen || - this is AnvilScreen || - this is CommandBlockScreen || - this is LambdaScreen || - this == null - - init { - listen(20250415) { event -> - if (mc.currentScreen.hasInputOrNull) return@listen - - val forward = isKeyPressed(GLFW_KEY_W).toDouble() - - isKeyPressed(GLFW_KEY_S).toDouble() - - val strafe = isKeyPressed(GLFW_KEY_A).toDouble() - - isKeyPressed(GLFW_KEY_D).toDouble() - - val jump = isKeyPressed(GLFW_KEY_SPACE) - val sneak = isKeyPressed(GLFW_KEY_LEFT_SHIFT) - - player.isSprinting = isKeyPressed(GLFW_KEY_LEFT_CONTROL) - event.input.mergeFrom(buildMovementInput(forward, strafe, jump, sneak)) - } - - onRotate { - if (mc.currentScreen.hasInputOrNull) return@onRotate - - val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - - isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed - val yaw = (isKeyPressed(GLFW_KEY_RIGHT, GLFW_KEY_KP_6).toFloatSign() - - isKeyPressed(GLFW_KEY_LEFT, GLFW_KEY_KP_4).toFloatSign()) * speed - - lookAt( - Rotation(player.yaw + yaw, (player.pitch + pitch).coerceIn(-90f, 90f)) - ).requestBy(rotationConfig) + @JvmStatic + fun hasInputOrNull(screen: Screen?) = + screen is ChatScreen || + screen is SignEditScreen || + screen is AnvilScreen || + screen is CommandBlockScreen || + screen is LambdaScreen || + screen == null + + @JvmStatic + fun isKeyMovementRelated(key: Int): Boolean { + val options = mc.options + return when (key) { + options.forwardKey.boundKey.code, + options.backKey.boundKey.code, + options.leftKey.boundKey.code, + options.rightKey.boundKey.code, + options.jumpKey.boundKey.code, + options.sprintKey.boundKey.code, + options.sneakKey.boundKey.code -> true + else -> false } } } diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener index 31054ddb6..62d336f16 100644 --- a/common/src/main/resources/lambda.accesswidener +++ b/common/src/main/resources/lambda.accesswidener @@ -7,6 +7,8 @@ accessible field net/minecraft/client/MinecraftClient pausedTickDelta F accessible field net/minecraft/client/MinecraftClient thread Ljava/lang/Thread; accessible field net/minecraft/client/MinecraftClient uptimeInTicks J accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key; +accessible field net/minecraft/client/option/KeyBinding KEYS_BY_ID Ljava/util/Map; +accessible method net/minecraft/client/option/KeyBinding reset ()V # World accessible field net/minecraft/client/world/ClientWorld entityManager Lnet/minecraft/client/world/ClientEntityManager; From 1f3840b61d214f6420a08507c1d68ba60afc727f Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 16:16:03 +0100 Subject: [PATCH 02/10] use the players keybinds and use minecrafts bind handling to account for toggle binds --- .../lambda/mixin/MinecraftClientMixin.java | 15 ++++ .../com/lambda/mixin/input/KeyboardMixin.java | 14 ++++ .../module/modules/player/InventoryMove.kt | 76 ++++++++++--------- .../src/main/resources/lambda.accesswidener | 2 + 4 files changed, 70 insertions(+), 37 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java index 8e0d2bebd..8243ce532 100644 --- a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java +++ b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java @@ -23,10 +23,12 @@ import com.lambda.event.events.InventoryEvent; import com.lambda.event.events.TickEvent; import com.lambda.module.modules.player.Interact; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.option.KeyBinding; import net.minecraft.util.thread.ThreadExecutor; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -91,6 +93,19 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { } } + @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) + private void redirectUnPressAll() { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { + KeyBinding.unpressAll(); + return; + } + KeyBinding.KEYS_BY_ID.values().forEach(bind -> { + if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { + bind.reset(); + } + }); + } + @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z")) boolean injectMultiActon(ClientPlayerInteractionManager instance) { if (instance == null) return true; diff --git a/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java b/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java index 4f061e0ac..ed8d8c85e 100644 --- a/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java +++ b/common/src/main/java/com/lambda/mixin/input/KeyboardMixin.java @@ -19,12 +19,17 @@ import com.lambda.event.EventFlow; import com.lambda.event.events.KeyboardEvent; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.Keyboard; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static com.lambda.Lambda.getMc; + @Mixin(Keyboard.class) public class KeyboardMixin { @Inject(method = "onKey", at = @At("HEAD")) @@ -33,6 +38,15 @@ private void onKey(long window, int key, int scancode, int action, int modifiers EventFlow.post(new KeyboardEvent.Press(key, scancode, action, modifiers)); } + @Inject(method = "onKey", at = @At("RETURN")) + private void onKeyTail(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(getMc().currentScreen)) return; + if (InventoryMove.isKeyMovementRelated(key)) { + InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode); + KeyBinding.setKeyPressed(fromCode, action != 0); + } + } + @Inject(method = "onChar", at = @At("HEAD")) private void onChar(long window, int codePoint, int modifiers, CallbackInfo ci) { char[] chars = Character.toChars(codePoint); diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index ad4b2eb9c..d52ea6768 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -17,8 +17,7 @@ package com.lambda.module.modules.player -import com.lambda.event.events.MovementEvent -import com.lambda.event.listener.SafeListener.Companion.listen +import com.lambda.Lambda.mc import com.lambda.gui.LambdaScreen import com.lambda.interaction.request.rotation.Rotation import com.lambda.interaction.request.rotation.RotationConfig @@ -28,57 +27,33 @@ import com.lambda.interaction.request.rotation.visibilty.lookAt import com.lambda.module.Module import com.lambda.module.tag.ModuleTag import com.lambda.util.KeyboardUtils.isKeyPressed -import com.lambda.util.math.MathUtils.toDouble import com.lambda.util.math.MathUtils.toFloatSign -import com.lambda.util.player.MovementUtils.buildMovementInput -import com.lambda.util.player.MovementUtils.mergeFrom import net.minecraft.client.gui.screen.ChatScreen import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.ingame.AnvilScreen import net.minecraft.client.gui.screen.ingame.CommandBlockScreen -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen import net.minecraft.client.gui.screen.ingame.SignEditScreen -import net.minecraft.client.network.ClientPlayerEntity -import org.lwjgl.glfw.GLFW.* +import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_6 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_8 +import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT +import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT +import org.lwjgl.glfw.GLFW.GLFW_KEY_UP object InventoryMove : Module( name = "InventoryMove", description = "Allows you to move with GUIs opened", defaultTags = setOf(ModuleTag.PLAYER, ModuleTag.MOVEMENT) ) { - private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") + private val arrowKeys by setting("Arrow Keys", false, "Allows rotating the players camera using the arrow keys") + private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") { arrowKeys } private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) - /** - * Whether the current screen has text inputs or is null - */ - val Screen?.hasInputOrNull: Boolean - get() = this is ChatScreen || - this is SignEditScreen || - this is AnvilScreen || - this is CommandBlockScreen || - this is LambdaScreen || - this == null - init { - listen(20250415) { event -> - if (mc.currentScreen.hasInputOrNull) return@listen - - val forward = isKeyPressed(GLFW_KEY_W).toDouble() - - isKeyPressed(GLFW_KEY_S).toDouble() - - val strafe = isKeyPressed(GLFW_KEY_A).toDouble() - - isKeyPressed(GLFW_KEY_D).toDouble() - - val jump = isKeyPressed(GLFW_KEY_SPACE) - val sneak = isKeyPressed(GLFW_KEY_LEFT_SHIFT) - - player.isSprinting = isKeyPressed(GLFW_KEY_LEFT_CONTROL) - event.input.mergeFrom(buildMovementInput(forward, strafe, jump, sneak)) - } - onRotate { - if (mc.currentScreen.hasInputOrNull) return@onRotate + if (!arrowKeys || hasInputOrNull(mc.currentScreen)) return@onRotate val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed @@ -90,4 +65,31 @@ object InventoryMove : Module( ).requestBy(rotationConfig) } } + + /** + * Whether the current screen has text inputs or is null + */ + @JvmStatic + fun hasInputOrNull(screen: Screen?) = + screen is ChatScreen || + screen is SignEditScreen || + screen is AnvilScreen || + screen is CommandBlockScreen || + screen is LambdaScreen || + screen == null + + @JvmStatic + fun isKeyMovementRelated(key: Int): Boolean { + val options = mc.options + return when (key) { + options.forwardKey.boundKey.code, + options.backKey.boundKey.code, + options.leftKey.boundKey.code, + options.rightKey.boundKey.code, + options.jumpKey.boundKey.code, + options.sprintKey.boundKey.code, + options.sneakKey.boundKey.code -> true + else -> false + } + } } diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener index 31054ddb6..62d336f16 100644 --- a/common/src/main/resources/lambda.accesswidener +++ b/common/src/main/resources/lambda.accesswidener @@ -7,6 +7,8 @@ accessible field net/minecraft/client/MinecraftClient pausedTickDelta F accessible field net/minecraft/client/MinecraftClient thread Ljava/lang/Thread; accessible field net/minecraft/client/MinecraftClient uptimeInTicks J accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key; +accessible field net/minecraft/client/option/KeyBinding KEYS_BY_ID Ljava/util/Map; +accessible method net/minecraft/client/option/KeyBinding reset ()V # World accessible field net/minecraft/client/world/ClientWorld entityManager Lnet/minecraft/client/world/ClientEntityManager; From f5b61e25c2f3b642c8a06566ea8df9730dd8ef28 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 16:20:25 +0100 Subject: [PATCH 03/10] reintroduce rotating with the arrow keys --- .../lambda/module/modules/player/InventoryMove.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index e32c71089..d52ea6768 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -17,10 +17,22 @@ package com.lambda.module.modules.player -import com.lambda.event.events.MovementEvent import com.lambda.Lambda.mc +import com.lambda.gui.LambdaScreen +import com.lambda.interaction.request.rotation.Rotation +import com.lambda.interaction.request.rotation.RotationConfig +import com.lambda.interaction.request.rotation.RotationManager.onRotate +import com.lambda.interaction.request.rotation.RotationMode +import com.lambda.interaction.request.rotation.visibilty.lookAt +import com.lambda.module.Module +import com.lambda.module.tag.ModuleTag import com.lambda.util.KeyboardUtils.isKeyPressed import com.lambda.util.math.MathUtils.toFloatSign +import net.minecraft.client.gui.screen.ChatScreen +import net.minecraft.client.gui.screen.Screen +import net.minecraft.client.gui.screen.ingame.AnvilScreen +import net.minecraft.client.gui.screen.ingame.CommandBlockScreen +import net.minecraft.client.gui.screen.ingame.SignEditScreen import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 From 0aa3326e28ed81457b88f3f7f0ac2d6c299ae2bf Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 16:16:03 +0100 Subject: [PATCH 04/10] use the players keybinds and use minecrafts bind handling to account for toggle binds --- .../src/main/resources/lambda.accesswidener | 0 .../lambda/mixin/MinecraftClientMixin.java | 15 ++++ .../com/lambda/mixin/input/KeyboardMixin.java | 14 ++++ .../module/modules/player/InventoryMove.kt | 71 +++++++++++-------- 4 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 common/src/main/resources/lambda.accesswidener diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/src/main/java/com/lambda/mixin/MinecraftClientMixin.java index 745502ba5..7c532f01a 100644 --- a/src/main/java/com/lambda/mixin/MinecraftClientMixin.java +++ b/src/main/java/com/lambda/mixin/MinecraftClientMixin.java @@ -28,6 +28,7 @@ import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; @@ -37,6 +38,7 @@ import net.minecraft.client.sound.SoundManager; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; +import net.minecraft.client.option.KeyBinding; import net.minecraft.util.thread.ThreadExecutor; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -131,6 +133,19 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { } } + @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) + private void redirectUnPressAll() { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { + KeyBinding.unpressAll(); + return; + } + KeyBinding.KEYS_BY_ID.values().forEach(bind -> { + if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { + bind.reset(); + } + }); + } + @Redirect(method = "doAttack()Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) private void redirectHandSwing(ClientPlayerEntity instance, Hand hand) { if (this.crosshairTarget == null) return; diff --git a/src/main/java/com/lambda/mixin/input/KeyboardMixin.java b/src/main/java/com/lambda/mixin/input/KeyboardMixin.java index 928bc5667..230746054 100644 --- a/src/main/java/com/lambda/mixin/input/KeyboardMixin.java +++ b/src/main/java/com/lambda/mixin/input/KeyboardMixin.java @@ -19,12 +19,17 @@ import com.lambda.event.EventFlow; import com.lambda.event.events.KeyboardEvent; +import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.Keyboard; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static com.lambda.Lambda.getMc; + @Mixin(Keyboard.class) public class KeyboardMixin { @Inject(method = "onKey", at = @At("HEAD")) @@ -32,6 +37,15 @@ private void onKey(long window, int key, int scancode, int action, int modifiers EventFlow.post(new KeyboardEvent.Press(key, scancode, action, modifiers)); } + @Inject(method = "onKey", at = @At("RETURN")) + private void onKeyTail(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(getMc().currentScreen)) return; + if (InventoryMove.isKeyMovementRelated(key)) { + InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode); + KeyBinding.setKeyPressed(fromCode, action != 0); + } + } + @Inject(method = "onChar", at = @At("HEAD")) private void onChar(long window, int codePoint, int modifiers, CallbackInfo ci) { char[] chars = Character.toChars(codePoint); diff --git a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index 84c9e9111..5c8ce01f7 100644 --- a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -20,6 +20,7 @@ package com.lambda.module.modules.player import com.lambda.event.events.MovementEvent import com.lambda.event.events.UpdateManagerEvent import com.lambda.event.listener.SafeListener.Companion.listen +import com.lambda.Lambda.mc import com.lambda.gui.LambdaScreen import com.lambda.interaction.request.rotating.Rotation import com.lambda.interaction.request.rotating.RotationConfig @@ -28,7 +29,6 @@ import com.lambda.interaction.request.rotating.visibilty.lookAt import com.lambda.module.Module import com.lambda.module.tag.ModuleTag import com.lambda.util.KeyboardUtils.isKeyPressed -import com.lambda.util.math.MathUtils.toDouble import com.lambda.util.math.MathUtils.toFloatSign import com.lambda.util.player.MovementUtils.update import net.minecraft.client.gui.screen.ChatScreen @@ -51,45 +51,27 @@ import org.lwjgl.glfw.GLFW.GLFW_KEY_S import org.lwjgl.glfw.GLFW.GLFW_KEY_SPACE import org.lwjgl.glfw.GLFW.GLFW_KEY_UP import org.lwjgl.glfw.GLFW.GLFW_KEY_W +import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_6 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_8 +import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT +import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT +import org.lwjgl.glfw.GLFW.GLFW_KEY_UP object InventoryMove : Module( name = "InventoryMove", description = "Allows you to move with GUIs opened", tag = ModuleTag.PLAYER, ) { - private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") + private val arrowKeys by setting("Arrow Keys", false, "Allows rotating the players camera using the arrow keys") + private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") { arrowKeys } private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) - /** - * Whether the current screen has text inputs or is null - */ - val Screen?.hasInputOrNull: Boolean - get() = this is ChatScreen || - this is SignEditScreen || - this is AnvilScreen || - this is CommandBlockScreen || - this is LambdaScreen || - this == null - init { - listen(20250415) { event -> - if (mc.currentScreen.hasInputOrNull) return@listen - - val forward = isKeyPressed(GLFW_KEY_W).toDouble() - - isKeyPressed(GLFW_KEY_S).toDouble() - - val strafe = isKeyPressed(GLFW_KEY_A).toDouble() - - isKeyPressed(GLFW_KEY_D).toDouble() - - val jump = isKeyPressed(GLFW_KEY_SPACE) - val sneak = isKeyPressed(GLFW_KEY_LEFT_SHIFT) - val sprint = isKeyPressed(GLFW_KEY_LEFT_CONTROL) - - event.input.update(forward, strafe, jump, sneak, sprint) - } - - listen { - if (mc.currentScreen.hasInputOrNull) return@listen + onRotate { + if (!arrowKeys || hasInputOrNull(mc.currentScreen)) return@onRotate val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed @@ -101,4 +83,31 @@ object InventoryMove : Module( ).requestBy(rotationConfig) } } + + /** + * Whether the current screen has text inputs or is null + */ + @JvmStatic + fun hasInputOrNull(screen: Screen?) = + screen is ChatScreen || + screen is SignEditScreen || + screen is AnvilScreen || + screen is CommandBlockScreen || + screen is LambdaScreen || + screen == null + + @JvmStatic + fun isKeyMovementRelated(key: Int): Boolean { + val options = mc.options + return when (key) { + options.forwardKey.boundKey.code, + options.backKey.boundKey.code, + options.leftKey.boundKey.code, + options.rightKey.boundKey.code, + options.jumpKey.boundKey.code, + options.sprintKey.boundKey.code, + options.sneakKey.boundKey.code -> true + else -> false + } + } } From ebcbfa95a8f60d6cefd3b1a9ad153fa61eaae166 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 14:23:19 +0100 Subject: [PATCH 05/10] use the players keybinds and use minecrafts bind handling to account for toggle binds --- .../lambda/mixin/MinecraftClientMixin.java | 123 ++++++++++++++++++ .../module/modules/player/InventoryMove.kt | 63 +++++++++ 2 files changed, 186 insertions(+) create mode 100644 common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java create mode 100644 common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt diff --git a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java new file mode 100644 index 000000000..8243ce532 --- /dev/null +++ b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java @@ -0,0 +1,123 @@ +/* + * Copyright 2024 Lambda + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.lambda.mixin; + +import com.lambda.Lambda; +import com.lambda.event.EventFlow; +import com.lambda.event.events.ClientEvent; +import com.lambda.event.events.InventoryEvent; +import com.lambda.event.events.TickEvent; +import com.lambda.module.modules.player.Interact; +import com.lambda.module.modules.player.InventoryMove; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.util.thread.ThreadExecutor; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +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.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftClient.class) +public class MinecraftClientMixin { + @Shadow + @Nullable + public Screen currentScreen; + + @Inject(method = "tick", at = @At("HEAD")) + void onTickPre(CallbackInfo ci) { + EventFlow.post(new TickEvent.Pre()); + } + + @Inject(method = "tick", at = @At("RETURN")) + void onTickPost(CallbackInfo ci) { + EventFlow.post(new TickEvent.Post()); + } + + @Inject(method = "render", at = @At("HEAD")) + void onLoopTickPre(CallbackInfo ci) { + EventFlow.post(new TickEvent.Render.Pre()); + } + + @Inject(method = "render", at = @At("RETURN")) + void onLoopTickPost(CallbackInfo ci) { + EventFlow.post(new TickEvent.Render.Post()); + } + + @Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;info(Ljava/lang/String;)V", shift = At.Shift.AFTER, remap = false), method = "stop") + private void onShutdown(CallbackInfo ci) { + EventFlow.post(new ClientEvent.Shutdown()); + } + + /** + * Inject after the thread field is set so that {@link ThreadExecutor#getThread} is available + */ + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;thread:Ljava/lang/Thread;", shift = At.Shift.AFTER, ordinal = 0), method = "run") + private void onStartup(CallbackInfo ci) { + EventFlow.post(new ClientEvent.Startup()); + } + + @Inject(method = "setScreen", at = @At("HEAD")) + private void onScreenOpen(@Nullable Screen screen, CallbackInfo ci) { + if (screen == null) return; + if (screen instanceof ScreenHandlerProvider handledScreen) { + EventFlow.post(new InventoryEvent.Open(handledScreen.getScreenHandler())); + } + } + + @Inject(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;removed()V", shift = At.Shift.AFTER)) + private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { + if (currentScreen == null) return; + if (currentScreen instanceof ScreenHandlerProvider handledScreen) { + EventFlow.post(new InventoryEvent.Close(handledScreen.getScreenHandler())); + } + } + + @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) + private void redirectUnPressAll() { + if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { + KeyBinding.unpressAll(); + return; + } + KeyBinding.KEYS_BY_ID.values().forEach(bind -> { + if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { + bind.reset(); + } + }); + } + + @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z")) + boolean injectMultiActon(ClientPlayerInteractionManager instance) { + if (instance == null) return true; + + if (Interact.INSTANCE.isEnabled() && Interact.getMultiAction()) return false; + return instance.isBreakingBlock(); + } + + @Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isRiding()Z")) + void injectFastPlace(CallbackInfo ci) { + if (!Interact.INSTANCE.isEnabled()) return; + + Lambda.getMc().itemUseCooldown = Interact.getPlaceDelay(); + } +} diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt new file mode 100644 index 000000000..522698b6a --- /dev/null +++ b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -0,0 +1,63 @@ +/* + * Copyright 2025 Lambda + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.lambda.module.modules.player + +import com.lambda.Lambda.mc +import com.lambda.gui.LambdaScreen +import com.lambda.module.Module +import com.lambda.module.tag.ModuleTag +import net.minecraft.client.gui.screen.ChatScreen +import net.minecraft.client.gui.screen.Screen +import net.minecraft.client.gui.screen.ingame.AnvilScreen +import net.minecraft.client.gui.screen.ingame.CommandBlockScreen +import net.minecraft.client.gui.screen.ingame.SignEditScreen + +object InventoryMove : Module( + name = "InventoryMove", + description = "Allows you to move with GUIs opened", + defaultTags = setOf(ModuleTag.PLAYER, ModuleTag.MOVEMENT) +) { + private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") + + /** + * Whether the current screen has text inputs or is null + */ + @JvmStatic + fun hasInputOrNull(screen: Screen?) = + screen is ChatScreen || + screen is SignEditScreen || + screen is AnvilScreen || + screen is CommandBlockScreen || + screen is LambdaScreen || + screen == null + + @JvmStatic + fun isKeyMovementRelated(key: Int): Boolean { + val options = mc.options + return when (key) { + options.forwardKey.boundKey.code, + options.backKey.boundKey.code, + options.leftKey.boundKey.code, + options.rightKey.boundKey.code, + options.jumpKey.boundKey.code, + options.sprintKey.boundKey.code, + options.sneakKey.boundKey.code -> true + else -> false + } + } +} From 74e663587fe70025ace240d32f4d964e732203e9 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 29 Jul 2025 16:20:25 +0100 Subject: [PATCH 06/10] reintroduce rotating with the arrow keys --- .../module/modules/player/InventoryMove.kt | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index 522698b6a..d52ea6768 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -19,20 +19,52 @@ package com.lambda.module.modules.player import com.lambda.Lambda.mc import com.lambda.gui.LambdaScreen +import com.lambda.interaction.request.rotation.Rotation +import com.lambda.interaction.request.rotation.RotationConfig +import com.lambda.interaction.request.rotation.RotationManager.onRotate +import com.lambda.interaction.request.rotation.RotationMode +import com.lambda.interaction.request.rotation.visibilty.lookAt import com.lambda.module.Module import com.lambda.module.tag.ModuleTag +import com.lambda.util.KeyboardUtils.isKeyPressed +import com.lambda.util.math.MathUtils.toFloatSign import net.minecraft.client.gui.screen.ChatScreen import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.ingame.AnvilScreen import net.minecraft.client.gui.screen.ingame.CommandBlockScreen import net.minecraft.client.gui.screen.ingame.SignEditScreen +import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_6 +import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_8 +import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT +import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT +import org.lwjgl.glfw.GLFW.GLFW_KEY_UP object InventoryMove : Module( name = "InventoryMove", description = "Allows you to move with GUIs opened", defaultTags = setOf(ModuleTag.PLAYER, ModuleTag.MOVEMENT) ) { - private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") + private val arrowKeys by setting("Arrow Keys", false, "Allows rotating the players camera using the arrow keys") + private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") { arrowKeys } + private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) + + init { + onRotate { + if (!arrowKeys || hasInputOrNull(mc.currentScreen)) return@onRotate + + val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - + isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed + val yaw = (isKeyPressed(GLFW_KEY_RIGHT, GLFW_KEY_KP_6).toFloatSign() - + isKeyPressed(GLFW_KEY_LEFT, GLFW_KEY_KP_4).toFloatSign()) * speed + + lookAt( + Rotation(player.yaw + yaw, (player.pitch + pitch).coerceIn(-90f, 90f)) + ).requestBy(rotationConfig) + } + } /** * Whether the current screen has text inputs or is null From 4ecbc9f91f3c44f1c252fedf38defb325130e75f Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Fri, 5 Sep 2025 04:09:19 +0100 Subject: [PATCH 07/10] rebase patches --- .../request/rotating/RotationManager.kt | 8 ++++++++ .../module/modules/player/InventoryMove.kt | 20 +------------------ src/main/resources/lambda.accesswidener | 2 ++ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt b/src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt index dbc0d474c..dec63a198 100644 --- a/src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt +++ b/src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt @@ -61,6 +61,14 @@ object RotationManager : RequestHandler( var activeRequest: RotationRequest? = null private var changedThisTick = false + fun Any.onRotate( + alwaysListen: Boolean = false, + priority: Int = 0, + block: SafeContext.() -> Unit + ) = this.listen(priority, alwaysListen) { + block() + } + override fun load(): String { super.load() diff --git a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index 5c8ce01f7..3c50c7af5 100644 --- a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -17,40 +17,22 @@ package com.lambda.module.modules.player -import com.lambda.event.events.MovementEvent -import com.lambda.event.events.UpdateManagerEvent -import com.lambda.event.listener.SafeListener.Companion.listen import com.lambda.Lambda.mc import com.lambda.gui.LambdaScreen import com.lambda.interaction.request.rotating.Rotation import com.lambda.interaction.request.rotating.RotationConfig +import com.lambda.interaction.request.rotating.RotationManager.onRotate import com.lambda.interaction.request.rotating.RotationMode import com.lambda.interaction.request.rotating.visibilty.lookAt import com.lambda.module.Module import com.lambda.module.tag.ModuleTag import com.lambda.util.KeyboardUtils.isKeyPressed import com.lambda.util.math.MathUtils.toFloatSign -import com.lambda.util.player.MovementUtils.update import net.minecraft.client.gui.screen.ChatScreen import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.ingame.AnvilScreen import net.minecraft.client.gui.screen.ingame.CommandBlockScreen import net.minecraft.client.gui.screen.ingame.SignEditScreen -import org.lwjgl.glfw.GLFW.GLFW_KEY_A -import org.lwjgl.glfw.GLFW.GLFW_KEY_D -import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_6 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_8 -import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT -import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT_CONTROL -import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT_SHIFT -import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT -import org.lwjgl.glfw.GLFW.GLFW_KEY_S -import org.lwjgl.glfw.GLFW.GLFW_KEY_SPACE -import org.lwjgl.glfw.GLFW.GLFW_KEY_UP -import org.lwjgl.glfw.GLFW.GLFW_KEY_W import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 diff --git a/src/main/resources/lambda.accesswidener b/src/main/resources/lambda.accesswidener index 225617e30..46df51c1f 100644 --- a/src/main/resources/lambda.accesswidener +++ b/src/main/resources/lambda.accesswidener @@ -9,6 +9,8 @@ transitive-accessible field net/minecraft/client/input/Input movementVector Lnet transitive-accessible field net/minecraft/client/MinecraftClient renderTaskQueue Ljava/util/Queue; transitive-accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key; transitive-accessible method net/minecraft/client/MinecraftClient getWindowTitle ()Ljava/lang/String; +accessible field net/minecraft/client/option/KeyBinding KEYS_BY_ID Ljava/util/Map; +accessible method net/minecraft/client/option/KeyBinding reset ()V # World transitive-accessible field net/minecraft/client/world/ClientWorld entityManager Lnet/minecraft/world/entity/ClientEntityManager; From 01603a561dfa13b169a25057bb97a05864772852 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Sat, 6 Sep 2025 14:16:47 +0100 Subject: [PATCH 08/10] constructors improvements --- .../lambda/mixin/MinecraftClientMixin.java | 13 +++++--- .../com/lambda/mixin/input/KeyboardMixin.java | 10 ++---- .../com/lambda/config/AbstractSetting.kt | 6 ++++ .../lambda/config/groups/RotationSettings.kt | 2 +- .../module/modules/player/InventoryMove.kt | 33 ++++++++++--------- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/src/main/java/com/lambda/mixin/MinecraftClientMixin.java index 7c532f01a..7631d8bf2 100644 --- a/src/main/java/com/lambda/mixin/MinecraftClientMixin.java +++ b/src/main/java/com/lambda/mixin/MinecraftClientMixin.java @@ -17,28 +17,27 @@ package com.lambda.mixin; -import com.lambda.Lambda; import com.lambda.event.EventFlow; import com.lambda.event.events.ClientEvent; import com.lambda.event.events.InventoryEvent; import com.lambda.event.events.TickEvent; import com.lambda.gui.DearImGui; import com.lambda.module.modules.player.Interact; +import com.lambda.module.modules.player.InventoryMove; import com.lambda.module.modules.player.PacketMine; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.lambda.module.modules.player.InventoryMove; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.option.KeyBinding; import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.sound.SoundManager; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; -import net.minecraft.client.option.KeyBinding; import net.minecraft.util.thread.ThreadExecutor; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -53,10 +52,14 @@ public class MinecraftClientMixin { @Shadow @Nullable public Screen currentScreen; + @Shadow @Nullable public HitResult crosshairTarget; + @Shadow + public int itemUseCooldown; + @Inject(method = "close", at = @At("HEAD")) void closeImGui(CallbackInfo ci) { DearImGui.INSTANCE.destroy(); @@ -135,7 +138,7 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) private void redirectUnPressAll() { - if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { + if (!InventoryMove.getShouldMove()) { KeyBinding.unpressAll(); return; } @@ -166,6 +169,6 @@ boolean redirectMultiActon(ClientPlayerInteractionManager instance) { void injectFastPlace(CallbackInfo ci) { if (!Interact.INSTANCE.isEnabled()) return; - Lambda.getMc().itemUseCooldown = Interact.getPlaceDelay(); + itemUseCooldown = Interact.getPlaceDelay(); } } diff --git a/src/main/java/com/lambda/mixin/input/KeyboardMixin.java b/src/main/java/com/lambda/mixin/input/KeyboardMixin.java index 230746054..ffa136983 100644 --- a/src/main/java/com/lambda/mixin/input/KeyboardMixin.java +++ b/src/main/java/com/lambda/mixin/input/KeyboardMixin.java @@ -28,8 +28,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import static com.lambda.Lambda.getMc; - @Mixin(Keyboard.class) public class KeyboardMixin { @Inject(method = "onKey", at = @At("HEAD")) @@ -39,11 +37,9 @@ private void onKey(long window, int key, int scancode, int action, int modifiers @Inject(method = "onKey", at = @At("RETURN")) private void onKeyTail(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { - if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(getMc().currentScreen)) return; - if (InventoryMove.isKeyMovementRelated(key)) { - InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode); - KeyBinding.setKeyPressed(fromCode, action != 0); - } + if (!InventoryMove.getShouldMove() || !InventoryMove.isKeyMovementRelated(key)) return; + InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode); + KeyBinding.setKeyPressed(fromCode, action != 0); } @Inject(method = "onChar", at = @At("HEAD")) diff --git a/src/main/kotlin/com/lambda/config/AbstractSetting.kt b/src/main/kotlin/com/lambda/config/AbstractSetting.kt index 1bc909d40..779029e43 100644 --- a/src/main/kotlin/com/lambda/config/AbstractSetting.kt +++ b/src/main/kotlin/com/lambda/config/AbstractSetting.kt @@ -158,6 +158,12 @@ abstract class AbstractSetting( groups.add(path.toList()) } + fun group(path: NamedEnum?) = apply { + if (path != null) { + groups.add(listOf(path)) + } + } + fun reset(silent: Boolean = false) { if (!silent && value == defaultValue) { ConfigCommand.info(notChangedMessage()) diff --git a/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt b/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt index 1b8be36fb..505d9cfdb 100644 --- a/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt +++ b/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt @@ -30,7 +30,7 @@ import kotlin.random.Random class RotationSettings( c: Configurable, - baseGroup: NamedEnum, + baseGroup: NamedEnum? = null, vis: () -> Boolean = { true } ) : RotationConfig { override var rotationMode by c.setting("Mode", RotationMode.Sync, "How the player is being rotated on interaction", vis).group(baseGroup) diff --git a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt index 3c50c7af5..9efdd934d 100644 --- a/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ b/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt @@ -30,9 +30,9 @@ import com.lambda.util.KeyboardUtils.isKeyPressed import com.lambda.util.math.MathUtils.toFloatSign import net.minecraft.client.gui.screen.ChatScreen import net.minecraft.client.gui.screen.Screen +import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen +import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen import net.minecraft.client.gui.screen.ingame.AnvilScreen -import net.minecraft.client.gui.screen.ingame.CommandBlockScreen -import net.minecraft.client.gui.screen.ingame.SignEditScreen import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 @@ -51,9 +51,24 @@ object InventoryMove : Module( private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") { arrowKeys } private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) + @JvmStatic + val shouldMove get() = isEnabled && !mc.currentScreen.hasInputOrNull + + /** + * Whether the current screen has text inputs or is null + */ + @JvmStatic + val Screen?.hasInputOrNull: Boolean + get() = this is ChatScreen || + this is AbstractSignEditScreen || + this is AnvilScreen || + this is AbstractCommandBlockScreen || + this is LambdaScreen || + this == null + init { onRotate { - if (!arrowKeys || hasInputOrNull(mc.currentScreen)) return@onRotate + if (!arrowKeys || mc.currentScreen.hasInputOrNull) return@onRotate val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed @@ -66,18 +81,6 @@ object InventoryMove : Module( } } - /** - * Whether the current screen has text inputs or is null - */ - @JvmStatic - fun hasInputOrNull(screen: Screen?) = - screen is ChatScreen || - screen is SignEditScreen || - screen is AnvilScreen || - screen is CommandBlockScreen || - screen is LambdaScreen || - screen == null - @JvmStatic fun isKeyMovementRelated(key: Int): Boolean { val options = mc.options From ea385d72c5e2be6b38cac9c84c39b83d5bc7c615 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Sun, 7 Sep 2025 02:09:09 +0100 Subject: [PATCH 09/10] delete unused files --- .../lambda/mixin/MinecraftClientMixin.java | 123 ------------------ .../module/modules/player/InventoryMove.kt | 95 -------------- .../src/main/resources/lambda.accesswidener | 85 ------------ 3 files changed, 303 deletions(-) delete mode 100644 common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java delete mode 100644 common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt delete mode 100644 common/src/main/resources/lambda.accesswidener diff --git a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java b/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java deleted file mode 100644 index 8243ce532..000000000 --- a/common/src/main/java/com/lambda/mixin/MinecraftClientMixin.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2024 Lambda - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.lambda.mixin; - -import com.lambda.Lambda; -import com.lambda.event.EventFlow; -import com.lambda.event.events.ClientEvent; -import com.lambda.event.events.InventoryEvent; -import com.lambda.event.events.TickEvent; -import com.lambda.module.modules.player.Interact; -import com.lambda.module.modules.player.InventoryMove; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.util.thread.ThreadExecutor; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -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.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftClient.class) -public class MinecraftClientMixin { - @Shadow - @Nullable - public Screen currentScreen; - - @Inject(method = "tick", at = @At("HEAD")) - void onTickPre(CallbackInfo ci) { - EventFlow.post(new TickEvent.Pre()); - } - - @Inject(method = "tick", at = @At("RETURN")) - void onTickPost(CallbackInfo ci) { - EventFlow.post(new TickEvent.Post()); - } - - @Inject(method = "render", at = @At("HEAD")) - void onLoopTickPre(CallbackInfo ci) { - EventFlow.post(new TickEvent.Render.Pre()); - } - - @Inject(method = "render", at = @At("RETURN")) - void onLoopTickPost(CallbackInfo ci) { - EventFlow.post(new TickEvent.Render.Post()); - } - - @Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;info(Ljava/lang/String;)V", shift = At.Shift.AFTER, remap = false), method = "stop") - private void onShutdown(CallbackInfo ci) { - EventFlow.post(new ClientEvent.Shutdown()); - } - - /** - * Inject after the thread field is set so that {@link ThreadExecutor#getThread} is available - */ - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;thread:Ljava/lang/Thread;", shift = At.Shift.AFTER, ordinal = 0), method = "run") - private void onStartup(CallbackInfo ci) { - EventFlow.post(new ClientEvent.Startup()); - } - - @Inject(method = "setScreen", at = @At("HEAD")) - private void onScreenOpen(@Nullable Screen screen, CallbackInfo ci) { - if (screen == null) return; - if (screen instanceof ScreenHandlerProvider handledScreen) { - EventFlow.post(new InventoryEvent.Open(handledScreen.getScreenHandler())); - } - } - - @Inject(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;removed()V", shift = At.Shift.AFTER)) - private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) { - if (currentScreen == null) return; - if (currentScreen instanceof ScreenHandlerProvider handledScreen) { - EventFlow.post(new InventoryEvent.Close(handledScreen.getScreenHandler())); - } - } - - @Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V")) - private void redirectUnPressAll() { - if (InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)) { - KeyBinding.unpressAll(); - return; - } - KeyBinding.KEYS_BY_ID.values().forEach(bind -> { - if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { - bind.reset(); - } - }); - } - - @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z")) - boolean injectMultiActon(ClientPlayerInteractionManager instance) { - if (instance == null) return true; - - if (Interact.INSTANCE.isEnabled() && Interact.getMultiAction()) return false; - return instance.isBreakingBlock(); - } - - @Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isRiding()Z")) - void injectFastPlace(CallbackInfo ci) { - if (!Interact.INSTANCE.isEnabled()) return; - - Lambda.getMc().itemUseCooldown = Interact.getPlaceDelay(); - } -} diff --git a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt b/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt deleted file mode 100644 index d52ea6768..000000000 --- a/common/src/main/kotlin/com/lambda/module/modules/player/InventoryMove.kt +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2025 Lambda - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.lambda.module.modules.player - -import com.lambda.Lambda.mc -import com.lambda.gui.LambdaScreen -import com.lambda.interaction.request.rotation.Rotation -import com.lambda.interaction.request.rotation.RotationConfig -import com.lambda.interaction.request.rotation.RotationManager.onRotate -import com.lambda.interaction.request.rotation.RotationMode -import com.lambda.interaction.request.rotation.visibilty.lookAt -import com.lambda.module.Module -import com.lambda.module.tag.ModuleTag -import com.lambda.util.KeyboardUtils.isKeyPressed -import com.lambda.util.math.MathUtils.toFloatSign -import net.minecraft.client.gui.screen.ChatScreen -import net.minecraft.client.gui.screen.Screen -import net.minecraft.client.gui.screen.ingame.AnvilScreen -import net.minecraft.client.gui.screen.ingame.CommandBlockScreen -import net.minecraft.client.gui.screen.ingame.SignEditScreen -import org.lwjgl.glfw.GLFW.GLFW_KEY_DOWN -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_2 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_4 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_6 -import org.lwjgl.glfw.GLFW.GLFW_KEY_KP_8 -import org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT -import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT -import org.lwjgl.glfw.GLFW.GLFW_KEY_UP - -object InventoryMove : Module( - name = "InventoryMove", - description = "Allows you to move with GUIs opened", - defaultTags = setOf(ModuleTag.PLAYER, ModuleTag.MOVEMENT) -) { - private val arrowKeys by setting("Arrow Keys", false, "Allows rotating the players camera using the arrow keys") - private val speed by setting("Rotation Speed", 5, 1..20, 1, unit = "°/tick") { arrowKeys } - private val rotationConfig = RotationConfig.Instant(RotationMode.Lock) - - init { - onRotate { - if (!arrowKeys || hasInputOrNull(mc.currentScreen)) return@onRotate - - val pitch = (isKeyPressed(GLFW_KEY_DOWN, GLFW_KEY_KP_2).toFloatSign() - - isKeyPressed(GLFW_KEY_UP, GLFW_KEY_KP_8).toFloatSign()) * speed - val yaw = (isKeyPressed(GLFW_KEY_RIGHT, GLFW_KEY_KP_6).toFloatSign() - - isKeyPressed(GLFW_KEY_LEFT, GLFW_KEY_KP_4).toFloatSign()) * speed - - lookAt( - Rotation(player.yaw + yaw, (player.pitch + pitch).coerceIn(-90f, 90f)) - ).requestBy(rotationConfig) - } - } - - /** - * Whether the current screen has text inputs or is null - */ - @JvmStatic - fun hasInputOrNull(screen: Screen?) = - screen is ChatScreen || - screen is SignEditScreen || - screen is AnvilScreen || - screen is CommandBlockScreen || - screen is LambdaScreen || - screen == null - - @JvmStatic - fun isKeyMovementRelated(key: Int): Boolean { - val options = mc.options - return when (key) { - options.forwardKey.boundKey.code, - options.backKey.boundKey.code, - options.leftKey.boundKey.code, - options.rightKey.boundKey.code, - options.jumpKey.boundKey.code, - options.sprintKey.boundKey.code, - options.sneakKey.boundKey.code -> true - else -> false - } - } -} diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener deleted file mode 100644 index 62d336f16..000000000 --- a/common/src/main/resources/lambda.accesswidener +++ /dev/null @@ -1,85 +0,0 @@ -accessWidener v2 named -# MC -accessible field net/minecraft/client/MinecraftClient itemUseCooldown I -accessible field net/minecraft/client/MinecraftClient attackCooldown I -accessible field net/minecraft/client/MinecraftClient paused Z -accessible field net/minecraft/client/MinecraftClient pausedTickDelta F -accessible field net/minecraft/client/MinecraftClient thread Ljava/lang/Thread; -accessible field net/minecraft/client/MinecraftClient uptimeInTicks J -accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key; -accessible field net/minecraft/client/option/KeyBinding KEYS_BY_ID Ljava/util/Map; -accessible method net/minecraft/client/option/KeyBinding reset ()V - -# World -accessible field net/minecraft/client/world/ClientWorld entityManager Lnet/minecraft/client/world/ClientEntityManager; -accessible field net/minecraft/client/world/ClientEntityManager cache Lnet/minecraft/world/entity/SectionedEntityCache; -accessible field net/minecraft/world/entity/EntityTrackingSection collection Lnet/minecraft/util/collection/TypeFilterableList; -accessible field net/minecraft/client/world/ClientChunkManager chunks Lnet/minecraft/client/world/ClientChunkManager$ClientChunkMap; -accessible field net/minecraft/client/world/ClientChunkManager$ClientChunkMap chunks Ljava/util/concurrent/atomic/AtomicReferenceArray; -accessible field net/minecraft/client/network/ClientPlayerInteractionManager currentBreakingProgress F -accessible field net/minecraft/client/network/ClientPlayerInteractionManager blockBreakingCooldown I -accessible field net/minecraft/client/network/ClientPlayerInteractionManager currentBreakingPos Lnet/minecraft/util/math/BlockPos; - -# Entity -accessible field net/minecraft/entity/projectile/FireworkRocketEntity shooter Lnet/minecraft/entity/LivingEntity; -accessible method net/minecraft/entity/Entity movementInputToVelocity (Lnet/minecraft/util/math/Vec3d;FF)Lnet/minecraft/util/math/Vec3d; -accessible method net/minecraft/entity/passive/AbstractHorseEntity setHorseFlag (IZ)V -accessible method net/minecraft/entity/passive/AbstractHorseEntity updateSaddle ()V -accessible field net/minecraft/entity/LivingEntity lastAttackedTicks I -accessible method net/minecraft/entity/Entity setFlag (IZ)V -accessible field net/minecraft/client/network/AbstractClientPlayerEntity playerListEntry Lnet/minecraft/client/network/PlayerListEntry; -accessible field net/minecraft/entity/LivingEntity jumpingCooldown I -accessible field net/minecraft/entity/Entity pos Lnet/minecraft/util/math/Vec3d; -accessible field net/minecraft/client/network/ClientPlayerInteractionManager lastSelectedSlot I -accessible method net/minecraft/entity/LivingEntity modifyAppliedDamage (Lnet/minecraft/entity/damage/DamageSource;F)F -accessible method net/minecraft/entity/LivingEntity applyArmorToDamage (Lnet/minecraft/entity/damage/DamageSource;F)F -accessible method net/minecraft/entity/LivingEntity getHandSwingDuration ()I - -# Camera -accessible method net/minecraft/client/render/Camera setPos (DDD)V -accessible method net/minecraft/client/render/Camera setRotation (FF)V - -# Renderer -accessible field com/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer id I -accessible field net/minecraft/client/render/BufferRenderer currentVertexBuffer Lnet/minecraft/client/gl/VertexBuffer; -accessible field net/minecraft/client/texture/NativeImage pointer J -accessible class net/minecraft/client/gui/screen/SplashOverlay$LogoTexture - -# Text -accessible field net/minecraft/text/Style color Lnet/minecraft/text/TextColor; -accessible field net/minecraft/text/Style bold Ljava/lang/Boolean; -accessible field net/minecraft/text/Style italic Ljava/lang/Boolean; -accessible field net/minecraft/text/Style underlined Ljava/lang/Boolean; -accessible field net/minecraft/text/Style strikethrough Ljava/lang/Boolean; -accessible field net/minecraft/text/Style obfuscated Ljava/lang/Boolean; -accessible field net/minecraft/text/Style clickEvent Lnet/minecraft/text/ClickEvent; -accessible field net/minecraft/text/Style hoverEvent Lnet/minecraft/text/HoverEvent; -accessible field net/minecraft/text/Style insertion Ljava/lang/String; -accessible field net/minecraft/text/Style font Lnet/minecraft/util/Identifier; -accessible method net/minecraft/text/Style (Lnet/minecraft/text/TextColor;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Lnet/minecraft/text/ClickEvent;Lnet/minecraft/text/HoverEvent;Ljava/lang/String;Lnet/minecraft/util/Identifier;)V - -# Network -accessible field net/minecraft/client/network/ClientPlayNetworkHandler playerListEntries Ljava/util/Map; -accessible field net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket entityId I -accessible field net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket type Lnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler; -accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler -accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractAtHandler -accessible field net/minecraft/network/packet/s2c/play/EntityS2CPacket id I -accessible method net/minecraft/network/ClientConnection handlePacket (Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V -accessible field net/minecraft/network/ClientConnection packetsSentCounter I -accessible field net/minecraft/network/ClientConnection packetsReceivedCounter I -accessible field net/minecraft/network/packet/c2s/login/LoginKeyC2SPacket encryptedSecretKey [B -accessible field net/minecraft/network/packet/c2s/login/LoginKeyC2SPacket nonce [B -accessible method net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket (IZLnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler;)V -accessible field net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket ATTACK Lnet/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler; - -# Math -accessible method net/minecraft/util/math/Vec3i setX (I)Lnet/minecraft/util/math/Vec3i; -accessible method net/minecraft/util/math/Vec3i setY (I)Lnet/minecraft/util/math/Vec3i; -accessible method net/minecraft/util/math/Vec3i setZ (I)Lnet/minecraft/util/math/Vec3i; - -# Other -accessible field net/minecraft/world/explosion/Explosion behavior Lnet/minecraft/world/explosion/ExplosionBehavior; -accessible field net/minecraft/structure/StructureTemplate blockInfoLists Ljava/util/List; -accessible method net/minecraft/item/BlockItem getPlacementState (Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState; -accessible field net/minecraft/client/gui/screen/ingame/HandledScreen focusedSlot Lnet/minecraft/screen/slot/Slot; From 4c8264375ecd6e0f06b973d7898a6f60150642d0 Mon Sep 17 00:00:00 2001 From: Constructor Date: Sun, 7 Sep 2025 03:19:17 +0200 Subject: [PATCH 10/10] Use null pattern --- src/main/kotlin/com/lambda/config/AbstractSetting.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/config/AbstractSetting.kt b/src/main/kotlin/com/lambda/config/AbstractSetting.kt index 779029e43..c7c8fb577 100644 --- a/src/main/kotlin/com/lambda/config/AbstractSetting.kt +++ b/src/main/kotlin/com/lambda/config/AbstractSetting.kt @@ -159,9 +159,7 @@ abstract class AbstractSetting( } fun group(path: NamedEnum?) = apply { - if (path != null) { - groups.add(listOf(path)) - } + path?.let { groups.add(listOf(it)) } } fun reset(silent: Boolean = false) {