🧩 代码架构与 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),屏蔽聊天记录滚轮滚动。
相关页面: 首页面板 | 睡眠界面布局与坐标计算 | 聊天可见性与输入拦截
