1
Hey guys
One quick answer , i am helping some guys out on a modpack, and i am working on the GUI
I am trying to add a button on the main menu to quick connect on a specific server here is what i add in the GuiMainMenu.java
_____________________________
( its the one in Bold , italic and underline )
Than i added
but i get an error on "new GuiConnecting(mc, "ipofmyserver", 25565));"
I get this : The constructor GuiConnecting(Minecraft, String, int) is undefined
Can someone help me plz ?
One quick answer , i am helping some guys out on a modpack, and i am working on the GUI
I am trying to add a button on the main menu to quick connect on a specific server here is what i add in the GuiMainMenu.java
_____________________________
Click to reveal
private void addSingleplayerMultiplayerButtons(int par1, int par2)
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, par1, I18n.getString((FontColors.GREEN + "Singleplayer"))));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, par1 + par2 * 1, I18n.getString((FontColors.BLUE + "Multiplayer"))));
this.buttonList.add(new GuiButton(5, width / 2 - 100, par1 + par2 * 1, I18n.getString(FontColors.BOLD + "World Ofwar Sable")));
//If Minecraft Realms is enabled, halve the size of both buttons and set them next to eachother.
fmlModButton = new GuiButton(6, this.width / 2 - 100, par1 + par2 * 2, "Mods");
this.buttonList.add(fmlModButton);
minecraftRealmsButton = new GuiButton(14, this.width / 2 - 100, par1 + par2 * 2, I18n.getString("menu.online"));
minecraftRealmsButton.width = 98;
minecraftRealmsButton.xPosition = this.width / 2 - 100;
this.buttonList.add(minecraftRealmsButton);
this.minecraftRealmsButton.drawButton = false;
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, par1, I18n.getString((FontColors.GREEN + "Singleplayer"))));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, par1 + par2 * 1, I18n.getString((FontColors.BLUE + "Multiplayer"))));
this.buttonList.add(new GuiButton(5, width / 2 - 100, par1 + par2 * 1, I18n.getString(FontColors.BOLD + "World Ofwar Sable")));
//If Minecraft Realms is enabled, halve the size of both buttons and set them next to eachother.
fmlModButton = new GuiButton(6, this.width / 2 - 100, par1 + par2 * 2, "Mods");
this.buttonList.add(fmlModButton);
minecraftRealmsButton = new GuiButton(14, this.width / 2 - 100, par1 + par2 * 2, I18n.getString("menu.online"));
minecraftRealmsButton.width = 98;
minecraftRealmsButton.xPosition = this.width / 2 - 100;
this.buttonList.add(minecraftRealmsButton);
this.minecraftRealmsButton.drawButton = false;
( its the one in Bold , italic and underline )
Than i added
Click to reveal
if(par1GuiButton.id == 5)
{
mc.displayGuiScreen(new GuiConnecting(mc, "ipofmyserver", 25565));
}
{
mc.displayGuiScreen(new GuiConnecting(mc, "ipofmyserver", 25565));
}
but i get an error on "new GuiConnecting(mc, "ipofmyserver", 25565));"
I get this : The constructor GuiConnecting(Minecraft, String, int) is undefined
Can someone help me plz ?
Create an account or sign in to comment.
8
Ok thx
The problem the button click is called client side...
but the proccessing needs to be done server side
You need to create a custom packet send from the client to the server sayin basically "Button Clicked" then server will already have the info aka the player that sent the packet and the GUI open which contains tile entity info so you can get the block from that.
but the proccessing needs to be done server side
You need to create a custom packet send from the client to the server sayin basically "Button Clicked" then server will already have the info aka the player that sent the packet and the GUI open which contains tile entity info so you can get the block from that.
I also want to point out that you might have a conflict with the language manager, unless you changed it's ID.
if (par1GuiButton.id == 5)
{
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
}
Should be
Daniel
if(par1GuiButton.id == 5)
{
mc.displayGuiScreen(new GuiConnecting(mc, new ServerData("ipofmyserver", 25565)));
}
Daniel
I did that , but as soon as i export the ServerData i get this error
"
Multiple markers at this line
- The constructor GuiConnecting(Minecraft, ServerData) is
undefined
- The constructor ServerData(String, int) is undefined
"
"
Multiple markers at this line
- The constructor GuiConnecting(Minecraft, ServerData) is
undefined
- The constructor ServerData(String, int) is undefined
"
It does exist ^^ , but i think its a problem with the 25565
GuiConnecting.java does not exist.
(I think, I haven't done modding in a long time.)
(I think, I haven't done modding in a long time.)
Anyone ?