Skip to content

🧩 程式碼架構與 Mixin 注入剖析

參數技術規格
Root Packagenet.vanillaoutsider.bedchathider
Mixin Configurationvanilla-outsider-bed-chat-hider.mixins.json
Compatibility LevelJAVA_25
Default Require Count1 (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
    • InBedChatScreenhideChat 為 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),屏蔽聊天記錄滾輪滾動。

相關頁面: 首頁面板 | 睡眠界面佈局與座標計算 | 聊天可見性與輸入攔截

Official documentation & web portal for Dasik Igaijinn mods.