![ServerSync](https://media.forgecdn.net/avatars/thumbnails/254/696/256/256/637199290945083080.png)
Custom Main Menu Button
lumien231 opened this issue ยท 6 comments
Custom Main Menu does no longer display a wrapped button if there is no button with the specific id added to the main menu. Therefore your way of using CMM does no longer work because you don't actually add a button yourself. (Why do you not do that btw. :P, wouldn't require cmm then).
You can get around this for the time being by calculating your button id based on where it is defined. 6000 is the singleplayer button, 6001 multiplayer etc, if you put your button right after multiplayer then the button id would be 6002. (Make sure not to include wrappedButton in the definition of your button)
This still doesn't explain how to make use of the button. Why not just write a simple example button or CMM config??
I'm having to try literally every possible combination of definitions and ultimately guess what the hell I'm doing.
Button Definition
"serversync":
{
"text" : "Connect to server",
"posX" : -70,
"posY" : 100,
"width" : 140,
"height" : 20,
"texture" : "custommainmenu:textures/gui/button3.png",
"tooltip" : "Connects to server and syncs mods",
"action" : {
"type" : "openGui",
"gui" : "connectToServer"
}
}
mainmenu.json
{
"images":
{
"screen":
{
"image" : "custommainmenu:textures/gui/glass.png",
"posX" : -100,
"posY" : -40,
"width" : 200,
"height" : 1100,
"alignment" : "top_center"
},
"title":
{
"image" : "custommainmenu:textures/gui/icon1.png",
"posX" : -40,
"posY" : 20,
"width" : 80,
"height" : 80,
"alignment" : "top_center"
}
},
"buttons":
{
"singleplayer_6000":
{
"text" : "menu.singleplayer",
"posX" : -70,
"posY" : 50,
"width" : 70,
"height" : 20,
"texture" : "custommainmenu:textures/gui/button3.png",
"action" : {
"type" : "openGui",
"gui" : "singleplayer"
}
},
"multiplayer_6001":
{
"text" : "menu.multiplayer",
"posX" : 0,
"posY" : 50,
"width" : 70,
"height" : 20,
"texture" : "custommainmenu:textures/gui/button3.png",
"action" : {
"type" : "openGui",
"gui" : "multiplayer"
}
},
"packhelp_6002":
{
"text" : "Extras",
"posX" : -70,
"posY" : 70,
"width" : 70,
"height" : 20,
"texture" : "custommainmenu:textures/gui/button3.png",
"action" : {
"type" : "openGui",
"gui" : "custom.packhelp"
}
},
"quit_6003":
{
"text" : "menu.quit",
"posX" : 0,
"posY" : 70,
"width" : 70,
"height" : 20,
"texture" : "custommainmenu:textures/gui/buttonexit.png",
"hoverText" : "Awww, don't leave!",
"action" : {
"type" : "quit"
}
},
"serversync_6004":
{
"text" : "Connect to server",
"posX" : -70,
"posY" : 100,
"width" : 140,
"height" : 20,
"texture" : "custommainmenu:textures/gui/button3.png",
"tooltip" : "Connects to server and syncs mods",
"action" : {
"type" : "openGui",
"gui" : "connectToServer"
}
},
"Donate_6005":
{
"text" : "Patreon",
"posX" : 80,
"posY" : -25,
"width" : 50,
"height" : 20,
"texture" : "custommainmenu:textures/gui/buttonsmall.png",
"alignment" : "bottom_center",
"action" : {
"type" : "openLink",
"link" : "https://www.patreon.com/jadedcat"
}
}
},
"texts":
{
"modpack":
{
"text" : "Agrarian Skies 2",
"posX" : -70,
"posY" : -40,
"color" : 10194114,
"alignment" : "bottom_center"
},
"version":
{
"text" : "Version: 1.1.14",
"posX" : -70,
"posY" : -30,
"color" : -1,
"alignment" : "bottom_center"
},
"author":
{
"text" : "by Jadedcat",
"posX" : -70,
"posY" : -20,
"color" : 9222338,
"alignment" : "bottom_center"
},
"forgestuff":
{
"text" : "Forge-#forgeversion#",
"posX" : -70,
"posY" : -10,
"color" : -1,
"alignment" : "bottom_center"
}
},
"other":
{
"splash-text":
{
"posX" : 50,
"posY" : 80,
"color" : -256
},
"background":
{
"image" : "custommainmenu:textures/gui/background/screen.png"
}
}
}
serversync.cfg
# Configuration file
gui {
# The ID of the button that connects to the server and updates [range: 0 ~ 2147483647, default: 6001]
I:ButtonID=6004
}
ignoredfiles {
# These files are ignored by serversync. DO NOT IGNORE serversync.cfg
S:IGNORE_LIST <
./mods/nativelog.txt
./mods/CustomMainMenu-MC1.7.10-1.7.1.jar
>
}
serverconnection {
# The port in which the minecraft server is running, not the serversync port [range: 1 ~ 49151, default: 25565]
I:MINECRAFT_PORT=25565
# The IP address of the server [default: 127.0.0.1]
S:SERVER_IP=127.0.0.1
# The port that your server will be serving on [range: 1 ~ 49151, default: 38067]
I:SERVER_PORT=38067
}
serverencryption {
# The check command security key phrase [default: 0ba4439ee9a46d9d9f14c60f88f45f87]
S:SECURE_CHECK=0ba4439ee9a46d9d9f14c60f88f45f87
# The check-mods command security key phrase [default: 3dd3152ae3e427aa2817df12570ea708]
S:SECURE_CHECKMODS=3dd3152ae3e427aa2817df12570ea708
# The checksum command security key phrase [default: 226190d94b21d1b0c7b1a42d855e419d]
S:SECURE_CHECKSUM=226190d94b21d1b0c7b1a42d855e419d
# The exists command security key phrase [default: e087923eb5dd1310f5f25ddd5ae5b580]
S:SECURE_EXISTS=e087923eb5dd1310f5f25ddd5ae5b580
# The exit command security key phrase [default: f24f62eeb789199b9b2e467df3b1876b]
S:SECURE_EXIT=f24f62eeb789199b9b2e467df3b1876b
# The recursive command security key phrase [default: f8e45531a3ea3d5c1247b004985175a4]
S:SECURE_RECURSIVE=f8e45531a3ea3d5c1247b004985175a4
# The update command security key phrase [default: 3ac340832f29c11538fbe2d6f75e8bcc]
S:SECURE_UPDATE=3ac340832f29c11538fbe2d6f75e8bcc
}
storagevariables {
# DO NOT EDIT THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING! (If you are a server feel free to change it as much as you want to update your clients) [default: 20150608_000500]
S:LAST_UPDATE=20152412_000500
}
Hope this helps, in this example the button has been set up in position 6004 so your button ID would be 6004.
There's also a bunch of example CMM configs here CMM
You can see how the button is being handled in this class GuiScreenHandler.java