🧩 程式碼架構與 Mixin 注入剖析
| 參數 | 技術規格 |
|---|---|
| Root Package | net.vanillaoutsider.bedchathider |
| Mixin Configuration | vanilla-outsider-bed-chat-hider.mixins.json |
| Compatibility Level | JAVA_25 |
| Default Require Count | 1 (injectors.defaultRequire: 1) |
🏛️ 類別架構總覽
[ BedChatHiderClient ]
(ClientModInitializer)
│
┌───────────────┴───────────────┐
▼ ▼
[ InBedChatScreenMixin ] [ ChatScreenMixin ]
(Widget & Layout Injection) (Input & Render Gating)
│ │
▼ ▼
重定位「離開床」並注入「隱藏聊天」按鈕 繞過聊天渲染、按鍵、點擊與滾輪互動🔍 Mixin 注入清單詳情
1. InBedChatScreenMixin (InBedChatScreen.class)
- 目標方法:
init() - 注入位置:
@At("TAIL") - 執行操作:
- 將
leaveBedButton寬度由 $200\text{px}$ 調整為 $98\text{px}$,座標位於 $X = W/2 - 100$。 - 在 $X = W/2 + 2, Y = H - 40$ 處注入 $98\text{px}$ 的切換
Button。 - 透過
bedchathider$updateChatState()協同更新input輸入框可見性與焦點狀態。
- 將
2. ChatScreenMixin (ChatScreen.class)
- 目標方法 1:
extractRenderState(GuiGraphicsExtractor, int, int, float, CallbackInfo)@At("HEAD"),cancellable = true- 當
InBedChatScreen的hideChat為 true 時:調用super.extractRenderState並取消ChatScreen渲染。
- 目標方法 2:
keyPressed(KeyEvent, CallbackInfoReturnable<Boolean>)@At("HEAD"),cancellable = true- 重定向至
super.keyPressed(event),屏蔽文字輸入與游標導覽。
- 目標方法 3:
mouseClicked(MouseButtonEvent, boolean, CallbackInfoReturnable<Boolean>)@At("HEAD"),cancellable = true- 重定向至
super.mouseClicked(event, doubleClick),屏蔽聊天欄連結點擊。
- 目標方法 4:
mouseScrolled(double, double, double, double, CallbackInfoReturnable<Boolean>)@At("HEAD"),cancellable = true- 重定向至
super.mouseScrolled(x, y, scrollX, scrollY),屏蔽聊天記錄滾輪滾動。
相關頁面: 首頁面板 | 睡眠界面佈局與座標計算 | 聊天可見性與輸入攔截
