🎛️ Interfaz y Disposición de Cama
| Parámetro | Detalles técnicos |
|---|---|
| Target Screen Class | net.minecraft.client.gui.screens.InBedChatScreen |
| Superclass | net.minecraft.client.gui.screens.ChatScreen |
| Mixin Handler | InBedChatScreenMixin.java |
| Punto de inyección | @Inject(method = "init", at = @At("TAIL")) |
| Ancho del botón | $98\text{ px}$ (Izquierda: Salir de la cama, Derecha: Alternar chat) |
| Button Height | $20\text{ px}$ |
| Button Gap | $4\text{ px}$ |
| Vertical Anchor | $Y = H - 40\text{ px}$ |
| Translation Keys | vanilla-outsider-bed-chat-hider.hideChat, ...showChat |
🎮 Flujo de interacción del jugador
Cuando un jugador se acuesta en la cama:
- Minecraft abre la pantalla
InBedChatScreen. - Por defecto en vainilla, un único botón ancho de Salir de la cama (de $200\text{px}$ de ancho) se ubica en la parte inferior de la pantalla.
- Bed Chat Hider redimensiona dinámicamente el botón Salir de la cama a $98\text{px}$ y añade a su lado un botón coincidente de $98\text{px}$ de Ocultar chat / Mostrar chat.
- Al hacer clic en el botón de alternancia se cambia el estado en memoria, actualizando de inmediato todos los widgets sin cerrar la pantalla ni despertar al jugador.
📐 Geometría de coordenadas y matemática de división
Minecraft vainilla calcula la posición del botón único como: $$X_{\text{vanilla}} = \frac{W}{2} - 100, \quad \text{Width} = 200, \quad Y = H - 40$$
Bed Chat Hider divide este intervalo de $200\text{px}$ en un par de botones simétricos con una separación central de $4\text{px}$:
$$\text{Leave Bed Button: } X_1 = \frac{W}{2} - 100, \quad \text{Width}_1 = 98, \quad Y_1 = H - 40$$ $$\text{Center Gap: } \Delta X = 4\text{ px}$$ $$\text{Toggle Chat Button: } X_2 = \frac{W}{2} + 2, \quad \text{Width}_2 = 98, \quad Y_2 = H - 40$$
$$\text{Total Span: } W_1 + \Delta X + W_2 = 98 + 4 + 98 = 200\text{ px}$$
🖼️ Esquema visual de pantalla en ASCII
Pantalla de sueño vainilla:
+-------------------------------------------------------------+
| [Chat Log Overlay Area] |
| <Player1> Good night everyone! |
| |
| [Chat Input EditBox] ______________________________________ |
| |
| [ Leave Bed (200px) ] |
+-------------------------------------------------------------+Pantalla de sueño de Bed Chat Hider (chat visible):
+-------------------------------------------------------------+
| [Chat Log Overlay Area] |
| <Player1> Good night everyone! |
| |
| [Chat Input EditBox] ______________________________________ |
| |
| [ Leave Bed (98px) ] [ Hide Chat (98px) ] |
+-------------------------------------------------------------+Pantalla de sueño de Bed Chat Hider (chat oculto):
+-------------------------------------------------------------+
| |
| (Clean, Unobstructed Sleep View) |
| |
| |
| [ Leave Bed (98px) ] [ Show Chat (98px) ] |
+-------------------------------------------------------------+💻 Implementación técnica en código
java
// Sourced from InBedChatScreenMixin.java
@Inject(method = "init", at = @At("TAIL"))
private void onInit(CallbackInfo ci) {
if (this.leaveBedButton != null) {
this.leaveBedButton.setX(this.width / 2 - 100);
this.leaveBedButton.setWidth(98);
}
Button toggleButton = Button.builder(
bedchathider$getButtonMessage(),
button -> {
BedChatHiderClient.hideChat = !BedChatHiderClient.hideChat;
this.rebuildWidgets();
}
).bounds(this.width / 2 + 2, this.height - 40, 98, 20).build();
this.addRenderableWidget(toggleButton);
bedchathider$updateChatState();
}Páginas relacionadas: Inicio | Visibilidad del Chat y Bloqueo de Entrada | Arquitectura y Análisis de Mixins
