1

Help with gui error

Gutripper66's Avatar Gutripper667/1/12 4:00 pm
1 emeralds 93
Hello every one this is my first time posting on the forums and I'm sorry if I'm posting in the wrong section...

Ok so I'm working on a mod and I'm adding new gui and I need some help I am trying to make a "Trading" Sistem and I want it to work like this: When you click on a button it opens a new gui screen so I coded it in but when I click on the button nothing happens can anyone help me? Here is my code

Gui Trading
package net.minecraft.src;

public class GuiTrading extends GuiScreen
{



/** Also counts the number of updates, not certain as to why yet. */
private int updateCounter2;

/** Counts the number of screen updates. */
private int updateCounter;



public GuiTrading(InventoryPlayer inventory)
{
updateCounter2 = 0;
updateCounter = 0;
}


public void initGui()
{
updateCounter2 = 0;
controlList.clear();
byte byte0 = -16;

controlList.add(new GuiButton(7, width / 2 - 100, height / 4 + 48 + byte0, 98, 20, StatCollector.translateToLocal("Ores")));
controlList.add(new GuiButton(8, width / 2 + 2, height / 4 + 48 + byte0, 98, 20, StatCollector.translateToLocal("Mining Tools")));

}
/**
*Make 2 buttons first one can be like ores and second can be tools in tools he will sell Wood pick, Stone pick, Iron pick, Diamond pick, and gold pick.
*In the Ores button you can buy Iron ore, lapis, diamond, and coal
*
*/

protected void actionPerformed(GuiButton par1GuiButton, EntityPlayer entityplayer)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();


switch (par1GuiButton.id)
{

default:
break;

case 7:
mc.displayGuiScreen(new GuiOres(this));

break;

case 8:

mc.displayGuiScreen(new GuiMainMenu());
break;


}




}

public void updateScreen()
{
super.updateScreen();
updateCounter++;
}

public void drawScreen(int par1, int par2, float par3) {

drawCenteredString(fontRenderer, "Trading With Miner", width / 2, 40, 0xffffff);

drawDefaultBackground();
super.drawScreen(par1, par2, par3);
}
}



Gui Ores
package net.minecraft.src;

import java.io.File;
import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.Sys;


public class GuiOres extends GuiScreen{

public GuiOres(GuiScreen guiscreen)
{
screenTitle = "Ores";
guiScreen = guiscreen;
}

public void initGui()
{
StringTranslate stringtranslate = StringTranslate.getInstance();
screenTitle = stringtranslate.translateKey("Ores For Sale");


}

public void drawScreen(int i, int j, float f)
{
drawDefaultBackground();
drawCenteredString(fontRenderer, screenTitle, width / 2, 20, 0xfff);
}




protected String screenTitle;
protected GuiScreen guiScreen;

}
Posted by Gutripper66's Avatar
Gutripper66
Level 53 : Grandmaster Musician
94

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome