Posted March 24, 201510 yr Ok, so what I want to do is when you pick up a "coin" the game will display the same overlay as when you get an achievement but with a custom item along with custom text. Got any ideas? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author I have tried doing that but, I am stilling learning about OpenGL and such with Java. Here's something I wrote up but I'm not sure how to put it on screen when picking up an item: @SideOnly(Side.CLIENT) public class GuiCoinCollected extends Gui { private static final ResourceLocation texAchi = new ResourceLocation("textures/gui/achievement/achievement_background.png"); /** Holds the instance of the game (Minecraft) */ private Minecraft theGame; /** Holds the latest width scaled to fit the game window. */ private int width; /** Holds the latest height scaled to fit the game window. */ private int height; private String headerText; private String coinNameText; private long unlockedTime; public GuiCoinCollected(Minecraft par1Minecraft) { this.theGame = par1Minecraft; this.headerText = "\u00A7e" + StatCollector.translateToLocal("crewMod.coinCollected"); coinNameText = ""; } /** * Update the display of the achievement window to match the game window. */ private void updateWindowScale() { GL11.glViewport(0, 0, this.theGame.displayWidth, this.theGame.displayHeight); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); this.width = this.theGame.displayWidth; this.height = this.theGame.displayHeight; ScaledResolution scaledresolution = new ScaledResolution(this.theGame, this.theGame.displayWidth, this.theGame.displayHeight); this.width = scaledresolution.getScaledWidth(); this.height = scaledresolution.getScaledHeight(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); } /** * Updates the small achievement tooltip window, showing a queued achievement if is needed. */ public void updateGui() { GL11.glPushMatrix(); if (this.unlockedTime != 0L) { double d0 = (double)(Minecraft.getSystemTime() - this.unlockedTime) / 3000.0D; if ((d0 < 0.0D || d0 > 1.0D) || coinNameText.equalsIgnoreCase("")) { this.unlockedTime = 0L; } else { this.updateWindowScale(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); double d1 = d0 * 2.0D; if (d1 > 1.0D) { d1 = 2.0D - d1; } d1 *= 4.0D; d1 = 1.0D - d1; if (d1 < 0.0D) { d1 = 0.0D; } d1 *= d1; d1 *= d1; int i = this.width - 160; int j = 0 - (int)(d1 * 36.0D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); this.theGame.getTextureManager().bindTexture(texAchi); GL11.glDisable(GL11.GL_LIGHTING); this.drawTexturedModalRect(i, j, 96, 202, 160, 32); this.theGame.fontRenderer.drawString(this.headerText, i + 30, j + 7, -256); this.theGame.fontRenderer.drawString(this.coinNameText, i + 30, j + 18, -1); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glTranslatef((float)i + 16, (float)j + 16, 50F); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glScalef(20.0F, 20.0F, 20.0F); GL11.glRotatef(10.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-22.5F, 0.0F, 1.0F, 0.0F); GL11.glRotatef((float)(Minecraft.getSystemTime() - this.unlockedTime) / 6F, 0.0F, 1.0F, 0.0F); System.out.println("Gui Class: Ran"); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); } } GL11.glPopMatrix(); } } I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author You mean a TickEvent? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author Oh. I was still looking on how I would use that (no previous experience). I said I just wrote that class up as a base for displaying the achievement thing. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author Where would I put that? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author Oh I understand how to do it! But where would the ElementType.All need to be put? I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
March 24, 201510 yr Author Ok, let me go try that out. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.