-
Notifications
You must be signed in to change notification settings - Fork 9
GUI formats
It's possible to create custom formats that load a part of configuration and generate a GUI preview.
The API makes it easy, even if it behavior is pretty complex.
First of all, define a GUIFormat object, which constructor is GUIFormat(getName, getRows, getItems). All of these parameters are functions which take a map parameter, that contains the keys of the selected part of the configuration.
While getName returns a string and getRows returns an integer, getItems returns a list of GUIFormatItem, which constructor is: GUIFormatItem(position, item, meta).
-
positionis an instance ofGUIFormatPositionwhich takes either a slot number, or a x and y. -
itemis the string name of item (or even ID on 1.12); examples:bed,WOOL,iron door,acacia_boat,131. -
metais an integer representing the meta value of the item, works on 1.12 only.
Finally, enable the format by calling format.setActive(name), where name is used to recognize the format in case any error occurs (e.g. ChestCommands).
You can take a look at this sample add-on that adds support for ChestCommands.
