Custom GUI
Allowing you to customise your Mod GUIs to make your server unique - without any code.
Last updated
Allowing you to customise your Mod GUIs to make your server unique - without any code.
Last updated
Custom GUI support will be rolled out to all of our mods over time. As of now, GGyms is our first public mod to get access to it. This is a new system that'll get improvements & new features over time.
Inside of your mod's config, you'll find a "GUI" folder.
This contains a "Menu" folder alongside "item_definitions.json". The item definitions file lets you define items that are used globally across GUI system. This is mostly used for "GUI Fill" items, such as glass panes.
Most mods come with this Item Definition config by default. Our GUIs are filled with Black Stained Glass by default. The "defaultElementFillItem" is generally used to denote that an element (say, a Gym, or Team) would be in that space if one existed.
Inside of the "Menus" directory, GUIs are configured.
Each file contains a config for that specific GUI. This one defines the player facing Gym menu when a player does /gyms.
This config results in the above in game view. You can define the GUI type, which is effectively the size of the GUI, and then the actual elements themselves. The "id" field must be unique and should not be changed, as it's what is called in the code to get the specific menu.
Each element is a single character, the keys for which are defined below the GUI itself in the "keys" value. Here, "#" ties to the "defaultFillItem" which is defined in the global "item_definitions.json" file. "X" is defined as the "defaultElementFillItem".
In the code, the dynamic elements are passed into this config (in this case, Gym Items) with a specific key. In this case, the key is "X". The code goes through each key and places a Gym where an "X" is found. If there are less Gyms than "X" keys, it defaults to using the key value, which is "defaultElementFillItem".
You'll often see other characters, such as "C" above. Each mod will have its own documentation telling you what elements will attempt to be placed there. In this case, "C" is the challenge item - if a player has an active Gym challenge, it should be displayed on the menu. If there isn't a challenge, the code doesn't pass it into the GUI, and the default "C" key value is used instead - "defaultFillItem". In the screenshot, the player doesn't have an active challenge, so the "defaultFillItem" is used.