Public Access
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c980366278 |
No files matched your search
+1
-1
@@ -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.
|
# 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
|
mod_license=LGPL-3.0-or-later
|
||||||
# The mod version. Rivencraft uses the x.y.z.b policy documented in README.md.
|
# 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
|
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.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.dnorberg.rivencraft.client.screen;
|
package net.dnorberg.rivencraft.client.screen;
|
||||||
|
|
||||||
import net.dnorberg.rivencraft.Rivencraft;
|
|
||||||
import net.dnorberg.rivencraft.menu.NotebookMenu;
|
import net.dnorberg.rivencraft.menu.NotebookMenu;
|
||||||
import net.dnorberg.rivencraft.network.RenameNotebookPagePayload;
|
import net.dnorberg.rivencraft.network.RenameNotebookPagePayload;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
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.components.Tooltip;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.inventory.ClickType;
|
import net.minecraft.world.inventory.ClickType;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
@@ -17,10 +15,11 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
|
||||||
public final class NotebookScreen extends AbstractContainerScreen<NotebookMenu> {
|
public final class NotebookScreen extends AbstractContainerScreen<NotebookMenu> {
|
||||||
private static final ResourceLocation NOTEBOOK_BACKGROUND = ResourceLocation.fromNamespaceAndPath(
|
private static final int SURFACE_TOP = 20;
|
||||||
Rivencraft.MOD_ID, "textures/gui/notebook.png");
|
private static final int SURFACE_BOTTOM = 132;
|
||||||
private static final ResourceLocation INVENTORY_BACKGROUND = ResourceLocation.withDefaultNamespace(
|
private static final int PAGE_WIDTH = 17;
|
||||||
"textures/gui/container/generic_54.png");
|
private static final int PAGE_HEIGHT = 31;
|
||||||
|
private static final int PAGE_ROW_HEIGHT = 34;
|
||||||
private EditBox nameInput;
|
private EditBox nameInput;
|
||||||
private Button previousButton;
|
private Button previousButton;
|
||||||
private Button nextButton;
|
private Button nextButton;
|
||||||
@@ -29,8 +28,8 @@ public final class NotebookScreen extends AbstractContainerScreen<NotebookMenu>
|
|||||||
public NotebookScreen(NotebookMenu menu, Inventory inventory, Component title) {
|
public NotebookScreen(NotebookMenu menu, Inventory inventory, Component title) {
|
||||||
super(menu, inventory, title);
|
super(menu, inventory, title);
|
||||||
imageWidth = 176;
|
imageWidth = 176;
|
||||||
imageHeight = 183;
|
imageHeight = 213;
|
||||||
inventoryLabelY = 89;
|
inventoryLabelY = 123;
|
||||||
titleLabelY = 7;
|
titleLabelY = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +67,20 @@ public final class NotebookScreen extends AbstractContainerScreen<NotebookMenu>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int mouseY) {
|
protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int mouseY) {
|
||||||
graphics.blit(NOTEBOOK_BACKGROUND, leftPos, topPos, 0, 0, imageWidth, 88);
|
drawBeveledPanel(graphics, leftPos, topPos, imageWidth, SURFACE_BOTTOM);
|
||||||
graphics.blit(INVENTORY_BACKGROUND, leftPos, topPos + 87, 0, 126, imageWidth, 96);
|
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
|
@Override
|
||||||
@@ -153,4 +164,30 @@ public final class NotebookScreen extends AbstractContainerScreen<NotebookMenu>
|
|||||||
previousButton.active = hasPage && selectedSlot > 0;
|
previousButton.active = hasPage && selectedSlot > 0;
|
||||||
nextButton.active = hasPage && selectedSlot >= 0 && selectedSlot < NotebookMenu.NOTEBOOK_SLOTS - 1;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,8 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
|
|
||||||
public final class NotebookMenu extends AbstractContainerMenu {
|
public final class NotebookMenu extends AbstractContainerMenu {
|
||||||
public static final int NOTEBOOK_SLOTS = NotebookContents.MAX_PAGES;
|
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_PREVIOUS_BASE = 0;
|
||||||
public static final int MOVE_NEXT_BASE = NOTEBOOK_SLOTS;
|
public static final int MOVE_NEXT_BASE = NOTEBOOK_SLOTS;
|
||||||
private static final int PLAYER_INVENTORY_START = 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 row = 0; row < 3; row++) {
|
||||||
for (int column = 0; column < 9; column++) {
|
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 row = 0; row < 3; row++) {
|
||||||
for (int column = 0; column < 9; column++) {
|
for (int column = 0; column < 9; column++) {
|
||||||
int inventoryIndex = column + row * 9 + 9;
|
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++) {
|
for (int column = 0; column < 9; column++) {
|
||||||
addSlot(playerSlot(column, 8 + column * 18, 159));
|
addSlot(playerSlot(column, 8 + column * 18, 193));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Reference in new issue
Block a user