diff --git a/src/main/java/slimeknights/mantle/client/gui/book/GuiArrow.java b/src/main/java/slimeknights/mantle/client/gui/book/GuiArrow.java index 0121c06..b7312dd 100644 --- a/src/main/java/slimeknights/mantle/client/gui/book/GuiArrow.java +++ b/src/main/java/slimeknights/mantle/client/gui/book/GuiArrow.java @@ -18,12 +18,12 @@ public class GuiArrow extends GuiButton { public static final int HEIGHT = 10; // Appearance - public int arrowType; + public ArrowType arrowType; public int color; public int hoverColor; - public GuiArrow(int buttonId, int x, int y, int arrowType, int color, int hoverColor) { - super(buttonId, x, y, WIDTH, HEIGHT, ""); + public GuiArrow(int buttonId, int x, int y, ArrowType arrowType, int color, int hoverColor) { + super(buttonId, x, y, arrowType.w, arrowType.h, ""); this.arrowType = arrowType; this.color = color; @@ -44,8 +44,29 @@ public class GuiArrow extends GuiButton { float b = (color & 0xff) / 255.F; GlStateManager.color(r, g, b); - Gui.drawScaledCustomSizeModalRect(xPosition, yPosition, X, HEIGHT * arrowType, WIDTH, HEIGHT, width, height, 512, 512); + Gui.drawScaledCustomSizeModalRect(xPosition, yPosition, arrowType.x, arrowType.y, width, height, width, height, 512, 512); this.mouseDragged(mc, mouseX, mouseY); } } + + public enum ArrowType { + NEXT(412, 0), + PREV(412, 10), + RIGHT(412, 20), + LEFT(412, 30), + BACK_UP(412, 40, 18, 18); + + final int x, y, w, h; + + ArrowType(int x, int y) { + this(x, y, WIDTH, HEIGHT); + } + + ArrowType(int x, int y, int w, int h) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + } } diff --git a/src/main/java/slimeknights/mantle/client/gui/book/GuiBook.java b/src/main/java/slimeknights/mantle/client/gui/book/GuiBook.java index 9758648..2ca9003 100644 --- a/src/main/java/slimeknights/mantle/client/gui/book/GuiBook.java +++ b/src/main/java/slimeknights/mantle/client/gui/book/GuiBook.java @@ -429,10 +429,10 @@ public class GuiBook extends GuiScreen implements IProgressMeter { height /= 2F; }*/ - previousArrow = new GuiArrow(0, -50, -50, 1, book.appearance.arrowColor, book.appearance.arrowColorHover); - nextArrow = new GuiArrow(1, -50, -50, 0, book.appearance.arrowColor, book.appearance.arrowColorHover); - backArrow = new GuiArrow(2, width / 2 - GuiArrow.WIDTH / 2, height / 2 + GuiArrow.HEIGHT / 2 + PAGE_HEIGHT/2, 3, book.appearance.arrowColor, book.appearance.arrowColorHover); - indexArrow = new GuiArrow(3, width / 2 - PAGE_WIDTH_UNSCALED, height / 2 - PAGE_HEIGHT_UNSCALED / 2 - 3, 3, book.appearance.arrowColor, book.appearance.arrowColorHover); + previousArrow = new GuiArrow(0, -50, -50, GuiArrow.ArrowType.PREV, book.appearance.arrowColor, book.appearance.arrowColorHover); + nextArrow = new GuiArrow(1, -50, -50, GuiArrow.ArrowType.NEXT, book.appearance.arrowColor, book.appearance.arrowColorHover); + backArrow = new GuiArrow(2, width / 2 - GuiArrow.WIDTH / 2, height / 2 + GuiArrow.HEIGHT / 2 + PAGE_HEIGHT/2, GuiArrow.ArrowType.LEFT, book.appearance.arrowColor, book.appearance.arrowColorHover); + indexArrow = new GuiArrow(3, width / 2 - PAGE_WIDTH_UNSCALED - GuiArrow.WIDTH / 2, height / 2 - PAGE_HEIGHT_UNSCALED / 2, GuiArrow.ArrowType.BACK_UP, book.appearance.arrowColor, book.appearance.arrowColorHover); buttonList.add(previousArrow); buttonList.add(nextArrow); diff --git a/src/main/resources/assets/mantle/textures/gui/book/book.png b/src/main/resources/assets/mantle/textures/gui/book/book.png index f1a414f..24bfc97 100644 Binary files a/src/main/resources/assets/mantle/textures/gui/book/book.png and b/src/main/resources/assets/mantle/textures/gui/book/book.png differ