From c980366278a81b6b51223092cbeceeb50d4c0aae Mon Sep 17 00:00:00 2001 From: Dustin Norberg Date: Wed, 23 Sep 2026 23:28:04 -0400 Subject: [PATCH] Refine notebook screen layout --- gradle.properties | 2 +- .../client/screen/NotebookScreen.java | 57 +++++++++++++++--- .../rivencraft/menu/NotebookMenu.java | 8 ++- .../rivencraft/textures/gui/notebook.png | Bin 1401 -> 0 bytes 4 files changed, 53 insertions(+), 14 deletions(-) delete mode 100644 src/main/resources/assets/rivencraft/textures/gui/notebook.png diff --git a/gradle.properties b/gradle.properties index a661d78..c2d823f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -35,7 +35,7 @@ mod_name=Rivencraft # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=LGPL-3.0-or-later # The mod version. Rivencraft uses the x.y.z.b policy documented in README.md. -mod_version=0.3.3.0 +mod_version=0.3.3.1 immersive_portals_version=6.0.7 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. diff --git a/src/main/java/net/dnorberg/rivencraft/client/screen/NotebookScreen.java b/src/main/java/net/dnorberg/rivencraft/client/screen/NotebookScreen.java index 4cf686c..a4564c0 100644 --- a/src/main/java/net/dnorberg/rivencraft/client/screen/NotebookScreen.java +++ b/src/main/java/net/dnorberg/rivencraft/client/screen/NotebookScreen.java @@ -1,6 +1,5 @@ package net.dnorberg.rivencraft.client.screen; -import net.dnorberg.rivencraft.Rivencraft; import net.dnorberg.rivencraft.menu.NotebookMenu; import net.dnorberg.rivencraft.network.RenameNotebookPagePayload; import net.minecraft.client.gui.GuiGraphics; @@ -9,7 +8,6 @@ import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.Slot; @@ -17,10 +15,11 @@ import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.network.PacketDistributor; public final class NotebookScreen extends AbstractContainerScreen { - private static final ResourceLocation NOTEBOOK_BACKGROUND = ResourceLocation.fromNamespaceAndPath( - Rivencraft.MOD_ID, "textures/gui/notebook.png"); - private static final ResourceLocation INVENTORY_BACKGROUND = ResourceLocation.withDefaultNamespace( - "textures/gui/container/generic_54.png"); + private static final int SURFACE_TOP = 20; + private static final int SURFACE_BOTTOM = 132; + private static final int PAGE_WIDTH = 17; + private static final int PAGE_HEIGHT = 31; + private static final int PAGE_ROW_HEIGHT = 34; private EditBox nameInput; private Button previousButton; private Button nextButton; @@ -29,8 +28,8 @@ public final class NotebookScreen extends AbstractContainerScreen public NotebookScreen(NotebookMenu menu, Inventory inventory, Component title) { super(menu, inventory, title); imageWidth = 176; - imageHeight = 183; - inventoryLabelY = 89; + imageHeight = 213; + inventoryLabelY = 123; titleLabelY = 7; } @@ -68,8 +67,20 @@ public final class NotebookScreen extends AbstractContainerScreen @Override protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int mouseY) { - graphics.blit(NOTEBOOK_BACKGROUND, leftPos, topPos, 0, 0, imageWidth, 88); - graphics.blit(INVENTORY_BACKGROUND, leftPos, topPos + 87, 0, 126, imageWidth, 96); + drawBeveledPanel(graphics, leftPos, topPos, imageWidth, SURFACE_BOTTOM); + graphics.fill(leftPos, topPos + SURFACE_TOP, leftPos + imageWidth - 1, topPos + SURFACE_BOTTOM - 1, + 0xFF1D2633); + drawPageCards(graphics); + + drawBeveledPanel(graphics, leftPos, topPos + 132, imageWidth, 81); + for (int row = 0; row < 3; row++) { + for (int column = 0; column < 9; column++) { + drawSlot(graphics, 7 + column * 18, 134 + row * 18); + } + } + for (int column = 0; column < 9; column++) { + drawSlot(graphics, 7 + column * 18, 192); + } } @Override @@ -153,4 +164,30 @@ public final class NotebookScreen extends AbstractContainerScreen previousButton.active = hasPage && selectedSlot > 0; nextButton.active = hasPage && selectedSlot >= 0 && selectedSlot < NotebookMenu.NOTEBOOK_SLOTS - 1; } + + private void drawPageCards(GuiGraphics graphics) { + for (int index = 0; index < NotebookMenu.NOTEBOOK_SLOTS; index++) { + int row = index / NotebookMenu.PAGE_COLUMNS; + int x = leftPos + 7 + (index % NotebookMenu.PAGE_COLUMNS) * 18; + int y = topPos + 21 + row * PAGE_ROW_HEIGHT; + graphics.fill(x, y, x + PAGE_WIDTH, y + PAGE_HEIGHT, 0xFFB8AD8D); + graphics.renderOutline(x, y, PAGE_WIDTH, PAGE_HEIGHT, 0xFF594D39); + } + } + + private static void drawBeveledPanel(GuiGraphics graphics, int x, int y, int width, int height) { + graphics.fill(x, y, x + width, y + height, 0xFFC6C6C6); + graphics.fill(x, y, x + width, y + 2, 0xFFFFFFFF); + graphics.fill(x, y, x + 2, y + height, 0xFFFFFFFF); + graphics.fill(x, y + height - 2, x + width, y + height, 0xFF555555); + graphics.fill(x + width - 2, y, x + width, y + height, 0xFF555555); + } + + private void drawSlot(GuiGraphics graphics, int x, int y) { + graphics.fill(leftPos + x, topPos + y, leftPos + x + 18, topPos + y + 18, 0xFF8B8B8B); + graphics.fill(leftPos + x, topPos + y, leftPos + x + 18, topPos + y + 1, 0xFF373737); + graphics.fill(leftPos + x, topPos + y, leftPos + x + 1, topPos + y + 18, 0xFF373737); + graphics.fill(leftPos + x + 17, topPos + y, leftPos + x + 18, topPos + y + 18, 0xFFFFFFFF); + graphics.fill(leftPos + x, topPos + y + 17, leftPos + x + 18, topPos + y + 18, 0xFFFFFFFF); + } } diff --git a/src/main/java/net/dnorberg/rivencraft/menu/NotebookMenu.java b/src/main/java/net/dnorberg/rivencraft/menu/NotebookMenu.java index 0ebcedb..750dd05 100644 --- a/src/main/java/net/dnorberg/rivencraft/menu/NotebookMenu.java +++ b/src/main/java/net/dnorberg/rivencraft/menu/NotebookMenu.java @@ -21,6 +21,8 @@ import net.minecraft.world.item.ItemStack; public final class NotebookMenu extends AbstractContainerMenu { public static final int NOTEBOOK_SLOTS = NotebookContents.MAX_PAGES; + public static final int PAGE_COLUMNS = 9; + public static final int PAGE_ROWS = 3; public static final int MOVE_PREVIOUS_BASE = 0; public static final int MOVE_NEXT_BASE = NOTEBOOK_SLOTS; private static final int PLAYER_INVENTORY_START = NOTEBOOK_SLOTS; @@ -42,17 +44,17 @@ public final class NotebookMenu extends AbstractContainerMenu { for (int row = 0; row < 3; row++) { for (int column = 0; column < 9; column++) { - addSlot(new PageSlot(contents, column + row * 9, 8 + column * 18, 32 + row * 18)); + addSlot(new PageSlot(contents, column + row * 9, 8 + column * 18, 28 + row * 34)); } } for (int row = 0; row < 3; row++) { for (int column = 0; column < 9; column++) { int inventoryIndex = column + row * 9 + 9; - addSlot(playerSlot(inventoryIndex, 8 + column * 18, 101 + row * 18)); + addSlot(playerSlot(inventoryIndex, 8 + column * 18, 135 + row * 18)); } } for (int column = 0; column < 9; column++) { - addSlot(playerSlot(column, 8 + column * 18, 159)); + addSlot(playerSlot(column, 8 + column * 18, 193)); } } diff --git a/src/main/resources/assets/rivencraft/textures/gui/notebook.png b/src/main/resources/assets/rivencraft/textures/gui/notebook.png deleted file mode 100644 index 309c770cbfdadc435bd897422f8d2cc95ac539a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1401 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;Kn`1yx4R3& zUWVliZ6|+7X#qtz3p^r=85sBuf-vKbiP>*~g6t)pzOL+dSXjm6^^yYrOl4qT`RVE6 z7*cWT?Oofv+cper4|co|Q#cW}CAi&hUxWJmz^!RY4&71SVH9Hy&;$O4>FWdZX@5JTLFYi~F@L|G50fjFQ z*0&#+5Or(2t;yT;uRnah?tTCH*PESNa+kmT_&aa)zPlUmO^?{M&;CpX2ZM+e3y1CR z@3y-{=3=Rwo-cP+8CKWZ#WMkl9 zI3UoV^iyyG8$$+z&Qwl&UWOA}8SmV`Tjjdo2t!3>?dQpHOTn-a>vzyx%D12C?T?7$)v8zI@TWYuohXz2ium%#4vIj*8`F+$D{ zB#^-25U9hyjuB|wz0Ec|Am(W_Jw3>Z-&}O79w=)wPYl^=bm85@!lzd+0F!8g>ioAC zL2i~{3TWB(^x*1NM_;xqh?BeJ#Uf-v;C@*4)QVwJQRN0ufJ`|f+8_nC`@ka`+xb4f zI6R)kiz@#GM08rdFC^EQi zQbLLakU0x9ZlB#%m>9sqVBoCA=y{1nOO4GGPYBN3lyg|I-8;YU-|BzY z*cptn7A{nIo({YWJd7+1OZ)!&vT%Vy*Lfz3igjJXGRB5{pt$NPHO5+Qa9ZU_6q@j6hY&dN zsv2`bP0 Hl+XkKi|_DE