From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../java/darkknight/jewelrycraft/client/Page.java | 217 ++++++++++++--------- 1 file changed, 129 insertions(+), 88 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/client/Page.java') diff --git a/src/main/java/darkknight/jewelrycraft/client/Page.java b/src/main/java/darkknight/jewelrycraft/client/Page.java index f3fcec9..4d67c81 100755 --- a/src/main/java/darkknight/jewelrycraft/client/Page.java +++ b/src/main/java/darkknight/jewelrycraft/client/Page.java @@ -17,54 +17,77 @@ public class Page { Variables.MODID, "textures/gui/guidePageFlip.png"); public static void addCraftingRecipeTextPage(GuiGuide gui, int x, - int y, boolean isSmall, String text, int mouseX, int mouseY, - boolean rotate, ItemStack... items) { + int y, boolean isSmall, String text, int mouseX, + int mouseY, boolean rotate, ItemStack... items) { y += 5; GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" - + items[0].getDisplayName(), + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); + gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + + "\u00a7n" + items[0].getDisplayName(), x + Math.abs(70 - gui.getFont() - .getStringWidth(items[0].getDisplayName()) / 2) - - 10, + .getStringWidth(items[0] + .getDisplayName()) + / 2) - 10, y - 2, 0); GL11.glColor4f(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager() .bindTexture(pageFlipped); ArrayList name = new ArrayList<>(); if (isSmall) { - gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46); - gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, rotate, 0, - 0, 0); + gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, + 46); + gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, + rotate, 0, 0, 0); for (int i = 1; i <= 4; i++) if (items.length > i && items[i] != null) { - int posX = x + 8 + (i - 1) % 2 * 22; - int posY = y + 26 + (i - 1) / 2 * 22; - gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, - 0); - name.add(items[i].getDisplayName()); - if (mouseX >= posX - 8 && mouseX <= posX + 8 - && mouseY >= posY - 16 && mouseY <= posY) - gui.drawHoverString(name, posX - 20, posY - 14); + int posX = x + 8 + (i - 1) % 2 + * 22; + int posY = y + 26 + + (i - 1) / 2 * 22; + gui.renderItem(items[i], posX, + posY, 30f, rotate, + 0, 0, 0); + name.add(items[i] + .getDisplayName()); + if (mouseX >= posX - 8 + && mouseX <= posX + + 8 + && mouseY >= posY + - 16 + && mouseY <= posY) + gui.drawHoverString(name, + posX - 20, + posY - 14); name.removeAll(name); GL11.glDisable(GL11.GL_LIGHTING); } drawText(gui, text, x, y + 25); } else { - gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54); - gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, rotate, 0, - 0, 0); + gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, + 54); + gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, + rotate, 0, 0, 0); for (int i = 1; i <= 9; i++) if (items.length > i && items[i] != null) { - int posX = x + 8 + (i - 1) % 3 * 19; - int posY = y + 22 + (i - 1) / 3 * 17; - gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, - 0); - name.add(items[i].getDisplayName()); - if (mouseX >= posX - 8 && mouseX <= posX + 8 - && mouseY >= posY - 10 && mouseY <= posY) - gui.drawHoverString(name, posX - 20, posY - 12); + int posX = x + 8 + (i - 1) % 3 + * 19; + int posY = y + 22 + + (i - 1) / 3 * 17; + gui.renderItem(items[i], posX, + posY, 30f, rotate, + 0, 0, 0); + name.add(items[i] + .getDisplayName()); + if (mouseX >= posX - 8 + && mouseX <= posX + + 8 + && mouseY >= posY + - 10 + && mouseY <= posY) + gui.drawHoverString(name, + posX - 20, + posY - 12); name.removeAll(name); GL11.glDisable(GL11.GL_LIGHTING); } @@ -75,65 +98,73 @@ public class Page { } public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, - int y, String text, int mouseX, int mouseY, boolean rotate, - ItemStack... items) { + int y, String text, int mouseX, int mouseY, + boolean rotate, ItemStack... items) { ArrayList name = new ArrayList<>(); - gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" - + items[1].getDisplayName(), - x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0); + gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + + "\u00a7n" + items[1].getDisplayName(), + x + 30 - items[0].getDisplayName().length() + / 2, + y + 2, 0); GL11.glColor4f(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager() .bindTexture(pageFlipped); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 52); - gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, 0, 0, - 0); + gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, + 0, 0, 0); name.add(items[0].getDisplayName()); if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20); name.removeAll(name); GL11.glDisable(GL11.GL_LIGHTING); - gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, 0, 0, - 0); + gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, + 0, 0, 0); drawText(gui, text, x, y + 30); GL11.glColor4f(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); } public static void addImageTextPage(GuiGuide gui, int x, int y, - ItemStack item, String text, float size, boolean rotate) { + ItemStack item, String text, float size, + boolean rotate) { y += 5; GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" - + item.getDisplayName(), - x - + Math.abs(70 - gui.getFont() - .getStringWidth(item.getDisplayName()) / 2) - - 10, + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); + gui.getFont().drawString( + EnumChatFormatting.DARK_BLUE + "\u00a7n" + + item.getDisplayName(), + x + Math.abs(70 - gui.getFont() + .getStringWidth(item + .getDisplayName()) + / 2) - 10, y + (int) size / 5, 0); GL11.glColor4f(1, 1, 1, 1); - gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, 0); + gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, + 0); drawText(gui, text, x - 2, y - (int) (250 / size)); GL11.glDisable(GL11.GL_BLEND); } - public static void addSlotItem(GuiGuide gui, int x, int y, int mouseX, - int mouseY, ItemStack item, float xRot, float yRot, - float zRot) { + public static void addSlotItem(GuiGuide gui, int x, int y, + int mouseX, int mouseY, ItemStack item, float xRot, + float yRot, float zRot) { ArrayList name = new ArrayList<>(); GL11.glColor4f(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager() .bindTexture(pageFlipped); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); gui.drawTexturedModalRect(x + 9, y + 19, 148, 153, 12, 12); if (item.getItem() != null) { name.add(item.getDisplayName()); - if (mouseX >= x + 10 && mouseX <= x + 20 && mouseY >= y + 20 + if (mouseX >= x + 10 && mouseX <= x + 20 + && mouseY >= y + 20 && mouseY <= y + 30) gui.drawHoverString(name, x, y + 10); name.removeAll(name); @@ -141,56 +172,63 @@ public class Page { GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1, 1, 1, 1); if (item.getItem() != null) - gui.renderItem(item, x + 15, y + 25, 40f, false, xRot, yRot, - zRot); + gui.renderItem(item, x + 15, y + 25, 40f, false, + xRot, yRot, zRot); GL11.glDisable(GL11.GL_BLEND); } public static void addImageTextPage(GuiGuide gui, int x, int y, - ItemStack item, String text, float size, int txtX, int txtY, - boolean showName, int imgX, int imgY, boolean rotate) { + ItemStack item, String text, float size, int txtX, + int txtY, boolean showName, int imgX, int imgY, + boolean rotate) { y += 5; GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); if (showName) - gui.getFont() - .drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" - + item.getDisplayName().substring(0, - item.getDisplayName() - .length() > 23 - ? 23 : item - .getDisplayName() - .length()), - x + Math.abs(70 - gui.getFont().getStringWidth( - item.getDisplayName()) / 2) - 10, - y + 2, 0); + gui.getFont().drawString( + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + + item.getDisplayName() + .substring(0, item + .getDisplayName() + .length() > 23 ? 23 + : item.getDisplayName() + .length()), + x + Math.abs(70 - gui.getFont() + .getStringWidth(item + .getDisplayName()) + / 2) - 10, + y + 2, 0); GL11.glColor4f(1, 1, 1, 1); - gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, - 0, 0); + gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, + rotate, 0, 0, 0); drawText(gui, text, x + txtX, y + txtY); GL11.glDisable(GL11.GL_BLEND); } public static void addImageTextPage(GuiGuide gui, int x, int y, - ItemStack item, String text, float size, int txtX, int txtY, - String title, int imgX, int imgY, boolean rotate) { + ItemStack item, String text, float size, int txtX, + int txtY, String title, int imgX, int imgY, + boolean rotate) { y += 5; GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" - + title.substring(0, - item.getDisplayName().length() > 23 ? 23 - : title.length()), - x + Math.abs(70 - gui.getFont().getStringWidth(title) / 2) + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA); + gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + + "\u00a7n" + + title.substring(0, item.getDisplayName() + .length() > 23 ? 23 + : title.length()), + x + Math.abs(70 - gui.getFont() + .getStringWidth(title) / 2) - 10, y + 2, 0); GL11.glColor4f(1, 1, 1, 1); - gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, - 0, 0); + gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, + rotate, 0, 0, 0); drawText(gui, text, x + txtX, y + txtY); GL11.glDisable(GL11.GL_BLEND); } @@ -202,7 +240,8 @@ public class Page { GL11.glColor4f(1, 1, 1, 1); } - public static void drawText(GuiGuide gui, String text, int x, int y) { + public static void drawText(GuiGuide gui, String text, int x, + int y) { String[] s = text.split(" "); String displayText = ""; float scale = 0.75F; @@ -218,8 +257,10 @@ public class Page { for (int i = 0; i < textLines.size(); i++) { GL11.glPushMatrix(); GL11.glScalef(scale, scale, 0f); - gui.getFont().drawString(textLines.get(i), (int) (x / scale), - (int) ((y + 32 + i * 9) / scale), 0); + gui.getFont().drawString(textLines.get(i), + (int) (x / scale), + (int) ((y + 32 + i * 9) / scale), + 0); GL11.glPopMatrix(); } } -- cgit v1.2.3