From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../jewelrycraft/client/AbstractTab.java | 27 +- .../jewelrycraft/client/JewelryInventory.java | 24 +- .../java/darkknight/jewelrycraft/client/Page.java | 217 +++++---- .../jewelrycraft/client/TabRegistry.java | 48 +- .../jewelrycraft/client/gui/GuiCurseInfo.java | 426 +++++++++++------ .../jewelrycraft/client/gui/GuiGuide.java | 125 ++--- .../jewelrycraft/client/gui/GuiHandler.java | 68 ++- .../jewelrycraft/client/gui/GuiJewelry.java | 12 +- .../client/gui/GuiJewelryModifier.java | 256 +++++++---- .../jewelrycraft/client/gui/GuiRectangle.java | 12 +- .../jewelrycraft/client/gui/GuiRingChest.java | 8 +- .../jewelrycraft/client/gui/GuiTabBlocks.java | 139 +++--- .../jewelrycraft/client/gui/GuiTabCurses.java | 114 +++-- .../client/gui/GuiTabGemsAndIngots.java | 94 ++-- .../client/gui/GuiTabIntroduction.java | 24 +- .../jewelrycraft/client/gui/GuiTabItems.java | 188 +++++--- .../jewelrycraft/client/gui/GuiTabModifiers.java | 39 +- .../client/gui/GuiTabOresToIngots.java | 48 +- .../jewelrycraft/client/gui/GuiTabRitual.java | 502 ++++++++++++++------- .../gui/container/ContainerJewelryModifier.java | 17 +- .../client/gui/container/ContainerJewelryTab.java | 125 +++-- .../client/gui/container/ContainerRingChest.java | 18 +- .../client/gui/container/slots/SlotBracelet.java | 7 +- .../client/gui/container/slots/SlotEarrings.java | 7 +- .../client/gui/container/slots/SlotNecklace.java | 7 +- .../client/gui/container/slots/SlotRing.java | 7 +- 26 files changed, 1654 insertions(+), 905 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/client') diff --git a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java index 66c3329..0db57c7 100755 --- a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java @@ -18,12 +18,13 @@ import net.minecraft.util.ResourceLocation; */ @SideOnly(Side.CLIENT) public abstract class AbstractTab extends GuiButton { - ResourceLocation texture = new ResourceLocation( + ResourceLocation texture = new ResourceLocation( Variables.MODID, "textures/gui/hearts.png"); - ItemStack renderStack; - RenderItem itemRenderer = new RenderItem(); + ItemStack renderStack; + RenderItem itemRenderer = new RenderItem(); - public AbstractTab(int id, int posX, int posY, ItemStack renderStack) { + public AbstractTab(int id, int posX, int posY, + ItemStack renderStack) { super(id, posX, posY, 18, 18, ""); this.renderStack = renderStack; } @@ -35,8 +36,9 @@ public abstract class AbstractTab extends GuiButton { int xOffset = this.enabled ? 0 : 8; mc.renderEngine.bindTexture(this.texture); - this.drawTexturedModalRect(this.xPosition, yPosition, - 144 + xOffset, 32, 18, 18); + this.drawTexturedModalRect(this.xPosition, + yPosition, 144 + xOffset, 32, 18, + 18); GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -44,11 +46,13 @@ public abstract class AbstractTab extends GuiButton { this.itemRenderer.zLevel = 100.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, - mc.renderEngine, renderStack, xPosition + 1, + this.itemRenderer.renderItemAndEffectIntoGUI( + mc.fontRenderer, mc.renderEngine, + renderStack, xPosition + 1, yPosition + 1); - this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, - mc.renderEngine, renderStack, xPosition + 1, + this.itemRenderer.renderItemOverlayIntoGUI( + mc.fontRenderer, mc.renderEngine, + renderStack, xPosition + 1, yPosition + 1); GL11.glDisable(GL11.GL_LIGHTING); this.itemRenderer.zLevel = 0.0F; @@ -61,7 +65,8 @@ public abstract class AbstractTab extends GuiButton { @Override public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { boolean inWindow = this.enabled && this.visible - && mouseX >= this.xPosition && mouseY >= this.yPosition + && mouseX >= this.xPosition + && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; if (inWindow) diff --git a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java index 6baf8ad..6571634 100755 --- a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java +++ b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java @@ -20,11 +20,11 @@ public class JewelryInventory implements IInventory { */ public JewelryInventory(EntityPlayer player) { this.player = player; - NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, - Variables.MODID); + NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag( + player, Variables.MODID); for (int i = 0; i < 18; i++) - inventory[i] = ItemStack - .loadItemStackFromNBT(nbt.getCompoundTag("ext" + i)); + inventory[i] = ItemStack.loadItemStackFromNBT( + nbt.getCompoundTag("ext" + i)); } /** @@ -79,7 +79,8 @@ public class JewelryInventory implements IInventory { @Override public void setInventorySlotContents(int slot, ItemStack stack) { inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if (stack != null + && stack.stackSize > getInventoryStackLimit()) stack.stackSize = getInventoryStackLimit(); markDirty(); } @@ -113,12 +114,13 @@ public class JewelryInventory implements IInventory { */ @Override public void markDirty() { - NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, - Variables.MODID); + NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag( + player, Variables.MODID); for (int i = 0; i < 18; i++) if (inventory[i] != null) nbt.setTag("ext" + i, inventory[i] - .writeToNBT(nbt.getCompoundTag("ext" + i))); + .writeToNBT(nbt.getCompoundTag( + "ext" + i))); else nbt.removeTag("ext" + i); } @@ -155,7 +157,8 @@ public class JewelryInventory implements IInventory { */ @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { - if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing) + if (slot >= 0 && slot <= 9 + && stack.getItem() instanceof ItemRing) return true; else if (slot >= 10 && slot <= 13 && stack.getItem() instanceof ItemBracelet) @@ -163,7 +166,8 @@ public class JewelryInventory implements IInventory { else if (slot >= 14 && slot <= 16 && stack.getItem() instanceof ItemNecklace) return true; - else if (slot == 17 && stack.getItem() instanceof ItemEarrings) + else if (slot == 17 + && stack.getItem() instanceof ItemEarrings) return true; return false; } 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(); } } diff --git a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java index 21d8b9c..9b30274 100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java @@ -36,36 +36,45 @@ public class TabRegistry { int ySize = 166; int guiLeft = (event.gui.width - xSize) / 2; int guiTop = (event.gui.height - ySize) / 2; - if (!mc.thePlayer.getActivePotionEffects().isEmpty()) + if (!mc.thePlayer.getActivePotionEffects() + .isEmpty()) if (Loader.isModLoaded("NotEnoughItems")) { try { - // Check whether NEI is hidden and enabled + // Check whether NEI is + // hidden and enabled Class c = Class.forName( "codechicken.nei.NEIClientConfig"); - Object hidden = - c.getMethod("isHidden").invoke(null); - Object enabled = - c.getMethod("isEnabled").invoke(null); - if (hidden != null && hidden instanceof Boolean + Object hidden = c + .getMethod("isHidden") + .invoke(null); + Object enabled = c + .getMethod("isEnabled") + .invoke(null); + if (hidden != null + && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) - if ((Boolean) hidden || !((Boolean) enabled)) + if ((Boolean) hidden + || !((Boolean) enabled)) guiLeft += 60; } catch (Exception e) { // Do nothing } } else guiLeft += 60; - updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class); + updateTabValues(guiLeft, guiTop, + InventoryTabVanilla.class); addTabsToList(event.buttonList); } } - private static Minecraft mc = FMLClientHandler.instance().getClient(); + private static Minecraft mc = FMLClientHandler.instance() + .getClient(); public static void openInventoryGui() { - mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow( - mc.thePlayer.openContainer.windowId)); + mc.thePlayer.sendQueue + .addToSendQueue(new C0DPacketCloseWindow( + mc.thePlayer.openContainer.windowId)); GuiInventory inventory = new GuiInventory(mc.thePlayer); mc.displayGuiScreen(inventory); } @@ -76,17 +85,22 @@ public class TabRegistry { for (int i = 0; i < tabList.size(); i++) { AbstractTab t = tabList.get(i); if (t.shouldAddToList()) { - if (selectedButton.equals(TabCurses.class)) { + if (selectedButton + .equals(TabCurses.class)) { t.xPosition = cornerX + 195; t.yPosition = cornerY + count * 20; - } else if (selectedButton.equals(TabJewelry.class)) { - t.xPosition = cornerX + 140 + count * 20; + } else if (selectedButton.equals( + TabJewelry.class)) { + t.xPosition = cornerX + 140 + + count * 20; t.yPosition = cornerY + 64; } else { - t.xPosition = cornerX + 131 + count * 20; + t.xPosition = cornerX + 131 + + count * 20; t.yPosition = cornerY + 64; } - t.enabled = !t.getClass().equals(selectedButton); + t.enabled = !t.getClass() + .equals(selectedButton); if (t.enabled) count++; } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java index acd1a69..0c833ec 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java @@ -25,11 +25,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class GuiCurseInfo extends GuiContainer { - World world; + World world; EntityPlayer player; ResourceLocation texture; - int page = 0, maxPages = 1; - String selectedCurse = ""; + int page = 0, maxPages = 1; + String selectedCurse = ""; public GuiCurseInfo(Container container, World world, EntityPlayer player, ResourceLocation texture) { @@ -50,47 +50,59 @@ public class GuiCurseInfo extends GuiContainer { public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { GL11.glColor3f(1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + Minecraft.getMinecraft().getTextureManager() + .bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if (player != null) { NBTTagCompound playerInfo = PlayerUtils - .getModPlayerPersistTag(player, Variables.MODID); + .getModPlayerPersistTag(player, + Variables.MODID); if (!player.capabilities.isCreativeMode) - maxPages = playerInfo.getInteger("activeCurses") / 5 - - (playerInfo.getInteger("activeCurses") % 5 == 0 - ? 1 : 0); + maxPages = playerInfo.getInteger( + "activeCurses") / 5 + - (playerInfo.getInteger( + "activeCurses") + % 5 == 0 ? 1 + : 0); else maxPages = Curse.getCurseList().size() / 5 - - (Curse.getCurseList().size() % 5 == 0 ? 1 : 0); + - (Curse.getCurseList() + .size() + % 5 == 0 ? 1 + : 0); if (!player.capabilities.isCreativeMode) survivalCurses(playerInfo); else creativeCurses(playerInfo); if (playerInfo.hasKey("cursePoints")) this.drawString(fontRendererObj, - "Curse points: " - + playerInfo.getInteger("cursePoints") + "Curse points: " + playerInfo + .getInteger("cursePoints") + " | Active curses: " - + playerInfo.getInteger("activeCurses"), - guiLeft, guiTop - 10, 0xffffff); + + playerInfo.getInteger( + "activeCurses"), + guiLeft, guiTop - 10, + 0xffffff); } - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0, ySize, - 13, 11); - drawTexturedModalRect(guiLeft + xSize - 38, guiTop + ySize - 14, - 13, ySize, 13, 11); - this.drawString(fontRendererObj, (page + 1) + "/" + (maxPages + 1), + Minecraft.getMinecraft().getTextureManager() + .bindTexture(texture); + drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0, + ySize, 13, 11); + drawTexturedModalRect(guiLeft + xSize - 38, + guiTop + ySize - 14, 13, ySize, 13, 11); + this.drawString(fontRendererObj, + (page + 1) + "/" + (maxPages + 1), guiLeft + 90, guiTop + 153, 0xffffff); this.drawString(fontRendererObj, - "Click on an active curse to see its description", guiLeft, - guiTop + 170, 0xffffff); + "Click on an active curse to see its description", + guiLeft, guiTop + 170, 0xffffff); if (player.capabilities.isCreativeMode) { - drawText(this, - "To enable or disable a curse simply hold the CTRL key and click on one.", - guiLeft - 100, guiTop, 20, 0xff0000); - drawText(this, - "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.", - guiLeft - 100, guiTop + 50, 20, 0xff0000); + drawText(this, "To enable or disable a curse simply hold the CTRL key and click on one.", + guiLeft - 100, guiTop, 20, + 0xff0000); + drawText(this, "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.", + guiLeft - 100, guiTop + 50, 20, + 0xff0000); } } @@ -100,7 +112,8 @@ public class GuiCurseInfo extends GuiContainer { String displayText = ""; ArrayList textLines = new ArrayList<>(); for (String element : s) - if ((displayText + element + " ").length() <= characters) + if ((displayText + element + " ") + .length() <= characters) displayText += element + " "; else { textLines.add(displayText.trim()); @@ -108,8 +121,8 @@ public class GuiCurseInfo extends GuiContainer { } textLines.add(displayText.trim()); for (int i = 0; i < textLines.size(); i++) - gui.drawString(gui.getFont(), textLines.get(i), x, y + i * 9, - color); + gui.drawString(gui.getFont(), textLines.get(i), x, + y + i * 9, color); } public FontRenderer getFont() { @@ -121,81 +134,129 @@ public class GuiCurseInfo extends GuiContainer { int ind = 0; if (!playerInfo.hasNoTags()) { for (Curse curse : Curse.getCurseList()) { - if (playerInfo.getInteger(curse.getName()) > 0) { - if (ind >= page * 5 && ind < (page + 1) * 5) { - if (ind == page * 5 && selectedCurse == "") - selectedCurse = curse.getName(); - mc.renderEngine - .bindTexture(Variables.MISC_TEXTURE); - drawTexturedModalRect(guiLeft + 43, - guiTop + 8 + (size - 8) * (ind - page * 5), - 0, 32, 112, 22); - if (selectedCurse == curse.getName()) { + if (playerInfo.getInteger( + curse.getName()) > 0) { + if (ind >= page * 5 && ind < (page + + 1) * 5) { + if (ind == page * 5 + && selectedCurse == "") + selectedCurse = curse + .getName(); + mc.renderEngine.bindTexture( + Variables.MISC_TEXTURE); + drawTexturedModalRect( + guiLeft + 43, + guiTop + 8 + (size + - 8) + * (ind - page * 5), + 0, 32, 112, + 22); + if (selectedCurse == curse + .getName()) { GL11.glPushMatrix(); - GL11.glScalef(1.2f, 1.5f, 0f); + GL11.glScalef(1.2f, + 1.5f, + 0f); drawTexturedModalRect( - (int) (guiLeft / (1.2)) + 126, - (int) (guiTop / (1.5)) + 7 - + (size - 16) - * (ind - page * 5), - 48, 16, 32, 16); + (int) (guiLeft / (1.2)) + + 126, + (int) (guiTop / (1.5)) + + 7 + + (size - 16) * (ind + - page * 5), + 48, + 16, + 32, + 16); drawTexturedModalRect( - (int) (guiLeft / (1.2)) + 5, - (int) (guiTop / (1.5)) + 7 - + (size - 16) - * (ind - page * 5), - 80, 16, 32, 16); + (int) (guiLeft / (1.2)) + + 5, + (int) (guiTop / (1.5)) + + 7 + + (size - 16) * (ind + - page * 5), + 80, + 16, + 32, + 16); GL11.glPopMatrix(); GL11.glPushMatrix(); List descr = fontRendererObj .listFormattedStringToWidth( - curse.getDescription(), 238); - GL11.glScalef(0.75F, 0.75F, 0F); - for (int i = 0; i < descr.size(); i++) + curse.getDescription(), + 238); + GL11.glScalef(0.75F, + 0.75F, + 0F); + for (int i = 0; i < descr + .size(); i++) this.drawString(fontRendererObj, descr.get(i).toString(), - (int) (guiLeft / 0.75F) + 12, - (int) (guiTop / 0.75F) + 184 + (int) (guiLeft / 0.75F) + + 12, + (int) (guiTop / 0.75F) + + 184 + i * 12 - - (descr.size() > 1 ? 6 + - (descr.size() > 1 + ? 6 : 0), 0xffffff); GL11.glPopMatrix(); } - if (playerInfo.getInteger(curse.getName()) == 2) { - mc.renderEngine - .bindTexture(Variables.MISC_TEXTURE); + if (playerInfo.getInteger( + curse.getName()) == 2) { + mc.renderEngine.bindTexture( + Variables.MISC_TEXTURE); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, + GL11.glBlendFunc( + GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1f, 1f, 1f, 0.5f); - drawTexturedModalRect(guiLeft + 134, - guiTop + 11 - + (size - 8) - * (ind - page * 5), - 3 * 16, 0, 16, 16); + GL11.glColor4f(1f, + 1f, + 1f, + 0.5f); + drawTexturedModalRect( + guiLeft + 134, + guiTop + 11 + (size + - 8) + * (ind - page * 5), + 3 * 16, + 0, + 16, + 16); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } mc.renderEngine.bindTexture( - new ResourceLocation(Variables.MODID, - "textures/gui/" - + curse.getTexturePack() + new ResourceLocation( + Variables.MODID, + "textures/gui/" + curse + .getTexturePack() + ".png")); int tag = curse.getTextureID(); GL11.glPushMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, + 1.0F, + 1.0F); GL11.glDisable(GL11.GL_LIGHTING); - GL11.glScalef(0.5f, 0.5f, 0.0f); - drawTexturedModalRect(guiLeft * 2 + 100, - guiTop * 2 + 22 + (ind - page * 5) * 48, - tag % 8 * 32, tag / 8 * 32, 32, 32); + GL11.glScalef(0.5f, 0.5f, + 0.0f); + drawTexturedModalRect( + guiLeft * 2 + 100, + guiTop * 2 + 22 + (ind + - page * 5) + * 48, + tag % 8 * 32, + tag / 8 * 32, + 32, 32); GL11.glPopMatrix(); this.drawString(fontRendererObj, - curse.getDisplayName(), guiLeft + 70, - guiTop + 15 - + (ind - page * 5) * (size - 8), + curse.getDisplayName(), + guiLeft + 70, + guiTop + 15 + (ind + - page * 5) + * (size - 8), 0xffffff); } ind++; @@ -211,68 +272,103 @@ public class GuiCurseInfo extends GuiContainer { if (ind >= page * 5 && ind < (page + 1) * 5) { if (ind == page * 5 && selectedCurse == "") selectedCurse = curse.getName(); - if (playerInfo.getInteger(curse.getName()) <= 0) { + if (playerInfo.getInteger( + curse.getName()) <= 0) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (!curse.canCurseBeActivated() || !ConfigHandler.CURSES_ENABLED) - GL11.glColor4f(1f, 0f, 0f, 0.5f); + GL11.glColor4f(1f, 0f, 0f, + 0.5f); else - GL11.glColor4f(1f, 1f, 1f, 0.5f); + GL11.glColor4f(1f, 1f, 1f, + 0.5f); } - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - drawTexturedModalRect(guiLeft + 43, - guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32, - 112, 22); + mc.renderEngine.bindTexture( + Variables.MISC_TEXTURE); + drawTexturedModalRect(guiLeft + 43, guiTop + + 8 + + (size - 8) * (ind - page + * 5), + 0, 32, 112, 22); if (selectedCurse == curse.getName()) { GL11.glPushMatrix(); GL11.glScalef(1.2f, 1.5f, 0f); - drawTexturedModalRect((int) (guiLeft / (1.2)) + 126, - (int) (guiTop / (1.5)) + 7 - + (size - 16) * (ind - page * 5), + drawTexturedModalRect( + (int) (guiLeft / (1.2)) + + 126, + (int) (guiTop / (1.5)) + + 7 + + (size - 16) * (ind + - page * 5), 48, 16, 32, 16); - drawTexturedModalRect((int) (guiLeft / (1.2)) + 5, - (int) (guiTop / (1.5)) + 7 - + (size - 16) * (ind - page * 5), + drawTexturedModalRect( + (int) (guiLeft / (1.2)) + + 5, + (int) (guiTop / (1.5)) + + 7 + + (size - 16) * (ind + - page * 5), 80, 16, 32, 16); GL11.glPopMatrix(); GL11.glPushMatrix(); - List descr = - fontRendererObj.listFormattedStringToWidth( - curse.getDescription(), 238); + List descr = fontRendererObj + .listFormattedStringToWidth( + curse.getDescription(), + 238); GL11.glScalef(0.75F, 0.75F, 0F); - for (int i = 0; i < descr.size(); i++) + for (int i = 0; i < descr + .size(); i++) this.drawString(fontRendererObj, descr.get(i).toString(), - (int) (guiLeft / 0.75F) + 12, - (int) (guiTop / 0.75F) + 184 + i * 12 - - (descr.size() > 1 ? 6 : 0), + (int) (guiLeft / 0.75F) + + 12, + (int) (guiTop / 0.75F) + + 184 + + i * 12 + - (descr.size() > 1 + ? 6 + : 0), 0xffffff); GL11.glPopMatrix(); } - mc.renderEngine.bindTexture(new ResourceLocation( - Variables.MODID, "textures/gui/" - + curse.getTexturePack() + ".png")); + mc.renderEngine.bindTexture( + new ResourceLocation( + Variables.MODID, + "textures/gui/" + curse + .getTexturePack() + + ".png")); int tag = curse.getTextureID(); GL11.glPushMatrix(); - if (playerInfo.getInteger(curse.getName()) <= 0) - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + if (playerInfo.getInteger( + curse.getName()) <= 0) + GL11.glColor4f(1.0F, 1.0F, 1.0F, + 0.5F); else - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, + 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(0.5f, 0.5f, 0.0f); drawTexturedModalRect(guiLeft * 2 + 100, - guiTop * 2 + 22 + (ind - page * 5) * 48, - tag % 8 * 32, tag / 8 * 32, 32, 32); + guiTop * 2 + 22 + (ind + - page * 5) + * 48, + tag % 8 * 32, tag / 8 * 32, + 32, 32); GL11.glPopMatrix(); - this.drawString(fontRendererObj, curse.getDisplayName(), + this.drawString(fontRendererObj, + curse.getDisplayName(), guiLeft + 70, - guiTop + 15 + (ind - page * 5) * (size - 8), - playerInfo.getInteger(curse.getName()) > 0 - ? 0xffffffff : 0xaaffffff); - if (playerInfo.getInteger(curse.getName()) <= 0) { + guiTop + 15 + (ind + - page * 5) + * (size - 8), + playerInfo.getInteger(curse + .getName()) > 0 ? 0xffffffff + : 0xaaffffff); + if (playerInfo.getInteger( + curse.getName()) <= 0) { GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } @@ -282,7 +378,8 @@ public class GuiCurseInfo extends GuiContainer { } @Override - public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + public void drawGuiContainerForegroundLayer(int mouseX, + int mouseY) { // Do nothing } @@ -299,7 +396,8 @@ public class GuiCurseInfo extends GuiContainer { int cornerX = guiLeft; int cornerY = guiTop; this.buttonList.clear(); - TabRegistry.updateTabValues(cornerX, cornerY, TabCurses.class); + TabRegistry.updateTabValues(cornerX, cornerY, + TabCurses.class); TabRegistry.addTabsToList(this.buttonList); } @@ -310,70 +408,100 @@ public class GuiCurseInfo extends GuiContainer { int size = 32; if (player != null) { NBTTagCompound playerInfo = PlayerUtils - .getModPlayerPersistTag(player, Variables.MODID); + .getModPlayerPersistTag(player, + Variables.MODID); for (Curse curse : Curse.getCurseList()) { if (player.capabilities.isCreativeMode) { if (x > (guiLeft + 43) && y > (guiTop + 8 - + (size - 8) * (ind - page * 5)) - && x < (guiLeft + 43 + 112) + + (size - 8) * (ind + - page * 5)) + && x < (guiLeft + 43 + + 112) && y < (guiTop + 40 - + (size - 8) * (ind - page * 5)) - && ind >= page * 5 && ind < (page + 1) * 5) { + + (size - 8) * (ind + - page * 5)) + && ind >= page * 5 + && ind < (page + 1) + * 5) { if (player.capabilities.isCreativeMode - && isCtrlKeyDown() && playerInfo - .getInteger(curse.getName()) > 0) { - playerInfo.setInteger(curse.getName(), 0); - playerInfo.setInteger("activeCurses", - playerInfo.getInteger("activeCurses") + && isCtrlKeyDown() + && playerInfo.getInteger( + curse.getName()) > 0) { + playerInfo.setInteger( + curse.getName(), + 0); + playerInfo.setInteger( + "activeCurses", + playerInfo.getInteger( + "activeCurses") - 1); - Curse.availableCurses.add(curse); - JewelrycraftMod.netWrapper.sendToServer( - new PacketSendServerPlayerInfo( - "remove", curse.getName(), + Curse.availableCurses + .add(curse); + JewelrycraftMod.netWrapper + .sendToServer(new PacketSendServerPlayerInfo( + "remove", + curse.getName(), playerInfo)); - JewelrycraftMod.netWrapper.sendToAll( - new PacketSendServerPlayersInfo()); + JewelrycraftMod.netWrapper + .sendToAll(new PacketSendServerPlayersInfo()); } else if (player.capabilities.isCreativeMode && isCtrlKeyDown() - && playerInfo - .getInteger(curse.getName()) <= 0 + && playerInfo.getInteger( + curse.getName()) <= 0 && curse.canCurseBeActivated() && ConfigHandler.CURSES_ENABLED) { - playerInfo.setInteger(curse.getName(), 1); - playerInfo.setInteger("activeCurses", - playerInfo.getInteger("activeCurses") + playerInfo.setInteger( + curse.getName(), + 1); + playerInfo.setInteger( + "activeCurses", + playerInfo.getInteger( + "activeCurses") + 1); - Curse.availableCurses.remove(curse); - JewelrycraftMod.netWrapper.sendToServer( - new PacketSendServerPlayerInfo("add", - curse.getName(), playerInfo)); - JewelrycraftMod.netWrapper.sendToAll( - new PacketSendServerPlayersInfo()); + Curse.availableCurses + .remove(curse); + JewelrycraftMod.netWrapper + .sendToServer(new PacketSendServerPlayerInfo( + "add", + curse.getName(), + playerInfo)); + JewelrycraftMod.netWrapper + .sendToAll(new PacketSendServerPlayersInfo()); } else - selectedCurse = curse.getName(); + selectedCurse = curse + .getName(); } ind++; - } else if (playerInfo.getInteger(curse.getName()) > 0) { + } else if (playerInfo.getInteger( + curse.getName()) > 0) { if (x > (guiLeft + 43) && y > (guiTop + 8 - + (size - 8) * (ind - page * 5)) - && x < (guiLeft + 43 + 112) + + (size - 8) * (ind + - page * 5)) + && x < (guiLeft + 43 + + 112) && y < (guiTop + 40 - + (size - 8) * (ind - page * 5)) - && ind >= page * 5 && ind < (page + 1) * 5) - selectedCurse = curse.getName(); + + (size - 8) * (ind + - page * 5)) + && ind >= page * 5 + && ind < (page + 1) + * 5) + selectedCurse = curse + .getName(); ind++; } } } if (page > 0 && x > guiLeft + 5 && x < guiLeft + 18 - && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) { + && y > guiTop + ySize - 14 + && y < guiTop + ySize - 3) { page--; selectedCurse = ""; } if (page < maxPages && x > guiLeft + xSize - 38 - && x < guiLeft + xSize - 25 && y > guiTop + ySize - 14 + && x < guiLeft + xSize - 25 + && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) { page++; selectedCurse = ""; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java index a91b5a4..d322761 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java @@ -21,22 +21,25 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class GuiGuide extends GuiContainer { - public int page, rot, del; - public boolean prevHover, nextHover; - World world; - private final GuiTab[] tabs = - new GuiTab[] { new GuiTabIntroduction(0), new GuiTabBlocks(1), - new GuiTabItems(2), new GuiTabGemsAndIngots(3), - new GuiTabCurses(4), new GuiTabModifiers(5), - new GuiTabRitual(6) }; - private GuiTab activeTab; - ResourceLocation pageTexture, flippedPageTexture; + public int page, rot, del; + public boolean prevHover, nextHover; + World world; + private final GuiTab[] tabs = new GuiTab[] { + new GuiTabIntroduction(0), new GuiTabBlocks(1), + new GuiTabItems(2), new GuiTabGemsAndIngots(3), + new GuiTabCurses(4), new GuiTabModifiers(5), + new GuiTabRitual(6) + }; + private GuiTab activeTab; + ResourceLocation pageTexture, flippedPageTexture; // GUIDE - public static GuiTab prevActive = new GuiTabIntroduction(0); - public static int prevPage = 1; + public static GuiTab prevActive = new GuiTabIntroduction( + 0); + public static int prevPage = 1; public GuiGuide(Container container, World world, - ResourceLocation pageTex, ResourceLocation flipPageTex) { + ResourceLocation pageTex, + ResourceLocation flipPageTex) { super(container); page = prevPage; rot = 0; @@ -49,7 +52,8 @@ public class GuiGuide extends GuiContainer { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { + protected void drawGuiContainerBackgroundLayer(float f, int i, + int j) { nextHover = false; prevHover = false; if (del == 0) @@ -59,12 +63,12 @@ public class GuiGuide extends GuiContainer { del = 0; Minecraft.getMinecraft().getTextureManager() .bindTexture(pageTexture); - drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, - 145, 179); + drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, + 0, 0, 145, 179); Minecraft.getMinecraft().getTextureManager() .bindTexture(flippedPageTexture); - drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, - 145, 179); + drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, + 0, 0, 145, 179); for (GuiRectangle tab : tabs) { int srcX = 24; int sizeX = 19; @@ -76,35 +80,43 @@ public class GuiGuide extends GuiContainer { tab.draw(this, srcX, 180, sizeX, 18); } if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 - && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 + && j >= guiTop + 127 + 20 + && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()) { - drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, - 180, 11, 14); + drawTexturedModalRect(guiLeft + 195 + 20, + guiTop + 127 + 20, 0, 180, 11, 14); nextHover = true; } if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 - && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 + && j >= guiTop + 127 + 20 + && j <= guiTop + 127 + 20 + 14 && page - 2 > 0) { - drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, - 180, 11, 14); + drawTexturedModalRect(guiLeft - 61 + 20, + guiTop + 127 + 20, 11, 180, 11, + 14); prevHover = true; } activeTab.drawBackground(this, i, j, page); activeTab.drawBackground(this, i, j, page + 1); ArrayList text = new ArrayList<>(); text.add(page + "/" + activeTab.getMaxPages()); - drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), + drawHoveringText(text, + guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 25, fontRendererObj); if (page < activeTab.getMaxPages()) { text.remove(0); - text.add((page + 1) + "/" + activeTab.getMaxPages()); + text.add((page + 1) + "/" + + activeTab.getMaxPages()); drawHoveringText(text, - guiLeft - 10 + 20 + 147 - text.get(0).length(), - guiTop + 150 + 25, fontRendererObj); + guiLeft - 10 + 20 + 147 - text + .get(0).length(), + guiTop + 150 + 25, + fontRendererObj); } for (int tab = 0; tab < tabs.length; tab++) renderItem(tabs[tab].getIcon(), guiLeft - 52, - guiTop + 26 + tab * 19, activeTab.getIcon()); + guiTop + 26 + tab * 19, + activeTab.getIcon()); } @Override @@ -140,8 +152,8 @@ public class GuiGuide extends GuiContainer { ItemStack activeIcon) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); - EntityItem entityitem = - new EntityItem(world, 0.0D, 0.0D, 0.0D, item); + EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, + 0.0D, item); entityitem.hoverStart = 0.0F; if (item.isItemEqual(new ItemStack(BlockList.smelter))) { y -= 3; @@ -154,36 +166,40 @@ public class GuiGuide extends GuiContainer { GL11.glRotatef(rot, 0, 1, 0); if (item.isItemEqual(new ItemStack(BlockList.smelter))) GL11.glScalef(1.5F, 1.5F, 1.5F); - else if (item.isItemEqual(new ItemStack(BlockList.handPedestal))) { + else if (item.isItemEqual( + new ItemStack(BlockList.handPedestal))) { GL11.glScalef(1.2F, 1.2F, 1.2F); GL11.glTranslatef(0F, -0.05F, 0F); } GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - if (!(Block.getBlockFromItem( - entityitem.getEntityItem().getItem()) instanceof BlockAir)) + if (!(Block.getBlockFromItem(entityitem.getEntityItem() + .getItem()) instanceof BlockAir)) RenderHelper.enableStandardItemLighting(); if (RenderManager.instance.options.fancyGraphics) - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, - 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, + 0.0F); else { GL11.glRotatef(180F, 0F, 1F, 0F); RenderManager.instance.options.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, - 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, + 0.0F); RenderManager.instance.options.fancyGraphics = false; } - if (!(Block.getBlockFromItem( - entityitem.getEntityItem().getItem()) instanceof BlockAir)) + if (!(Block.getBlockFromItem(entityitem.getEntityItem() + .getItem()) instanceof BlockAir)) RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } - public void renderItem(ItemStack item, float x, float y, float scale, - boolean rotate, float xRot, float yRot, float zRot) { + public void renderItem(ItemStack item, float x, float y, + float scale, boolean rotate, float xRot, + float yRot, float zRot) { GL11.glPushMatrix(); - EntityItem entityitem = - new EntityItem(world, 0.0D, 0.0D, 0.0D, item); + EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, + 0.0D, item); entityitem.hoverStart = 0.0F; GL11.glTranslatef(x, y, 100); GL11.glScalef(-scale, scale, scale); @@ -196,24 +212,27 @@ public class GuiGuide extends GuiContainer { GL11.glRotatef(zRot, 0, 0, 1); if (xRot >= 90F || zRot >= 90F) GL11.glTranslatef(0F, -0.2F, 0F); - if (Block.getBlockFromItem(entityitem.getEntityItem() + if (Block.getBlockFromItem(entityitem + .getEntityItem() .getItem()) instanceof BlockShadowEye) GL11.glTranslatef(0F, 0F, 0.025F); } - if (!(Block.getBlockFromItem( - entityitem.getEntityItem().getItem()) instanceof BlockAir)) + if (!(Block.getBlockFromItem(entityitem.getEntityItem() + .getItem()) instanceof BlockAir)) RenderHelper.enableStandardItemLighting(); if (RenderManager.instance.options.fancyGraphics) - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, - 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, + 0.0F); else { RenderManager.instance.options.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, - 0.0D, 0.0D, 0.0F, 0.0F); + RenderManager.instance.renderEntityWithPosYaw( + entityitem, 0.0D, 0.0D, 0.0D, 0.0F, + 0.0F); RenderManager.instance.options.fancyGraphics = false; } - if (!(Block.getBlockFromItem( - entityitem.getEntityItem().getItem()) instanceof BlockAir)) + if (!(Block.getBlockFromItem(entityitem.getEntityItem() + .getItem()) instanceof BlockAir)) RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java index ae21f08..be4a907 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java @@ -17,7 +17,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { - ResourceLocation pageTexture = new ResourceLocation( + ResourceLocation pageTexture = new ResourceLocation( Variables.MODID, "textures/gui/guidePage.png"); ResourceLocation flippedPageTexture = new ResourceLocation( Variables.MODID, "textures/gui/guidePageFlip.png"); @@ -28,14 +28,15 @@ public class GuiHandler implements IGuiHandler { ResourceLocation cursesInvTexture = new ResourceLocation( Variables.MODID, "textures/gui/curses_tab.png"); ResourceLocation jewlryModTexture = new ResourceLocation( - Variables.MODID, "textures/gui/jewelry_modifier.png"); + Variables.MODID, + "textures/gui/jewelry_modifier.png"); /** * */ public GuiHandler() { - NetworkRegistry.INSTANCE - .registerGuiHandler(JewelrycraftMod.instance, this); + NetworkRegistry.INSTANCE.registerGuiHandler( + JewelrycraftMod.instance, this); } /** @@ -52,16 +53,26 @@ public class GuiHandler implements IGuiHandler { World world, int x, int y, int z) { switch (ID) { case 0: - return new ContainerRingChest(player.inventory, - (TileEntityChest) world.getTileEntity(x, y, z)); + return new ContainerRingChest( + player.inventory, + (TileEntityChest) world + .getTileEntity(x, + y, + z)); case 1: return new ContainerGuide(); case 2: - return new ContainerJewelryTab(player, player.inventory, - new JewelryInventory(player)); + return new ContainerJewelryTab(player, + player.inventory, + new JewelryInventory( + player)); case 3: - return new ContainerJewelryModifier(player.inventory, - new InventoryBasic("ItemModifier", false, 37)); + return new ContainerJewelryModifier( + player.inventory, + new InventoryBasic( + "ItemModifier", + false, + 37)); case 4: return new ContainerCurseInfo(); default: @@ -84,29 +95,42 @@ public class GuiHandler implements IGuiHandler { switch (ID) { case 0: return new GuiRingChest( - (ContainerRingChest) getServerGuiElement(ID, - player, world, x, y, z), + (ContainerRingChest) getServerGuiElement( + ID, player, + world, x, + y, z), chestTexture); case 1: return new GuiGuide( - (ContainerGuide) getServerGuiElement(ID, player, - world, x, y, z), - world, pageTexture, flippedPageTexture); + (ContainerGuide) getServerGuiElement( + ID, player, + world, x, + y, z), + world, pageTexture, + flippedPageTexture); case 2: return new GuiJewelry( - new ContainerJewelryTab(player, player.inventory, - new JewelryInventory(player)), + new ContainerJewelryTab( + player, + player.inventory, + new JewelryInventory( + player)), jewelryInvTexture); case 3: return new GuiJewelryModifier( - (ContainerJewelryModifier) getServerGuiElement(ID, - player, world, x, y, z), + (ContainerJewelryModifier) getServerGuiElement( + ID, player, + world, x, + y, z), jewlryModTexture); case 4: return new GuiCurseInfo( - (ContainerCurseInfo) getServerGuiElement(ID, - player, world, x, y, z), - world, player, cursesInvTexture); + (ContainerCurseInfo) getServerGuiElement( + ID, player, + world, x, + y, z), + world, player, + cursesInvTexture); default: return null; } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java index bccf2b1..1498f75 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java @@ -35,12 +35,14 @@ public class GuiJewelry extends GuiContainer { public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { GL11.glColor3f(1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + Minecraft.getMinecraft().getTextureManager() + .bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); GL11.glPushMatrix(); GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60, (float) (guiLeft - 24) - mouseX, - (float) (guiTop + 124 - 90) - mouseY, this.mc.thePlayer); + (float) (guiTop + 124 - 90) - mouseY, + this.mc.thePlayer); GL11.glPopMatrix(); } @@ -49,7 +51,8 @@ public class GuiJewelry extends GuiContainer { * @param mouseY */ @Override - public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + public void drawGuiContainerForegroundLayer(int mouseX, + int mouseY) { // Do nothing } @@ -70,7 +73,8 @@ public class GuiJewelry extends GuiContainer { int cornerX = guiLeft; int cornerY = guiTop; this.buttonList.clear(); - TabRegistry.updateTabValues(cornerX, cornerY, TabJewelry.class); + TabRegistry.updateTabValues(cornerX, cornerY, + TabJewelry.class); TabRegistry.addTabsToList(this.buttonList); } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java index df8035c..30f0b5b 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java @@ -22,22 +22,19 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public class GuiJewelryModifier extends GuiContainer { - private ResourceLocation texture; - private GuiTextField searchField, pages; - private int page = - 1, maxPages = 1, selectedX = 0, selectedY = 0, + private ResourceLocation texture; + private GuiTextField searchField, + pages; + private int page = 1, + maxPages = 1, selectedX = 0, selectedY = 0, selectedPage = 0, enabled = 0; - private ItemStack selectedItem; - private ArrayList< - ItemStack> selectedItems = - new ArrayList<>(); - private List>> selectedItemsPos = - new ArrayList<>(); - ContainerJewelryModifier jMod; + private ItemStack selectedItem; + private ArrayList selectedItems = new ArrayList<>(); + private List>> selectedItemsPos = new ArrayList<>(); + ContainerJewelryModifier jMod; - public GuiJewelryModifier(ContainerJewelryModifier containerJewelryTab, + public GuiJewelryModifier( + ContainerJewelryModifier containerJewelryTab, ResourceLocation texture) { super(containerJewelryTab); xSize = 211; @@ -51,20 +48,25 @@ public class GuiJewelryModifier extends GuiContainer { public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { GL11.glColor3f(1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + Minecraft.getMinecraft().getTextureManager() + .bindTexture(texture); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - if (selectedX != 0 && selectedY != 0 && page == selectedPage) - drawTexturedModalRect(k + selectedX, l + selectedY, 211, 0, 18, - 18); - for (Map> items : selectedItemsPos) { + if (selectedX != 0 && selectedY != 0 + && page == selectedPage) + drawTexturedModalRect(k + selectedX, l + selectedY, + 211, 0, 18, 18); + for (Map> items : selectedItemsPos) { for (Object itemPage : items.keySet()) { if (page == (Integer) itemPage) - for (int x : items.get(itemPage).keySet()) - drawTexturedModalRect(k + x, - l + items.get(itemPage).get(x), 211, 0, 18, + for (int x : items.get(itemPage) + .keySet()) + drawTexturedModalRect( + k + x, + l + items.get(itemPage) + .get(x), + 211, 0, 18, 18); } } @@ -73,13 +75,17 @@ public class GuiJewelryModifier extends GuiContainer { } @Override - public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + public void drawGuiContainerForegroundLayer(int mouseX, + int mouseY) { int i = 0; for (ItemStack item : JewelrycraftUtil.objects) { if (item != null && item.getItem() != null - && (this.searchField.getText() == "" - || item.getDisplayName().toLowerCase() - .contains(this.searchField.getText() + && (this.searchField + .getText() == "" + || item.getDisplayName() + .toLowerCase() + .contains(this.searchField + .getText() .toLowerCase()))) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor3f(1F, 1F, 1F); @@ -89,9 +95,11 @@ public class GuiJewelryModifier extends GuiContainer { try { itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, - this.mc.getTextureManager(), item, + this.mc.getTextureManager(), + item, 88 + 20 * (i % 6), - 7 + 17 * (i / 6) - 136 * (page - 1)); + 7 + 17 * (i / 6) - 136 + * (page - 1)); } catch (Exception e) { JewelrycraftMod.logger .info("Trying to display an item but gets this error: " @@ -113,8 +121,11 @@ public class GuiJewelryModifier extends GuiContainer { if (item != null && searchField != null && searchField.getText() != "" && item.getItem() != null - && item.getDisplayName().toLowerCase().contains( - this.searchField.getText().toLowerCase())) + && item.getDisplayName() + .toLowerCase() + .contains(this.searchField + .getText() + .toLowerCase())) items++; maxPages = items / 48 + 1; page = 1; @@ -127,30 +138,41 @@ public class GuiJewelryModifier extends GuiContainer { protected void mouseClicked(int x, int y, int id) { super.mouseClicked(x, y, id); if (x >= this.searchField.xPosition - && x <= this.searchField.xPosition + this.searchField.width + && x <= this.searchField.xPosition + + this.searchField.width && y >= this.searchField.yPosition && y <= this.searchField.yPosition + this.searchField.height) { this.searchField.setText(""); this.searchField.setFocused(true); - maxPages = JewelrycraftUtil.objects.size() / 48 + 1; + maxPages = JewelrycraftUtil.objects.size() / 48 + + 1; } else this.searchField.setFocused(false); for (Object button : this.buttonList) { if (((GuiButton) button).id < 4 - && ((GuiButton) button).mousePressed(mc, x, y)) { + && ((GuiButton) button) + .mousePressed(mc, + x, + y)) { if (((GuiButton) button).id != 3) { - this.selectedItems.removeAll(selectedItems); - this.selectedItemsPos.removeAll(selectedItemsPos); + this.selectedItems.removeAll( + selectedItems); + this.selectedItemsPos.removeAll( + selectedItemsPos); } else { this.selectedX = 0; this.selectedY = 0; this.selectedItem = null; } - ((GuiButton) buttonList.get(0)).enabled = true; - ((GuiButton) buttonList.get(1)).enabled = true; - ((GuiButton) buttonList.get(2)).enabled = true; - ((GuiButton) buttonList.get(3)).enabled = true; + ((GuiButton) buttonList + .get(0)).enabled = true; + ((GuiButton) buttonList + .get(1)).enabled = true; + ((GuiButton) buttonList + .get(2)).enabled = true; + ((GuiButton) buttonList + .get(3)).enabled = true; ((GuiButton) button).enabled = false; enabled = ((GuiButton) button).id; } @@ -158,41 +180,59 @@ public class GuiJewelryModifier extends GuiContainer { int i = 0; for (ItemStack item : JewelrycraftUtil.objects) { if (item != null && item.getItem() != null - && (this.searchField.getText() == "" - || item.getDisplayName().toLowerCase() - .contains(this.searchField.getText() + && (this.searchField + .getText() == "" + || item.getDisplayName() + .toLowerCase() + .contains(this.searchField + .getText() .toLowerCase()))) { if (i >= (page - 1) * 48 && i < page * 48 - && x >= this.guiLeft + 88 + 20 * (i % 6) - && x < this.guiLeft + 108 + 20 * (i % 6) - && y >= this.guiTop + 9 + 17 * (i / 6) + && x >= this.guiLeft + 88 + + 20 * (i % 6) + && x < this.guiLeft + 108 + + 20 * (i % 6) + && y >= this.guiTop + 9 + + 17 * (i / 6) - 136 * (page - 1) - && y < this.guiTop + 25 + 17 * (i / 6) + && y < this.guiTop + 25 + + 17 * (i / 6) - 136 * (page - 1)) { try { - if (!((GuiButton) buttonList.get(0)).enabled - || !((GuiButton) buttonList.get(1)).enabled + if (!((GuiButton) buttonList + .get(0)).enabled + || !((GuiButton) buttonList + .get(1)).enabled || !((GuiButton) buttonList .get(2)).enabled) { this.selectedItem = item; - this.selectedX = 87 + 20 * (i % 6); - this.selectedY = - 6 + 17 * (i / 6) - 136 * (page - 1); + this.selectedX = 87 + + 20 * (i % 6); + this.selectedY = 6 + + 17 * (i / 6) + - 136 * (page - 1); this.selectedPage = page; } else if (!((GuiButton) buttonList .get(3)).enabled) { - Map> itemPage = - new HashMap<>(); + Map> itemPage = new HashMap<>(); Map pos = new HashMap<>(); - pos.put(87 + 20 * (i % 6), - 6 + 17 * (i / 6) - 136 * (page - 1)); - itemPage.put(page, pos); - if (!this.selectedItems.contains(item)) { - this.selectedItems.add(item); - this.selectedItemsPos.add(itemPage); + pos.put(87 + 20 * (i + % 6), + 6 + 17 * (i / 6) - 136 + * (page - 1)); + itemPage.put(page, + pos); + if (!this.selectedItems + .contains(item)) { + this.selectedItems + .add(item); + this.selectedItemsPos + .add(itemPage); } else { - this.selectedItems.remove(item); - this.selectedItemsPos.remove(itemPage); + this.selectedItems + .remove(item); + this.selectedItemsPos + .remove(itemPage); } } } catch (Exception e) { @@ -213,40 +253,63 @@ public class GuiJewelryModifier extends GuiContainer { && page < maxPages) page++; if (jMod.modInv.getStackInSlot(36) != null) { - ItemStack targetItem = jMod.modInv.getStackInSlot(36).copy(); - if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) - && !((GuiButton) buttonList.get(0)).enabled) { - JewelryNBT.addIngotColor(targetItem, 16777215); + ItemStack targetItem = jMod.modInv + .getStackInSlot(36).copy(); + if (((GuiButton) buttonList.get(4)) + .mousePressed(mc, x, y) + && !((GuiButton) buttonList + .get(0)).enabled) { + JewelryNBT.addIngotColor(targetItem, + 16777215); JewelryNBT.addMetal(targetItem, - new ItemStack(Item.getItemById(0), 0, 0)); + new ItemStack(Item + .getItemById(0), + 0, 0)); if (selectedItem != null) - JewelryNBT.addMetal(targetItem, this.selectedItem); + JewelryNBT.addMetal(targetItem, + this.selectedItem); JewelrycraftMod.netWrapper.sendToServer( - new PacketRequestSetSlot(targetItem)); + new PacketRequestSetSlot( + targetItem)); } - if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) - && !((GuiButton) buttonList.get(1)).enabled) { - JewelryNBT.addGemColor(targetItem, 16777215); + if (((GuiButton) buttonList.get(4)) + .mousePressed(mc, x, y) + && !((GuiButton) buttonList + .get(1)).enabled) { + JewelryNBT.addGemColor(targetItem, + 16777215); JewelryNBT.addGem(targetItem, - new ItemStack(Item.getItemById(0), 0, 0)); + new ItemStack(Item + .getItemById(0), + 0, 0)); if (selectedItem != null) - JewelryNBT.addGem(targetItem, this.selectedItem); + JewelryNBT.addGem(targetItem, + this.selectedItem); JewelrycraftMod.netWrapper.sendToServer( - new PacketRequestSetSlot(targetItem)); + new PacketRequestSetSlot( + targetItem)); } - if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) - && !((GuiButton) buttonList.get(2)).enabled) { + if (((GuiButton) buttonList.get(4)) + .mousePressed(mc, x, y) + && !((GuiButton) buttonList + .get(2)).enabled) { if (selectedItem != null) - JewelryNBT.addItem(targetItem, selectedItem); + JewelryNBT.addItem(targetItem, + selectedItem); JewelrycraftMod.netWrapper.sendToServer( - new PacketRequestSetSlot(targetItem)); + new PacketRequestSetSlot( + targetItem)); } - if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) - && !((GuiButton) buttonList.get(3)).enabled) { + if (((GuiButton) buttonList.get(4)) + .mousePressed(mc, x, y) + && !((GuiButton) buttonList + .get(3)).enabled) { if (!selectedItems.isEmpty()) - JewelryNBT.addModifiers(targetItem, selectedItems); + JewelryNBT.addModifiers(targetItem, + selectedItems); JewelrycraftMod.netWrapper.sendToServer( - new PacketRequestSetSlot(targetItem)); + new PacketRequestSetSlot( + targetItem)); } } this.pages.setText(page + "/" + maxPages); @@ -293,23 +356,32 @@ public class GuiJewelryModifier extends GuiContainer { List list = new ArrayList<>(); for (ItemStack item : JewelrycraftUtil.objects) { if (item != null && item.getItem() != null - && (this.searchField.getText() == "" - || item.getDisplayName().toLowerCase() - .contains(this.searchField.getText() + && (this.searchField + .getText() == "" + || item.getDisplayName() + .toLowerCase() + .contains(this.searchField + .getText() .toLowerCase()))) { if (i >= (page - 1) * 48 && i < page * 48 - && x >= this.guiLeft + 88 + 20 * (i % 6) - && x < this.guiLeft + 108 + 20 * (i % 6) - && y >= this.guiTop + 9 + 17 * (i / 6) + && x >= this.guiLeft + 88 + + 20 * (i % 6) + && x < this.guiLeft + 108 + + 20 * (i % 6) + && y >= this.guiTop + 9 + + 17 * (i / 6) - 136 * (page - 1) - && y < this.guiTop + 25 + 17 * (i / 6) + && y < this.guiTop + 25 + + 17 * (i / 6) - 136 * (page - 1)) { list.add(item.getDisplayName()); if (item.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips) != null) - this.renderToolTip(item, x, y); + this.renderToolTip(item, x, + y); else - this.drawHoveringText(list, x, y, + this.drawHoveringText(list, + x, y, this.fontRendererObj); } i++; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java index 9ce5814..d5e2451 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java @@ -56,8 +56,8 @@ public class GuiRectangle { * @param srcY */ public void draw(GuiGuide gui, int srcX, int srcY) { - gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, - srcX, srcY, w, h); + gui.drawTexturedModalRect(gui.getLeft() + x, + gui.getTop() + y, srcX, srcY, w, h); } /** @@ -69,8 +69,9 @@ public class GuiRectangle { */ public void draw(GuiGuide gui, int srcX, int srcY, int width, int height) { - gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, - srcX, srcY, width, height); + gui.drawTexturedModalRect(gui.getLeft() + x, + gui.getTop() + y, srcX, srcY, width, + height); } /** @@ -83,7 +84,8 @@ public class GuiRectangle { String str) { if (inRect(gui, mouseX, mouseY)) gui.drawHoverString(Arrays.asList(str.split("\n")), - mouseX - gui.getLeft(), mouseY - gui.getTop()); + mouseX - gui.getLeft(), + mouseY - gui.getTop()); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java index 4a71b11..8013440 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java @@ -9,7 +9,7 @@ import net.minecraft.util.ResourceLocation; public class GuiRingChest extends GuiContainer { public ContainerRingChest container; - ResourceLocation texture; + ResourceLocation texture; /** * @param container @@ -33,7 +33,8 @@ public class GuiRingChest extends GuiContainer { public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { GL11.glColor3f(1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + Minecraft.getMinecraft().getTextureManager() + .bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); } @@ -42,7 +43,8 @@ public class GuiRingChest extends GuiContainer { * @param mouseY */ @Override - public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + public void drawGuiContainerForegroundLayer(int mouseX, + int mouseY) { fontRendererObj.drawString("Linked Chest", 8, 6, 0x404040); fontRendererObj.drawString("Inventory", 8, 72, 0x404040); } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java index 8a48a1b..6c72a13 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java @@ -20,8 +20,8 @@ public class GuiTabBlocks extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.blocks"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.blocks"); } /** @@ -45,14 +45,19 @@ public class GuiTabBlocks extends GuiTab { switch (page) { case 1: text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), new ItemStack(BlockList.shadowOre), - text, 180f, 0, -18, true, 42, 100, true); + Page.addImageTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), + new ItemStack(BlockList.shadowOre), + text, 180f, 0, -18, true, + 42, 100, true); break; case 2: text = "Magicians believed this block held the ability to merge with the shadows. It becomes more transparent as it gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), @@ -66,13 +71,16 @@ public class GuiTabBlocks extends GuiTab { break; case 3: text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), - new ItemStack(Blocks.cobblestone), null, + new ItemStack(Blocks.cobblestone), + null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), @@ -80,15 +88,18 @@ public class GuiTabBlocks extends GuiTab { break; case 4: text = "is right click on it with any ore or ingot. It can melt multiple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items added. If right clicked when done smelting, it will say what the block contains."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 5: text = "The molder is a key piece in creating jewelry. You need to pour the molten metal out of the smelter somewhere. That somewhere is the molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.molder), - new ItemStack(Blocks.cobblestone), null, + new ItemStack(Blocks.cobblestone), + null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), @@ -96,8 +107,8 @@ public class GuiTabBlocks extends GuiTab { break; case 6: text = "choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you have a mold inside, left click on the smelter and wait for the metal to cool down. When it's done, left click on the molder to get the jewellery. Be aware that this block must be placed directly in front of the smelter, otherwise it won't work!"; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 7: text = "This table allows you to add a gem to a piece of jewelry. Right click the block while holding jewelry to add it in. Then do the same with a gem (you can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the"; @@ -108,30 +119,41 @@ public class GuiTabBlocks extends GuiTab { del = 0; if (values >= 4) values = 0; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.jewelCraftingTable), - new ItemStack(Blocks.planks, 1, values), - new ItemStack(Blocks.planks, 1, values), - new ItemStack(Blocks.planks, 1, values), - new ItemStack(Blocks.stone), null, + new ItemStack(Blocks.planks, + 1, values), + new ItemStack(Blocks.planks, + 1, values), + new ItemStack(Blocks.planks, + 1, values), + new ItemStack(Blocks.stone), + null, new ItemStack(Blocks.stone), - new ItemStack(Blocks.stone), null, + new ItemStack(Blocks.stone), + null, new ItemStack(Blocks.stone)); break; case 8: text = "progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a jewellery by readding the modified version to this block and adding a different gem to it. Once the crafting is done, the current gem will be replaced by the new one. There is also a 50% chance that you will get back the old gem."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 9: text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE + ") of a single item/block placed in it. It will display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, - new ItemStack(BlockList.displayer), null, - new ItemStack(Items.iron_ingot), null, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, + new ItemStack(BlockList.displayer), + null, + new ItemStack(Items.iron_ingot), + null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), @@ -141,46 +163,58 @@ public class GuiTabBlocks extends GuiTab { break; case 10: text = "simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside. If a displayer already contains an item and you have that in your inventory, you can simply hold right click on it with an empty hand to add all of your items of that type from your inventory. To retrieve a single item just left click the block. If you wish to get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right"; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 11: text = "Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 12: text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer sacrifices to 'The Dark One' in exchange for unimaginable powers."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), - new ItemStack(Blocks.cobblestone_wall), null, - new ItemStack(Blocks.stonebrick), null, - new ItemStack(Blocks.stone_slab, 1, 5), + new ItemStack(Blocks.cobblestone_wall), + null, + new ItemStack(Blocks.stonebrick), + null, + new ItemStack(Blocks.stone_slab, + 1, 5), new ItemStack(Blocks.stonebrick), - new ItemStack(Blocks.stone_slab, 1, 5)); + new ItemStack(Blocks.stone_slab, + 1, 5)); break; case 13: text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful though, for He sees everything. To see how to create the ritual look in the Ritual tab. One you created the ritual, simply place a"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), - new ItemStack(Blocks.stained_hardened_clay, 1, 15), + new ItemStack(Blocks.stained_hardened_clay, + 1, 15), new ItemStack(Blocks.stonebrick), - new ItemStack(Blocks.stained_hardened_clay, 1, 15), + new ItemStack(Blocks.stained_hardened_clay, + 1, 15), new ItemStack(Items.ender_eye), - new ItemStack(Blocks.stained_hardened_clay, 1, 15), + new ItemStack(Blocks.stained_hardened_clay, + 1, 15), new ItemStack(Blocks.stonebrick), - new ItemStack(Blocks.stained_hardened_clay, 1, 15), + new ItemStack(Blocks.stained_hardened_clay, + 1, 15), new ItemStack(Blocks.stonebrick)); break; case 14: text = "piece of jewelry in the middle pedestal and your modifiers of choice in the other ones (you don't need to put an item in every single pedestal). After you do that simply right click the eye to activate the ritual. Be careful not to leave the premise or you'll die! When the ritual is done, Shift+Right Click on the central hand pedestal to retrieve your newly modified item!"; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 15: if (del == 0) @@ -191,10 +225,13 @@ public class GuiTabBlocks extends GuiTab { if (values >= 15) values = 0; text = "Crystals don't do much as of yet. They spawn naturally in caves and come in all 16 colors."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop(), - new ItemStack(BlockList.crystal, 1, values), text, - 180f, 0, -18, true, 48, 120, true); + new ItemStack(BlockList.crystal, + 1, values), + text, 180f, 0, -18, true, + 48, 120, true); break; default: ; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java index 03de3c2..cd18b64 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java @@ -14,8 +14,8 @@ public class GuiTabCurses extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.curses"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.curses"); } @Override @@ -30,100 +30,144 @@ public class GuiTabCurses extends GuiTab { switch (page) { case 1: text = "You are poisoned for as long as this curse is active."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 0), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 0), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 2: text = "Whenever you attack an entity you are set on fire."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 1), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 1), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 3: text = "You can no longer throw any item. I mean, you might need them later, right?"; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 2), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 2), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 4: text = "You are blinded. Literally. I mean, what did you expect?"; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 3), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 3), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 5: text = "There is a random chance that when you attack a passive mob you will lose a full heart, but gain a black heart."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 4), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 4), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 6: text = "Whatever you touch turns into gold. Believe me, this is no good to you, you can't even harvest this gold. At lest the items you can't. But if you touched an entity with your bear hands while the curse is active and then no longer have it, you should be able to mine it with an iron pick or higher. THe golden statue will drop gold nuggets depending on the size of the entity."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 5), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 5), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 7: text = "Entities have a higher chance of dropping more items and hearts when killed."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 6), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 6), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 8: text = "There is a random chance that you'll steal 1 heart from an entity that is collided with you. If you are low on health, you will heal. If you are fully healed, an extra heart will be added to you. You can steal up to 2 hearts per entity (3 if you complete the challenge). When you steal a heart, that entity will have their max health reduced by 1. Challenges are found in the Achievements menu."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 7), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 7), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 9: text = "When you attack an entity and are low on health, there is a 50% chance that you'll heal half a heart. Also you will catch on fire if you're exposed to sun."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 8), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 8), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 10: text = "Any mob you kill or block you destroy(eg. Diamond Ore, Redstone Ore, stuff that drops items not the block itself) drops double the amount of items it normally would."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 9), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 9), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; case 11: text = "All the damage you do pierces through armor or any other type of defense, but creatures no longer drop XP."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.testItem, 1, 10), text, 40f, - 0, 0, Curse.getCurseList().get(page - 1) + new ItemStack(ItemList.testItem, + 1, 10), + text, 40f, 0, 0, + Curse.getCurseList().get( + page - 1) .getDisplayName(), 45, 10, false); break; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java index 086084f..f161cdd 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java @@ -47,46 +47,68 @@ public class GuiTabGemsAndIngots extends GuiTab { GL11.glPushMatrix(); if (i == (page - 1) * 12) gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Gems", - gui.getLeft() + xPos + 40, gui.getTop(), 0); + gui.getLeft() + xPos + + 40, + gui.getTop(), 0); GL11.glScalef(scale, scale, 0f); - gui.getFont().drawString( - String.format("%-1.26s", - JewelrycraftUtil.gem.get(i) - .getDisplayName()), - (int) ((gui.getLeft() + xPos + 12) / scale), + gui.getFont().drawString(String.format( + "%-1.26s", + JewelrycraftUtil.gem.get(i) + .getDisplayName()), + (int) ((gui.getLeft() + + xPos + + 12) + / scale), (int) ((gui.getTop() + 12 - + 12 * (i - 12 * (page - 1))) / scale), + + 12 * (i - 12 * (page + - 1))) + / scale), 0); GL11.glPopMatrix(); gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 5, - gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), + gui.getTop() + 18 + 12 * (i + - 12 * (page - 1)), 24f, true, 0, 0, 0); } page -= JewelrycraftUtil.gem.size() / 13 + 1; for (int i = (page - 1) * 12; i < page * 12; i++) - if (i < JewelrycraftUtil.metal.size() && page > 0) { + if (i < JewelrycraftUtil.metal.size() + && page > 0) { GL11.glPushMatrix(); if (i == (page - 1) * 12) gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Ingots", - gui.getLeft() + xPos + 40, gui.getTop(), 0); + gui.getLeft() + xPos + + 40, + gui.getTop(), 0); GL11.glScalef(scale, scale, 0f); - gui.getFont().drawString( - String.format("%-1.18s", - JewelrycraftUtil.metal.get(i).copy() - .getDisplayName()), - (int) ((gui.getLeft() + xPos + 12) / scale), + gui.getFont().drawString(String.format( + "%-1.18s", + JewelrycraftUtil.metal + .get(i) + .copy() + .getDisplayName()), + (int) ((gui.getLeft() + + xPos + + 12) + / scale), (int) ((gui.getTop() + 12 - + 12 * (i - 12 * (page - 1))) / scale), + + 12 * (i - 12 * (page + - 1))) + / scale), 0); GL11.glPopMatrix(); - gui.renderItem(JewelrycraftUtil.metal.get(i), + gui.renderItem(JewelrycraftUtil.metal + .get(i), gui.getLeft() + xPos + 5, - gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), + gui.getTop() + 18 + 12 * (i + - 12 * (page - 1)), 24f, true, 0, 0, 0); } page -= JewelrycraftUtil.metal.size() / 13 + 1; @@ -95,22 +117,34 @@ public class GuiTabGemsAndIngots extends GuiTab { GL11.glPushMatrix(); if (i == (page - 1) * 12) gui.getFont().drawString( - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Ores", - gui.getLeft() + xPos + 40, gui.getTop(), 0); + gui.getLeft() + xPos + + 40, + gui.getTop(), 0); GL11.glScalef(scale, scale, 0f); - gui.getFont().drawString( - String.format("%-1.18s", - JewelrycraftUtil.ores.get(i).copy() - .getDisplayName()), - (int) ((gui.getLeft() + xPos + 12) / scale), + gui.getFont().drawString(String.format( + "%-1.18s", + JewelrycraftUtil.ores + .get(i) + .copy() + .getDisplayName()), + (int) ((gui.getLeft() + + xPos + + 12) + / scale), (int) ((gui.getTop() + 12 - + 12 * (i - 12 * (page - 1))) / scale), + + 12 * (i - 12 * (page + - 1))) + / scale), 0); GL11.glPopMatrix(); - gui.renderItem(JewelrycraftUtil.ores.get(i), + gui.renderItem(JewelrycraftUtil.ores + .get(i), gui.getLeft() + xPos + 5, - gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), + gui.getTop() + 18 + 12 * (i + - 12 * (page - 1)), 24f, true, 0, 0, 0); } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java index b7b9a62..fe22374 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java @@ -18,8 +18,8 @@ public class GuiTabIntroduction extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.introduction"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.introduction"); } @Override @@ -28,16 +28,20 @@ public class GuiTabIntroduction extends GuiTab { int xPos = page % 2 == 0 ? 107 : -35; switch (page) { case 1: - text = StatCollector.translateToLocal("guide." - + Variables.MODID + ".tab.introduction." + page); - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + text = StatCollector.translateToLocal( + "guide." + Variables.MODID + + ".tab.introduction." + + page); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 2: - text = StatCollector.translateToLocal("guide." - + Variables.MODID + ".tab.introduction." + page); - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + text = StatCollector.translateToLocal( + "guide." + Variables.MODID + + ".tab.introduction." + + page); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java index a741af3..5b9bf55 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java @@ -51,68 +51,99 @@ public class GuiTabItems extends GuiTab { switch (page) { case 1: text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work."; - Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), text, x, y, true, + Page.addSmeltingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), text, x, y, + true, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot)); break; case 2: text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, new ItemStack(ItemList.thiefGloves), - new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), - new ItemStack(Blocks.wool, 1, 15), + null, new ItemStack(ItemList.shadowIngot), - new ItemStack(Blocks.wool, 1, 15), - new ItemStack(Blocks.wool, 1, 15), + new ItemStack(Blocks.wool, + 1, 15), new ItemStack(ItemList.shadowIngot), - new ItemStack(Blocks.wool, 1, 15)); + new ItemStack(Blocks.wool, + 1, 15), + new ItemStack(Blocks.wool, + 1, 15), + new ItemStack(ItemList.shadowIngot), + new ItemStack(Blocks.wool, + 1, 15)); break; case 3: text = "emeralds back as well. This has a maximum of 10 uses before it breaks."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 4: text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), true, text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, 0), + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), true, text, + x, y, true, + new ItemStack(ItemList.clayMolds, + 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball)); break; case 5: text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, 1), null, - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null); + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, + new ItemStack(ItemList.clayMolds, + 1, 1), + null, + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null); break; case 6: text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, 2), - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null); + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, + new ItemStack(ItemList.clayMolds, + 1, 2), + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null); break; case 7: text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, 3), + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, + new ItemStack(ItemList.clayMolds, + 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), - new ItemStack(Items.clay_ball), null, + new ItemStack(Items.clay_ball), + null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), @@ -120,11 +151,17 @@ public class GuiTabItems extends GuiTab { break; case 8: text = "To create earrings you need a mold for them. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), false, text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, 4), null, - null, null, new ItemStack(Items.clay_ball), null, - new ItemStack(Items.clay_ball), null, null, null); + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), false, text, + x, y, true, + new ItemStack(ItemList.clayMolds, + 1, 4), + null, null, null, + new ItemStack(Items.clay_ball), + null, + new ItemStack(Items.clay_ball), + null, null, null); break; case 9: if (del == 0) @@ -135,10 +172,15 @@ public class GuiTabItems extends GuiTab { if (values > 4) values = 0; text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go."; - Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), text, x, y, true, - new ItemStack(ItemList.clayMolds, 1, values), - new ItemStack(ItemList.molds, 1, values)); + Page.addSmeltingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), text, x, y, + true, + new ItemStack(ItemList.clayMolds, + 1, values), + new ItemStack(ItemList.molds, + 1, + values)); break; case 10: if (del == 0) @@ -149,58 +191,73 @@ public class GuiTabItems extends GuiTab { if (values > 4) values = 0; text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really"; - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, - gui.getTop(), true, text, x, y, true, + Page.addCraftingRecipeTextPage(gui, + gui.getLeft() + xPos, + gui.getTop(), true, text, + x, y, true, new ItemStack(ItemList.guide), - new ItemStack(ItemList.molds, 1, values), + new ItemStack(ItemList.molds, + 1, values), new ItemStack(Items.book)); break; case 11: String link = "HERE"; - if (x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10 + if (x >= gui.getLeft() - 7 + && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20 && y <= gui.getTop() + 34) - link = EnumChatFormatting.DARK_BLUE + "HERE" + link = EnumChatFormatting.DARK_BLUE + + "HERE" + EnumChatFormatting.BLACK; text = "appreciate it. After that you can share it in the main thread " + link + "."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 12: - ItemStack item = new ItemStack(ItemList.bucket); + ItemStack item = new ItemStack( + ItemList.bucket); if (del == 0) values++; del++; if (del >= 50) del = 0; - if (values > JewelrycraftUtil.metal.size() - 1) + if (values > JewelrycraftUtil.metal.size() + - 1) values = 0; JewelryNBT.addMetal(item, - JewelrycraftUtil.metal.get(values).copy()); + JewelrycraftUtil.metal.get( + values) + .copy()); text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, - gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, + gui.getTop() - 5, item, + text, 40f, 0, 0, true, 45, 10, false); break; case 13: text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those"; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.jewelryModifier), text, 40f, - 0, 0, true, 45, 10, false); + new ItemStack(ItemList.jewelryModifier), + text, 40f, 0, 0, true, 45, + 10, false); break; case 14: text = "who want to test the mod and can't wait for the normal processes to finish (Smelter, Jeweler's Table, Ritual)."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 15: text = "This item is a creative only item! If you right click in the air while holding this item you'll increment the number of the structure to spawn. Crouch and right click to go backwards. To spawn a structure simply right click on a block with this."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 5, - new ItemStack(ItemList.structureGen), text, 40f, 0, - 0, true, 45, 10, false); + new ItemStack(ItemList.structureGen), + text, 40f, 0, 0, true, 45, + 10, false); break; default: ; @@ -224,11 +281,12 @@ public class GuiTabItems extends GuiTab { @Override public void mouseClick(GuiGuide gui, int x, int y, int button) { if (gui.page == 11 && x >= gui.getLeft() - 7 - && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20 + && x <= gui.getLeft() + 10 + && y >= gui.getTop() + 20 && y <= gui.getTop() + 34) try { - Desktop.getDesktop().browse( - new URL("http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2") + Desktop.getDesktop().browse(new URL( + "http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2") .toURI()); } catch (Exception e) { } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java index 91f5873..cf22586 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java @@ -16,8 +16,8 @@ public class GuiTabModifiers extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.modifiers"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.modifiers"); } /** @@ -41,38 +41,47 @@ public class GuiTabModifiers extends GuiTab { switch (page) { case 1: text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all modifiers that have a use and what they do, in the form of a story/riddle/poem. However, different jewellery have different effects for the same modifier."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), - text); + Page.addTextPage(gui, gui.getLeft() + xPos, + gui.getTop(), text); break; case 2: text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 10, - new ItemStack(Items.blaze_powder), text, 40f, - true); + new ItemStack(Items.blaze_powder), + text, 40f, true); break; case 3: text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, - gui.getTop() - 10, new ItemStack(Items.feather), + Page.addImageTextPage(gui, + gui.getLeft() + xPos, + gui.getTop() - 10, + new ItemStack(Items.feather), text, 40f, true); break; case 4: text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, - gui.getTop() - 10, new ItemStack(Items.ender_eye), + Page.addImageTextPage(gui, + gui.getLeft() + xPos, + gui.getTop() - 10, + new ItemStack(Items.ender_eye), text, 40f, true); break; case 5: text = "Through the power of a pearl arrows don't know where to go. In confusion they can explode, making you a helpless toad. But if an enemy hits, they get damaged like a blitz. You may be weaker, water is bad, but you get saved if health is weak like a lilly pad."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, + Page.addImageTextPage(gui, + gui.getLeft() + xPos, gui.getTop() - 10, - new ItemStack(Items.ender_pearl), text, 40f, true); + new ItemStack(Items.ender_pearl), + text, 40f, true); break; case 6: text = "Toughest stone made on Earth, falling damage is absurd. Deal more damage, more protection, anvils and arrows need inspection. But after long and hard abuse, the stone is starting to get loose. You are weak and heavy, sink like a ship, arrows need only one hit, deal less damage overall, don't abuse its power now."; - Page.addImageTextPage(gui, gui.getLeft() + xPos, - gui.getTop() - 10, new ItemStack(Blocks.obsidian), + Page.addImageTextPage(gui, + gui.getLeft() + xPos, + gui.getTop() - 10, + new ItemStack(Blocks.obsidian), text, 40f, true); break; } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java index 71ad370..36a8a1e 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java @@ -18,8 +18,8 @@ public class GuiTabOresToIngots extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.oretoingot"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.oretoingot"); } /** @@ -40,27 +40,39 @@ public class GuiTabOresToIngots extends GuiTab { public void drawBackground(GuiGuide gui, int x, int y, int page) { int xPos = page % 2 == 0 ? 107 : -35; 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); int i = 0; - for (ItemStack ore : JewelrycraftUtil.oreToIngot.keySet()) { + for (ItemStack ore : JewelrycraftUtil.oreToIngot + .keySet()) { if (i >= (page - 1) * 5 && i < page * 5) { - gui.renderItem(ore, gui.getLeft() + xPos + 10, - gui.getTop() + 12 + 32 * (i - 5 * (page - 1)), 30f, - true, 0, 0, 0); - gui.renderItem(JewelrycraftUtil.oreToIngot.get(ore), + gui.renderItem(ore, gui.getLeft() + xPos + 10, - gui.getTop() + 28 + 32 * (i - 5 * (page - 1)), 30f, - true, 0, 0, 0); - gui.getFont().drawString( - String.format("%-1.18s", ore.getDisplayName()), + gui.getTop() + 12 + 32 * (i + - 5 * (page - 1)), + 30f, true, 0, 0, 0); + gui.renderItem(JewelrycraftUtil.oreToIngot + .get(ore), + gui.getLeft() + xPos + 10, + gui.getTop() + 28 + 32 * (i + - 5 * (page - 1)), + 30f, true, 0, 0, 0); + gui.getFont().drawString(String.format( + "%-1.18s", + ore.getDisplayName()), gui.getLeft() + xPos + 20, - gui.getTop() + 2 + 32 * (i - 5 * (page - 1)), 0); - gui.getFont().drawString( - String.format("%-1.18s", - JewelrycraftUtil.oreToIngot.get(ore) - .getDisplayName()), + gui.getTop() + 2 + 32 * (i + - 5 * (page - 1)), + 0); + gui.getFont().drawString(String.format( + "%-1.18s", + JewelrycraftUtil.oreToIngot + .get(ore) + .getDisplayName()), gui.getLeft() + xPos + 20, - gui.getTop() + 18 + 32 * (i - 5 * (page - 1)), 0); + gui.getTop() + 18 + 32 * (i + - 5 * (page - 1)), + 0); GL11.glDisable(GL11.GL_LIGHTING); } i++; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java index dd4df87..863aa09 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java @@ -15,8 +15,8 @@ public class GuiTabRitual extends GuiTab { @Override public String getName() { - return StatCollector.translateToLocal( - "guide." + Variables.MODID + ".tab.ritual"); + return StatCollector.translateToLocal("guide." + + Variables.MODID + ".tab.ritual"); } @Override @@ -30,199 +30,389 @@ public class GuiTabRitual extends GuiTab { switch (page) { case 1: Page.drawText(gui, - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Layer 1", - gui.getLeft() + xPos + 35, gui.getTop() - 30); + gui.getLeft() + xPos + 35, + gui.getTop() - 30); for (int i = -1; i < 10; i++) for (int j = 0; j < 11; j++) - Page.addSlotItem(gui, - gui.getLeft() + xPos + 11 * i, - gui.getTop() + 11 * j, x, y, - new ItemStack(Blocks.air), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 1, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 1, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 9, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 9, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); + Page.addSlotItem(gui, gui + .getLeft() + + xPos + + 11 * i, + gui.getTop() + 11 + * j, + x, y, + new ItemStack(Blocks.air), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); // Top - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 1, x, y, - new ItemStack(BlockList.handPedestal), 0, 45, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, - gui.getTop() + 11 * 0, x, y, - new ItemStack(BlockList.handPedestal), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 1, x, y, - new ItemStack(BlockList.handPedestal), 0, -45, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 45, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 4, + gui.getTop() + 11 * 0, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(BlockList.handPedestal), + 0, -45, 0); // Left - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 3, x, y, - new ItemStack(BlockList.handPedestal), 0, 45, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * -1, - gui.getTop() + 11 * 5, x, y, - new ItemStack(BlockList.handPedestal), 0, 90, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 7, x, y, - new ItemStack(BlockList.handPedestal), 0, 135, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 3, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 45, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * -1, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 90, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 7, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 135, 0); // Bottom - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 9, x, y, - new ItemStack(BlockList.handPedestal), 0, 135, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, - gui.getTop() + 11 * 10, x, y, - new ItemStack(BlockList.handPedestal), 0, 180, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 9, x, y, - new ItemStack(BlockList.handPedestal), 0, 225, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 135, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 4, + gui.getTop() + 11 * 10, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 180, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 225, 0); // Right - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 3, x, y, - new ItemStack(BlockList.handPedestal), 0, -35, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 9, - gui.getTop() + 11 * 5, x, y, - new ItemStack(BlockList.handPedestal), 0, 270, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 7, x, y, - new ItemStack(BlockList.handPedestal), 0, 225, 0); - - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, - gui.getTop() + 11 * 5, x, y, - new ItemStack(BlockList.handPedestal), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 3, x, + y, + new ItemStack(BlockList.handPedestal), + 0, -35, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 9, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 270, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 7, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 225, 0); + + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 4, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(BlockList.handPedestal), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); break; case 2: Page.drawText(gui, - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Layer 2", - gui.getLeft() + xPos + 35, gui.getTop() - 30); + gui.getLeft() + xPos + 35, + gui.getTop() - 30); for (int i = -1; i < 10; i++) for (int j = 0; j < 11; j++) - Page.addSlotItem(gui, - gui.getLeft() + xPos + 11 * i, - gui.getTop() + 11 * j, x, y, - new ItemStack(Blocks.air), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 1, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 1, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 9, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 9, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); + Page.addSlotItem(gui, gui + .getLeft() + + xPos + + 11 * i, + gui.getTop() + 11 + * j, + x, y, + new ItemStack(Blocks.air), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); break; case 3: Page.drawText(gui, - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Layer 3", - gui.getLeft() + xPos + 35, gui.getTop() - 30); + gui.getLeft() + xPos + 35, + gui.getTop() - 30); for (int i = -1; i < 10; i++) for (int j = 0; j < 11; j++) - Page.addSlotItem(gui, - gui.getLeft() + xPos + 11 * i, - gui.getTop() + 11 * j, x, y, - new ItemStack(Blocks.air), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 1, x, y, - new ItemStack(BlockList.shadowBlock), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 1, x, y, - new ItemStack(BlockList.shadowBlock), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8, - gui.getTop() + 11 * 9, x, y, - new ItemStack(BlockList.shadowBlock), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0, - gui.getTop() + 11 * 9, x, y, - new ItemStack(BlockList.shadowBlock), 0, 0, 0); - - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stonebrick), 0, 0, 0); + Page.addSlotItem(gui, gui + .getLeft() + + xPos + + 11 * i, + gui.getTop() + 11 + * j, + x, y, + new ItemStack(Blocks.air), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(BlockList.shadowBlock), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 1, x, + y, + new ItemStack(BlockList.shadowBlock), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 8, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(BlockList.shadowBlock), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 0, + gui.getTop() + 11 * 9, x, + y, + new ItemStack(BlockList.shadowBlock), + 0, 0, 0); + + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stonebrick), + 0, 0, 0); break; case 4: Page.drawText(gui, - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Layer 4", - gui.getLeft() + xPos + 35, gui.getTop() - 30); + gui.getLeft() + xPos + 35, + gui.getTop() - 30); for (int i = -1; i < 10; i++) for (int j = 0; j < 11; j++) - Page.addSlotItem(gui, - gui.getLeft() + xPos + 11 * i, - gui.getTop() + 11 * j, x, y, - new ItemStack(Blocks.air), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_brick_stairs), 0, 90, - 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_brick_stairs), 0, -90, - 180); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, - gui.getTop() + 11 * 5, x, y, - new ItemStack(BlockList.shadowEye), 0, 90, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_brick_stairs), 0, 90, - 180); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_brick_stairs), 0, -90, - 0); + Page.addSlotItem(gui, gui + .getLeft() + + xPos + + 11 * i, + gui.getTop() + 11 + * j, + x, y, + new ItemStack(Blocks.air), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 2, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_brick_stairs), + 0, 90, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 3, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_brick_stairs), + 0, -90, 180); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 4, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(BlockList.shadowEye), + 0, 90, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 5, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_brick_stairs), + 0, 90, 180); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 6, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_brick_stairs), + 0, -90, 0); break; case 5: Page.drawText(gui, - EnumChatFormatting.DARK_BLUE + "\u00a7n" + EnumChatFormatting.DARK_BLUE + + "\u00a7n" + "Layer 5", - gui.getLeft() + xPos + 35, gui.getTop() - 30); + gui.getLeft() + xPos + 35, + gui.getTop() - 30); for (int i = -1; i < 10; i++) for (int j = 0; j < 11; j++) - Page.addSlotItem(gui, - gui.getLeft() + xPos + 11 * i, - gui.getTop() + 11 * j, x, y, - new ItemStack(Blocks.air), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0); - Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5, - gui.getTop() + 11 * 5, x, y, - new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0); + Page.addSlotItem(gui, gui + .getLeft() + + xPos + + 11 * i, + gui.getTop() + 11 + * j, + x, y, + new ItemStack(Blocks.air), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 3, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_slab, + 1, 5), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 4, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_slab, + 1, 5), + 0, 0, 0); + Page.addSlotItem(gui, + gui.getLeft() + xPos + + 11 * 5, + gui.getTop() + 11 * 5, x, + y, + new ItemStack(Blocks.stone_slab, + 1, 5), + 0, 0, 0); break; } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java index 652d628..975dbd2 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java @@ -10,15 +10,18 @@ import net.minecraft.item.ItemStack; public class ContainerJewelryModifier extends Container { public IInventory modInv; - public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) { + public ContainerJewelryModifier(InventoryPlayer inv, + IInventory mod) { int x, y; modInv = mod; for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225)); + addSlotToContainer(new Slot(inv, x, 26 + 18 * x, + 225)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, - 26 + 18 * x, 167 + y * 18)); + addSlotToContainer(new Slot(inv, + x + 9 + y * 9, 26 + 18 * x, + 167 + y * 18)); addSlotToContainer(new Slot(mod, 36, 37, 9)); } @@ -36,10 +39,12 @@ public class ContainerJewelryModifier extends Container { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < 27) { - if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), + if (!mergeItemStack(itemstack1, 27, + inventorySlots.size(), true)) return null; - } else if (!mergeItemStack(itemstack1, 0, 27, false)) + } else if (!mergeItemStack(itemstack1, 0, 27, + false)) return null; if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index 3061bfd..d3fbab1 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -23,25 +23,28 @@ public class ContainerJewelryTab extends Container { int x, y; // Rings for (x = 0; x <= 9; x++) - addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7)); + addSlotToContainer(new SlotRing(extra, x, + 8 + x * 18, 7)); // Bracelets for (x = 10; x <= 13; x++) - addSlotToContainer( - new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26)); + addSlotToContainer(new SlotBracelet(extra, x, + 8 + (x - 10) * 18, 26)); // Necklaces for (x = 14; x <= 16; x++) - addSlotToContainer( - new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45)); + addSlotToContainer(new SlotNecklace(extra, x, + 8 + (x - 14) * 18, 45)); // Earrings addSlotToContainer(new SlotEarrings(extra, 17, 8, 64)); // Hotbar for (x = 0; x < 9; ++x) - addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); + addSlotToContainer(new Slot(inv, x, 17 + x * 18, + 142)); // Inventory for (x = 0; x < 3; ++x) for (y = 0; y < 9; ++y) - addSlotToContainer(new Slot(inv, 9 + y + x * 9, - 17 + y * 18, 84 + x * 18)); + addSlotToContainer(new Slot(inv, + 9 + y + x * 9, 17 + y * 18, + 84 + x * 18)); } @Override @@ -52,36 +55,49 @@ public class ContainerJewelryTab extends Container { @Override public ItemStack slotClick(int slotID, int j, int k, EntityPlayer player) { - if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) { + if (slotID >= 0 && slotID <= 17 + && !player.worldObj.isRemote) { try { if (player.inventory.getItemStack() == null - && inventoryItemStacks.get(slotID) != null - && ((ItemStack) inventoryItemStacks.get(slotID)) - .getItem() instanceof ItemBaseJewelry) + && inventoryItemStacks.get( + slotID) != null + && ((ItemStack) inventoryItemStacks + .get(slotID)).getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry) ((ItemStack) inventoryItemStacks - .get(slotID)).getItem()).onJewelryUnequipped( - (ItemStack) inventoryItemStacks - .get(slotID)); - else if (player.inventory.getItemStack() != null - && player.inventory.getItemStack() + .get(slotID)).getItem()) + .onJewelryUnequipped( + (ItemStack) inventoryItemStacks + .get(slotID)); + else if (player.inventory + .getItemStack() != null + && player.inventory + .getItemStack() .getItem() instanceof ItemBaseJewelry - && inventoryItemStacks.get(slotID) == null) - ((ItemBaseJewelry) player.inventory.getItemStack() + && inventoryItemStacks.get( + slotID) == null) + ((ItemBaseJewelry) player.inventory + .getItemStack() .getItem()).onJewelryEquipped( player.inventory.getItemStack()); if (player.inventory.getItemStack() == null - && inventoryItemStacks.get(slotID) != null - && ((ItemStack) inventoryItemStacks.get(slotID)) - .getItem() instanceof IJewelryItem) + && inventoryItemStacks.get( + slotID) != null + && ((ItemStack) inventoryItemStacks + .get(slotID)).getItem() instanceof IJewelryItem) ((IJewelryItem) ((ItemStack) inventoryItemStacks - .get(slotID)).getItem()).onJewelryUnequipped( - (ItemStack) inventoryItemStacks - .get(slotID)); - else if (player.inventory.getItemStack() != null - && player.inventory.getItemStack() + .get(slotID)).getItem()) + .onJewelryUnequipped( + (ItemStack) inventoryItemStacks + .get(slotID)); + else if (player.inventory + .getItemStack() != null + && player.inventory + .getItemStack() .getItem() instanceof IJewelryItem - && inventoryItemStacks.get(slotID) == null) - ((IJewelryItem) player.inventory.getItemStack() + && inventoryItemStacks.get( + slotID) == null) + ((IJewelryItem) player.inventory + .getItemStack() .getItem()).onJewelryEquipped( player.inventory.getItemStack()); } catch (Exception e) { @@ -94,7 +110,8 @@ public class ContainerJewelryTab extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { + public ItemStack transferStackInSlot(EntityPlayer player, + int slotID) { ItemStack itemstack = null; Slot slot = (Slot) inventorySlots.get(slotID); if (slot != null && slot.getHasStack()) { @@ -103,38 +120,52 @@ public class ContainerJewelryTab extends Container { if (slotID >= 18) { if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 0)) { - if (!mergeItemStack(itemstack, 0, 10, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 0)) { + if (!mergeItemStack(itemstack, 0, + 10, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemBracelet + } else if (itemstack + .getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 1)) { - if (!mergeItemStack(itemstack, 10, 14, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 1)) { + if (!mergeItemStack(itemstack, 10, + 14, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemNecklace + } else if (itemstack + .getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 2)) { - if (!mergeItemStack(itemstack, 14, 17, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 2)) { + if (!mergeItemStack(itemstack, 14, + 17, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemEarrings + } else if (itemstack + .getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 3)) { - if (!mergeItemStack(itemstack, 17, 18, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 3)) { + if (!mergeItemStack(itemstack, 17, + 18, false) && !slot.getHasStack()) return null; } else { if (slotID < 27) { - if (!mergeItemStack(itemstack, 27, 36 + 18, false)) + if (!mergeItemStack( + itemstack, + 27, + 36 + 18, + false)) return null; } else { - if (!mergeItemStack(itemstack, 18, 27, false)) + if (!mergeItemStack( + itemstack, + 18, 27, + false)) return null; } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java index e848b38..825b737 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java @@ -15,20 +15,24 @@ public class ContainerRingChest extends Container { * @param inv * @param chest */ - public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) { + public ContainerRingChest(InventoryPlayer inv, + TileEntityChest chest) { theChest = chest; int x, y; for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, + addSlotToContainer(new SlotRingChest(inv, x, + 8 + 18 * x, 142, x == inv.currentItem)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, + addSlotToContainer(new Slot(inv, + x + 9 + y * 9, 8 + 18 * x, 84 + y * 18)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) addSlotToContainer(new SlotRingChest(chest, - 26 - (x + y * 9), 8 + 18 * (8 - x), + 26 - (x + y * 9), + 8 + 18 * (8 - x), 17 + (2 - y) * 18, false)); } @@ -55,10 +59,12 @@ public class ContainerRingChest extends Container { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < 27) { - if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), + if (!mergeItemStack(itemstack1, 27, + inventorySlots.size(), true)) return null; - } else if (!mergeItemStack(itemstack1, 0, 27, false)) + } else if (!mergeItemStack(itemstack1, 0, 27, + false)) return null; if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index 2f3a9cc..ab09015 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -25,9 +25,10 @@ public class SlotBracelet extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemBracelet - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 1); + return stack.getItem() instanceof ItemBracelet || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 1); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index c563f4d..1527e29 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -25,9 +25,10 @@ public class SlotEarrings extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemEarrings - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 3); + return stack.getItem() instanceof ItemEarrings || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 3); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index ab2d04e..ba39329 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -25,9 +25,10 @@ public class SlotNecklace extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemNecklace - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 2); + return stack.getItem() instanceof ItemNecklace || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 2); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index 6c16509..41381b1 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -25,9 +25,10 @@ public class SlotRing extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemRing - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 0); + return stack.getItem() instanceof ItemRing || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 0); } /** -- cgit v1.2.3