Posted August 29, 201312 yr Hey guys I have created a gui handler to add my gui objects to the ingame gui.. However, only my items show, and the hunger bars etc... don't show up, and is just blue things on the screen... Here is my code: package net.madcrazydrumma; import java.util.Calendar; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.event.EventPriority; import net.minecraftforge.event.ForgeSubscribe; import org.lwjgl.Sys; import org.lwjgl.opengl.GL11; public class GuiHandler extends Gui { private Minecraft mc = Minecraft.getMinecraft(); public GuiHandler() { } public void drawBRect(int x1, int y1, int x2, int y2, int clr){ drawHorizontalLine(x1, x2, y1, 0x00ff); drawHorizontalLine(x1, x2, y2, 0x00ff); drawVerticalLine(x1, y1, y2, 0x00ff); drawVerticalLine(x2, y1, y2, 0x00ff); drawRect(x1 + 1, y1 + 1, x2, y2, clr); } @ForgeSubscribe(priority = EventPriority.NORMAL) public void renderIngameGUI(RenderGameOverlayEvent event) { //Skill Icons GL11.glPushMatrix(); ResourceLocation icons = new ResourceLocation("minecraft", "overhaul/textures/gui/icons.png"); drawBRect(20, 20, 30, 30, 0x00ffff); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.func_110577_a(icons); drawTexturedModalRect(380, 60, 0, 0, 16, 16); //swords drawTexturedModalRect(380, 80, 16, 0, 16, 16); //bow drawTexturedModalRect(380, 100, 33, 0, 16, 16); //woodcutting drawTexturedModalRect(380, 120, 48, 0, 16, 16); //farming drawCenteredString(mc.fontRenderer, "" + mc.thePlayer.getExtendedProperties("skills"), 410, 64, 0xfffff); drawCenteredString(mc.fontRenderer, "" + mc.thePlayer.getExtendedProperties("skills"), 410, 84, 0xfffff); drawCenteredString(mc.fontRenderer, "" + mc.thePlayer.getExtendedProperties("skills"), 410, 104, 0xfffff); drawCenteredString(mc.fontRenderer, "" + mc.thePlayer.getExtendedProperties("skills"), 410, 124, 0xfffff); GL11.glPopMatrix(); //Skill Icons End // Clock --> //drawString(mc.fontRenderer, "" + Calendar.getInstance().getTime(), 2, 12, 0x00ffff); } }
August 29, 201312 yr Use RenderGameOverlayEvent.Pre or RenderGameOverlayEvent.Post. Reset the texture after you have done your work.
August 29, 201312 yr Author I changed it to .Post, but it still doesnt work... How do i reset the texture afterwards?
August 29, 201312 yr Default Gui texture is in Gui class as an obfuscated field. Use mc.renderEngine.func_110577_a(Gui.field_xxx);
August 29, 201312 yr Author Also, Why isn't my rectangle being drawn? drawBorderedRect(width / 2 - 16, 0, width / 2 + 8, 20, 2, 0xffffff, 0x000000); Im using this method: public void drawBorderedRect(int x, int y, int x1, int y1, int size, int borderC, int insideC) { drawVerticalLine(x, y, y1 -1, borderC); drawVerticalLine(x1 - 1, y, y1 - 1, borderC); drawHorizontalLine(x, x1 - 1, y, borderC); drawHorizontalLine(x, x1 - 1, y1 -1, borderC); drawRect(x + size, y + size, x1 - size, y1 - size, insideC); }
August 29, 201312 yr It would be better to have: public final static ResourceLocation icons = new ResourceLocation("overhaul","textures/gui/icons.png"); Isn't size argument a bit too small to spot ?
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.