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.