summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/client/GuiGuide.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
commit420faddca46e70e3a70def168fb4e452ef193b0d (patch)
tree247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java/darkknight/jewelrycraft/client/GuiGuide.java
parent3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff)
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java/darkknight/jewelrycraft/client/GuiGuide.java')
-rw-r--r--java/darkknight/jewelrycraft/client/GuiGuide.java143
1 files changed, 74 insertions, 69 deletions
diff --git a/java/darkknight/jewelrycraft/client/GuiGuide.java b/java/darkknight/jewelrycraft/client/GuiGuide.java
index 879c9b3..503e681 100644
--- a/java/darkknight/jewelrycraft/client/GuiGuide.java
+++ b/java/darkknight/jewelrycraft/client/GuiGuide.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.client;
import java.util.ArrayList;
import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -12,9 +11,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.container.GuiRectangle;
import darkknight.jewelrycraft.container.GuiTab;
@@ -30,21 +27,32 @@ public class GuiGuide extends GuiContainer
World world;
private final GuiTab[] tabs;
private GuiTab activeTab;
+ ResourceLocation pageTexture, flippedPageTexture;
- public GuiGuide(Container container, World world)
+ /**
+ * @param container
+ * @param world
+ * @param pageTex
+ * @param flipPageTex
+ */
+ public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex)
{
super(container);
page = 1;
rot = 0;
del = 0;
this.world = world;
-
- tabs = new GuiTab[]
- { new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)};
-
+ tabs = new GuiTab[]{new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)};
activeTab = tabs[0];
+ pageTexture = pageTex;
+ flippedPageTexture = flipPageTex;
}
+ /**
+ * @param f
+ * @param i
+ * @param j
+ */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
@@ -53,115 +61,94 @@ public class GuiGuide extends GuiContainer
if (del == 0) rot++;
del++;
if (del >= 2) del = 0;
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture);
drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 180);
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(flippedPageTexture);
drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 180);
-
- for (GuiRectangle tab : tabs)
- {
+ for(GuiRectangle tab: tabs){
int srcX = 24;
int sizeX = 19;
-
- if (tab == activeTab)
- {
+ if (tab == activeTab){
srcX += 38;
sizeX += 3;
- }
- else if (tab.inRect(this, i, j))
- {
- srcX += 19;
- }
-
+ }else if (tab.inRect(this, i, j)) srcX += 19;
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 && page + 2 <= activeTab.getMaxPages())
- {
+ if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()){
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 && page - 2 > 0)
- {
+ if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0){
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<String> text = new ArrayList<String>();
text.add(Integer.toString(page));
- this.drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
+ drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
text.remove(Integer.toString(page));
text.add(Integer.toString(page + 1));
- this.drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
-
- for (int tab = 0; tab < tabs.length; tab++)
+ drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
+ for(int tab = 0; tab < tabs.length; tab++)
renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon());
-
}
+ /**
+ * @param x
+ * @param y
+ */
+ @Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
activeTab.drawForeground(this, x, y, page);
activeTab.drawForeground(this, x, y, page + 1);
-
- for (GuiTab tab : tabs)
- {
+ for(GuiTab tab: tabs)
tab.drawString(this, x, y, tab.getName());
- }
}
+ /**
+ * @param x
+ * @param y
+ * @param button
+ */
@Override
protected void mouseClicked(int x, int y, int button)
{
if (nextHover && page + 2 <= activeTab.getMaxPages()) page += 2;
else if (prevHover && page > 1) page -= 2;
-
activeTab.mouseClick(this, x, y, button);
-
- for (GuiTab tab : tabs)
- {
- if (activeTab != tab)
- {
- if (tab.inRect(this, x, y))
- {
- activeTab = tab;
- page = 1;
- break;
- }
+ for(GuiTab tab: tabs)
+ if (activeTab != tab) if (tab.inRect(this, x, y)){
+ activeTab = tab;
+ page = 1;
+ break;
}
- }
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param activeIcon
+ */
public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon)
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
- if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
- {
- y -= 4;
- }
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))) y -= 4;
GL11.glTranslatef(x, y, 100);
-
float scale = 30F;
GL11.glScalef(-scale, scale, scale);
-
if (activeIcon != null && item.isItemEqual(activeIcon)) GL11.glRotatef(rot, 0, 1, 0);
- if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
- {
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))){
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
- }
- else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
-
+ }else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ 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);
@@ -169,9 +156,14 @@ public class GuiGuide extends GuiContainer
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
-
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param scale
+ */
public void renderItem(ItemStack item, float x, float y, float scale)
{
GL11.glPushMatrix();
@@ -183,8 +175,7 @@ public class GuiGuide extends GuiContainer
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
@@ -192,22 +183,36 @@ public class GuiGuide extends GuiContainer
GL11.glPopMatrix();
}
+ /**
+ * @return
+ */
public int getLeft()
{
return guiLeft;
}
+ /**
+ * @return
+ */
public int getTop()
{
return guiTop;
}
+ /**
+ * @return
+ */
public FontRenderer getFont()
{
return fontRendererObj;
}
- @SuppressWarnings("rawtypes")
+ /**
+ * @param lst
+ * @param x
+ * @param y
+ */
+ @SuppressWarnings ("rawtypes")
public void drawHoverString(List lst, int x, int y)
{
drawHoveringText(lst, x, y, fontRendererObj);