GuiEvents
基本信息
| 属性 | 值 |
|---|---|
| 路径 | baubles.client.gui.GuiEvents |
| 类型 | class |
| 包名 | baubles.client.gui |
监听事件
| 事件 | 处理 |
|---|---|
GuiScreenEvent.InitGuiEvent.Post |
在原版 inventory 与扩展 baubles GUI 上添加 GuiBaublesButton |
GuiScreenEvent.ActionPerformedEvent.Post |
处理 baubles 按钮点击(开/关 baubles GUI 与 inventory GUI) |
行为
InitGuiEvent.Post
- 仅当当前 GUI 是
GuiInventory或 GuiPlayerExpanded 时处理 - 计算 GUI 左上角
guiLeft、guiTop - 若玩家有 active potion effect 且 NEI 隐藏:把 GUI 向左移动以给药水面板腾位置
- 添加按钮:
- 在
GuiInventory上显示 tooltip"button.baubles"(“Baubles”) - 在
GuiPlayerExpanded上显示 tooltip"button.normal"(“Normal”) - 旧版按钮位置
(guiLeft+66, guiTop+9),新版(guiLeft+26, guiTop+9),由 BaublesConfig.useOldGuiButton 切换
- 在
ActionPerformedEvent.Post
- 在
GuiInventory上点击 id=55 的按钮: - 在
GuiPlayerExpanded上点击 id=55 的按钮:- 客户端
mc.displayGuiScreen(new GuiInventory(...))切到原版 inventory - 发 PacketOpenNormalInventory 关闭服务端 baubles 容器
- 客户端
NEI 反射
isNeihidden() 通过反射调用 codechicken.nei.NEIClientConfig.isHidden 检测 NEI 是否隐藏;隐藏时 guiLeft 计算不偏移。