From 01c8701b68986ccfa83e902515716838d6829311 Mon Sep 17 00:00:00 2001 From: Onyx Date: Tue, 1 Dec 2015 20:55:30 +0000 Subject: - Fixed all of the bugs mentioned on github - Added new config options - Rabbits paw now increases the chance of spawning hearts, rather than itself spawning some - Hearts now have a much lower chance to spawn by default - You can no longer increase your health past 20 hearts (aka double the default health) - The guide now also shows the total number of pages on each tab - A new luck stat has been added to the Curse API - Cleaned up the code a bit (removed unused methods, imports etc) - The displayer's info now has a purple solid color background; the text also has a much closer shadow and now shrinks in height as well as in width when too big - I have modified the potion list to use Mithion's code, credits have been given --- .../jewelrycraft/client/AbstractTab.java | 135 +++++++++++---------- 1 file changed, 68 insertions(+), 67 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/client/AbstractTab.java') diff --git a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java index 5ff4d2f..cdfb394 100644 --- a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java @@ -1,68 +1,69 @@ -package darkknight.jewelrycraft.client; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.*; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import darkknight.jewelrycraft.util.Variables; - -/** - * @author TinkersCOnstruct - */ -@SideOnly(Side.CLIENT) -public abstract class AbstractTab extends GuiButton -{ - ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/gui/hearts.png"); - ItemStack renderStack; - RenderItem itemRenderer = new RenderItem(); - - public AbstractTab(int id, int posX, int posY, ItemStack renderStack) - { - super(id, posX, posY, 18, 18, ""); - this.renderStack = renderStack; - } - - @Override - public void drawButton (Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - int xOffset = this.enabled ? 0 : 8; - - mc.renderEngine.bindTexture(this.texture); - this.drawTexturedModalRect(this.xPosition, yPosition, 144 + xOffset, 32, 18, 18); - - GL11.glPushMatrix(); - RenderHelper.enableGUIStandardItemLighting(); - this.zLevel = 100.0F; - 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, yPosition + 1); - this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1, yPosition + 1); - GL11.glDisable(GL11.GL_LIGHTING); - this.itemRenderer.zLevel = 0.0F; - this.zLevel = 0.0F; - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - } - } - - @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 + this.width && mouseY < this.yPosition + this.height; - if (inWindow) this.onTabClicked(); - return inWindow; - } - - public abstract void onTabClicked (); - - public abstract boolean shouldAddToList (); +package darkknight.jewelrycraft.client; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +/** + * @author TinkersCOnstruct + */ +@SideOnly(Side.CLIENT) +public abstract class AbstractTab extends GuiButton +{ + ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/gui/hearts.png"); + ItemStack renderStack; + RenderItem itemRenderer = new RenderItem(); + + public AbstractTab(int id, int posX, int posY, ItemStack renderStack) + { + super(id, posX, posY, 18, 18, ""); + this.renderStack = renderStack; + } + + @Override + public void drawButton (Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int xOffset = this.enabled ? 0 : 8; + + mc.renderEngine.bindTexture(this.texture); + this.drawTexturedModalRect(this.xPosition, yPosition, 144 + xOffset, 32, 18, 18); + + GL11.glPushMatrix(); + RenderHelper.enableGUIStandardItemLighting(); + this.zLevel = 100.0F; + 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, yPosition + 1); + this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1, yPosition + 1); + GL11.glDisable(GL11.GL_LIGHTING); + this.itemRenderer.zLevel = 0.0F; + this.zLevel = 0.0F; + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + } + } + + @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 + this.width && mouseY < this.yPosition + this.height; + if (inWindow) this.onTabClicked(); + return inWindow; + } + + public abstract void onTabClicked (); + + public abstract boolean shouldAddToList (); } \ No newline at end of file -- cgit v1.2.3