1

GUI Quick server connect question

Spect99's Avatar Spect9910/28/13 12:28 pm
1 emeralds 719 8
10/28/2013 3:56 pm
Spect99's Avatar Spect99
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
_____________________________

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;


( 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));
}


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 ?
Posted by Spect99's Avatar
Spect99
Level 43 : Master Droid
46

Create an account or sign in to comment.

8

Spect99
10/28/2013 3:56 pm
Level 43 : Master Droid
Spect99's Avatar
Ok thx
1
nickfromgreece
10/28/2013 1:55 pm
Level 54 : Grandmaster Programmer
nickfromgreece's Avatar
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.
1
TempestCraft
10/28/2013 1:42 pm
Level 33 : Artisan Engineer
TempestCraft's Avatar
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()));
}
1
DenialMC
10/28/2013 1:39 pm
Level 10 : Journeyman Modder
DenialMC's Avatar
Should be

if(par1GuiButton.id == 5)
{
mc.displayGuiScreen(new GuiConnecting(mc, new ServerData("ipofmyserver", 25565)));
}


Daniel
1
Spect99
10/28/2013 1:51 pm
Level 43 : Master Droid
Spect99's Avatar
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
"
1
Spect99
10/28/2013 1:37 pm
Level 43 : Master Droid
Spect99's Avatar
It does exist ^^ , but i think its a problem with the 25565
1
TempestCraft
10/28/2013 1:36 pm
Level 33 : Artisan Engineer
TempestCraft's Avatar
GuiConnecting.java does not exist.

(I think, I haven't done modding in a long time.)
1
Spect99
10/28/2013 1:23 pm
Level 43 : Master Droid
Spect99's Avatar
Anyone ?
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome