Skip to content

🎛️ Tata Letak UI Layar Tempat Tidur

ParameterRincian Teknis
Target Screen Classnet.minecraft.client.gui.screens.InBedChatScreen
Superclassnet.minecraft.client.gui.screens.ChatScreen
Mixin HandlerInBedChatScreenMixin.java
Titik Injeksi@Inject(method = "init", at = @At("TAIL"))
Lebar Tombol$98\text{ px}$ (Kiri: Tinggalkan Tempat Tidur, Kanan: Toggle Obrolan)
Button Height$20\text{ px}$
Button Gap$4\text{ px}$
Vertical Anchor$Y = H - 40\text{ px}$
Translation Keysvanilla-outsider-bed-chat-hider.hideChat, ...showChat

🎮 Alur Interaksi Pemain

Saat pemain berbaring di tempat tidur:

  1. Minecraft membuka layar InBedChatScreen.
  2. Secara default di vanilla, satu tombol lebar Tinggalkan Tempat Tidur (lebar $200\text{px}$) berada di bagian bawah layar.
  3. Bed Chat Hider secara dinamis mengubah ukuran tombol Tinggalkan Tempat Tidur menjadi $98\text{px}$ dan menambahkan tombol serupa $98\text{px}$ Sembunyikan Obrolan / Tampilkan Obrolan di sebelahnya.
  4. Mengklik tombol toggle akan membalikkan status di memori, seketika menyegarkan semua widget tanpa menutup layar atau membangunkan pemain.

📐 Geometri Koordinat & Matematika Pemisahan

Minecraft Vanilla menghitung posisi tombol tunggal sebagai berikut: $$X_{\text{vanilla}} = \frac{W}{2} - 100, \quad \text{Width} = 200, \quad Y = H - 40$$

Bed Chat Hider memecah rentang $200\text{px}$ ini menjadi kluster dua tombol simetris dengan pemisah tengah $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}$$


🖼️ Tata Letak Layar Visual ASCII

Layar Tidur Vanilla:

+-------------------------------------------------------------+
| [Chat Log Overlay Area]                                     |
| <Player1> Good night everyone!                              |
|                                                             |
| [Chat Input EditBox] ______________________________________ |
|                                                             |
|                 [      Leave Bed (200px)      ]             |
+-------------------------------------------------------------+

Layar Tidur Bed Chat Hider (Obrolan Terlihat):

+-------------------------------------------------------------+
| [Chat Log Overlay Area]                                     |
| <Player1> Good night everyone!                              |
|                                                             |
| [Chat Input EditBox] ______________________________________ |
|                                                             |
|           [ Leave Bed (98px) ]  [ Hide Chat (98px) ]         |
+-------------------------------------------------------------+

Layar Tidur Bed Chat Hider (Obrolan Tersembunyi):

+-------------------------------------------------------------+
|                                                             |
|              (Clean, Unobstructed Sleep View)               |
|                                                             |
|                                                             |
|           [ Leave Bed (98px) ]  [ Show Chat (98px) ]         |
+-------------------------------------------------------------+

💻 Implementasi Kode Teknis

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();
}

Halaman Terkait: Beranda | Visibilitas Obrolan & Pemblokiran Input | Arsitektur & Analisis Mixin

Official documentation & web portal for Dasik Igaijinn mods.