- 129
- 0
Как назначить 2 кнопку в GUI? Пробовал добавить действие в - для второй кнопки,но кнопка либо делает + либо не работает.
public class ItemMyGUI extends GuiScreen {
ResourceLocation texture2 = new ResourceLocation(ModInf.MODID.toLowerCase(),"textures/GUI/GUIitem.png");
public int Per = 1;
public int I;
public int L = 1;
public final int xSizeOfTexture = 283;
public final int ySizeOftexture = 142;
public ItemMyGUI(EntityPlayer player){
}
@Override
public void drawScreen(int x,int y,float f){
drawDefaultBackground();
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().func_110434_K().func_110577_a(texture2);
drawTexturedModalRect(105, 20, 0, 0, 257,257);
drawString(fontRenderer, "Hello+Per" , 130, 100, 0x99ff99);
super.drawScreen(x, y, f);
}
@Override
public boolean doesGuiPauseGame(){
return false;
}
public void initGui(){
int posX = (this.width - xSizeOfTexture /2);
int posY = (this.height - ySizeOftexture /2);
this.buttonList.add(new GuiButton(0,203,118,11,11,"+"));
this.buttonList.add(new GuiButton(1,213,118,11,11,"-"));
}
public void actionPerformed(GuiButton button){
switch(button.id){
case 0:
break;
default:
Per =Per+L;
if(Per == Per+L)
{
}
}
}
}
public class ItemMyGUI extends GuiScreen {
ResourceLocation texture2 = new ResourceLocation(ModInf.MODID.toLowerCase(),"textures/GUI/GUIitem.png");
public int Per = 1;
public int I;
public int L = 1;
public final int xSizeOfTexture = 283;
public final int ySizeOftexture = 142;
public ItemMyGUI(EntityPlayer player){
}
@Override
public void drawScreen(int x,int y,float f){
drawDefaultBackground();
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().func_110434_K().func_110577_a(texture2);
drawTexturedModalRect(105, 20, 0, 0, 257,257);
drawString(fontRenderer, "Hello+Per" , 130, 100, 0x99ff99);
super.drawScreen(x, y, f);
}
@Override
public boolean doesGuiPauseGame(){
return false;
}
public void initGui(){
int posX = (this.width - xSizeOfTexture /2);
int posY = (this.height - ySizeOftexture /2);
this.buttonList.add(new GuiButton(0,203,118,11,11,"+"));
this.buttonList.add(new GuiButton(1,213,118,11,11,"-"));
}
public void actionPerformed(GuiButton button){
switch(button.id){
case 0:
break;
default:
Per =Per+L;
if(Per == Per+L)
{
}
}
}
}