Skip to content

Commit

Permalink
Allow Up/Down Arrow to Scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Dec 27, 2024
1 parent 5cbe59b commit bf69fc0
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.gui.GuiScreen;

import org.lwjgl.input.Keyboard;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -25,7 +26,7 @@

/**
* Allows accessing needed functions and fields, and initializes playerPos field in InfoList. Also fills up
* LabsClientCache.
* LabsClientCache, calls proper resetting of scrollbar in custom places, and allows arrows to scroll.
*/
@Mixin(value = GuiAdvancedMemoryCard.class, remap = false)
public abstract class GuiAdvancedMemoryCardMixin extends GuiScreen implements AccessibleGuiAdvancedMemoryCard {
Expand Down Expand Up @@ -99,6 +100,19 @@ private void properlyResetScrollbarFilterClear(int mouseX, int mouseY, int mouse
labs$properlyResetScrollbar();
}

@Inject(method = "keyTyped", at = @At("HEAD"), cancellable = true, remap = true)
private void allowArrowScroll(char typedChar, int keyCode, CallbackInfo ci) {
if (keyCode == Keyboard.KEY_UP) {
scrollBar.wheel(1);
ci.cancel();
return;
}
if (keyCode == Keyboard.KEY_DOWN) {
scrollBar.wheel(-1);
ci.cancel();
}
}

@Inject(method = "keyTyped",
at = @At(value = "INVOKE",
target = "Lcom/projecturanus/betterp2p/client/gui/InfoList;refilter()V",
Expand Down

0 comments on commit bf69fc0

Please sign in to comment.