Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.