Jump to content

GuiSlot not calling drawSlot


superckl

Recommended Posts

I'm having a problem where my drawSlot method is not being called in my GuiRewardsList that extends GuiSlot. Here is the relevant code:

 

GuiVote (the parent GUI):

package me.superckl.VoltzationCore.client;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.gui.inventory.GuiContainer;

import org.lwjgl.opengl.GL11;

public class GuiVote extends GuiScreen{

private final GuiRewardList list;

public GuiVote() {
	this.list = new GuiRewardList(this, this.fontRenderer);
}

@Override
public void initGui() {
	//TODO add buttons and such here
}


@Override
protected void actionPerformed(final GuiButton par1GuiButton) {
	//TODO called when a button is clicked
}

@Override
public void updateScreen() {
	//TODO If vote while open, change to thank you
}

@Override
public void drawScreen(int par1, int par2, float par3){
	// TODO refer to following code, drawn before items
	this.drawDefaultBackground();
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.renderEngine.bindTexture("/mods/voltzationcore/textures/gui/vote.png");
	final int k = (this.width - 176) / 2;
	final int l = (this.height - 166) / 2;
	this.drawTexturedModalRect(k, l, 0, 0, 176, 166);
	this.list.drawScreen(par1, par2, par3);
	super.drawScreen(par1, par2, par3);
}

}

 

GuiRewardsList:

package me.superckl.VoltzationCore.client;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.renderer.Tessellator;

public class GuiRewardList extends GuiSlot{

private final GuiVote gui;
private final FontRenderer font;

public GuiRewardList(GuiVote gui, FontRenderer font) {
	super(Minecraft.getMinecraft(), gui.width, gui.height, 32, gui.height, 20);
	this.gui = gui;
	this.font = font;
}

@Override
protected int getSize() {
	// TODO Auto-generated method stub
	return 1;
}

@Override
protected void elementClicked(int i, boolean flag) {
	// TODO Auto-generated method stub

}

@Override
protected boolean isSelected(int i) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int getContentHeight(){
	return 20;
}

@Override
public void drawScreen(int i, int j, float k){
        //this.font.setBidiFlag(true);
        //this.gui.drawCenteredString(this.font, "testing 123", this.gui.width / 2, this.gui.height/2, 0x19ee37);
	System.out.println("Drawing Screen");
        super.drawScreen(i, j, k);
}

@Override
protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator tessellator) {
        this.font.setBidiFlag(true);
        this.gui.drawCenteredString(this.font, "testing 123", this.gui.width / 2, this.gui.height/2, 0x19ee37);
        System.out.println("DREW THE STRING!");
}

@Override
protected void drawBackground() {
	// TODO Auto-generated method stub
	System.out.println("Drawing background");
}

}

 

In the GuiSlot class, drawBackground and drawScreen are being called, since the logs are being printed (about 20 times a second, obviously). But, the drawSlot method is not called once. Does it have something to do with my positioning or is there something wrong that's deeper?

 

Thanks for any help.

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.

Announcements



×
×
  • Create New...

Important Information

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