aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatalia Spence <52349324+Septikai@users.noreply.github.com>2025-11-17 18:49:14 +0000
committerLinnea Gräf <nea@nea.moe>2025-11-17 23:04:40 +0100
commit73ff3648c3fc52b817456bfad3ff0380a55cdc43 (patch)
tree64ea3ad1df4993deacded7de1b2874a47dc352ed
parent215178c650d38a4a77fdef6dc8815c07bef29c25 (diff)
downloadFirmament-mc-1.21.7.tar.gz
Firmament-mc-1.21.7.tar.bz2
Firmament-mc-1.21.7.zip
feat: add option to allow scrolling on chat peekmc-1.21.7
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ChatPeekScrollPatch.java27
-rw-r--r--src/main/kotlin/features/fixes/Fixes.kt5
-rw-r--r--translations/en_us.json2
3 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/ChatPeekScrollPatch.java b/src/main/java/moe/nea/firmament/mixins/ChatPeekScrollPatch.java
new file mode 100644
index 0000000..268bd99
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/ChatPeekScrollPatch.java
@@ -0,0 +1,27 @@
+package moe.nea.firmament.mixins;
+
+import moe.nea.firmament.features.fixes.Fixes;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.Mouse;
+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.ModifyVariable;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(Mouse.class)
+public class ChatPeekScrollPatch {
+
+ @Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;getSelectedSlot()I"), cancellable = true)
+ public void onHotbarScrollWhilePeeking(long window, double horizontal, double vertical, CallbackInfo ci) {
+ if (Fixes.INSTANCE.shouldPeekChat() && Fixes.INSTANCE.shouldScrollPeekedChat()) ci.cancel();
+ }
+
+ @ModifyVariable(method = "onMouseScroll", at = @At(value = "STORE"), ordinal = 0)
+ public int onGetChatHud(int i) {
+ if (Fixes.INSTANCE.shouldPeekChat() && Fixes.INSTANCE.shouldScrollPeekedChat())
+ MinecraftClient.getInstance().inGameHud.getChatHud().scroll(i);
+ return i;
+ }
+
+}
diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt
index e7027ac..54218f5 100644
--- a/src/main/kotlin/features/fixes/Fixes.kt
+++ b/src/main/kotlin/features/fixes/Fixes.kt
@@ -25,6 +25,7 @@ object Fixes {
val autoSprintUnderWater by toggle("auto-sprint-underwater") { true }
val autoSprintHud by position("auto-sprint-hud", 80, 10) { Vector2i() }
val peekChat by keyBindingWithDefaultUnbound("peek-chat")
+ val peekChatScroll by toggle("peek-chat-scroll") { false }
val hidePotionEffects by toggle("hide-mob-effects") { false }
val hidePotionEffectsHud by toggle("hide-potion-effects-hud") { false }
val noHurtCam by toggle("disable-hurt-cam") { false }
@@ -77,4 +78,8 @@ object Fixes {
fun shouldPeekChat(): Boolean {
return TConfig.peekChat.isPressed(atLeast = true)
}
+
+ fun shouldScrollPeekedChat(): Boolean {
+ return TConfig.peekChatScroll
+ }
}
diff --git a/translations/en_us.json b/translations/en_us.json
index c871714..a939e94 100644
--- a/translations/en_us.json
+++ b/translations/en_us.json
@@ -182,6 +182,8 @@
"firmament.config.fixes.hide-slot-highlights": "Hide Slot Highlights",
"firmament.config.fixes.hide-slot-highlights.description": "Hide slot highlights for items with disabled tooltip. This makes /sbmenu look nicer with smooth texture packs.",
"firmament.config.fixes.peek-chat": "Peek Chat",
+ "firmament.config.fixes.peek-chat-scroll": "Scroll Peeked Chat",
+ "firmament.config.fixes.peek-chat-scroll.description": "Allow scrolling chat while peeking.",
"firmament.config.fixes.peek-chat.description": "Hold this keybinding to view the chat as if you have it opened, but while still being able to control your character.",
"firmament.config.fixes.player-skins": "Fix unsigned Player Skins",
"firmament.config.fixes.player-skins.description": "Mark all player skins as signed, preventing console spam, and some rendering issues.",