Jump to content

Vanilla gui objects not showing up but my custom ones do


madcrazydrumma

Recommended Posts

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);
    }
}

Link to comment
Share on other sites

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);
    }

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.