Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 42
Improvement: use minecraft's keybind structure for inventory move#131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
28c99451f3840bb87df54f5b61e2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
Comment on lines
+102
to
+106
CopilotAI | ||||||||||||||||||||||
| KeyBinding.KEYS_BY_ID.values().forEach(bind -> { | |
| if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { | |
| bind.reset(); | |
| } | |
| }); | |
| for (KeyBindingbind : KeyBinding.KEYS_BY_ID.values()) { | |
| if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) { | |
| bind.reset(); | |
| } | |
| } |
CopilotAIAug 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
InventoryMove.INSTANCE.isDisabled() || InventoryMove.hasInputOrNull(currentScreen)is duplicated in KeyboardMixin. Consider extracting this logic into a utility method to reduce code duplication.