GUI
PetBlocks comes with a powerful embedded GUI plugin, which supports Minecraft 1.8.9 - Latest.
The default PetBlocks GUI can be opened with the command /petblock
. Make sure you have all the required permissions
for all GUI pages.
Creating your own GUI
The easiest way to get started is by editing the existing PetBlocks GUI and observing the changes.
The workflow is like that:
- Learn about all the available properties from the
/PetBlocks/gui/simple_sample_menu.yml
file. - Edit one of the gui yaml files in the
/PetBlocks/gui
folder. - Execute
/petblocks reload
. - Open the GUI with
/petblocksgui open <name>
Starting from Scratch
- Copy the
simple_sample_menu.yml
and rename it tomy_first_menu.yml
. - Open the
my_first_menu.yml
in an editor like VSCode or NotePad++ - At the top of the file change the unique identifier of the GUI to
name: "my_first_menu"
- Join your server and execute the following command. This command should always be executed after you have made changes in your
.yml
files.
/petblocks reload
- Execute the following command to open your GUI.
/petblocksgui open my_first_menu
- The GUI should now open for you. If it does not, check your console log for yaml file parsing errors. Correct your
my_first_menu.yml
or start over by deleting it.
Attaching a custom command to your menu
- Let's assume you want to open the GUI with the command
/mycoolgui
. - Edit the command section in your
my_first_menu.yml
to your needs.
command: "mycoolgui"
Customizing the GUI menu
- There are many different ways to customize the GUI. Like displaying the items, executing certain commands and hiding/showing items on certain conditions.
- Please take a look into the
simple_sample_menu.yml
file again. Each available options is explained with a short comments. - If the comment mentiones
Required.
You need to set this property. If it saysOptional
you do not need to set it. - As an easy test, locate the
minecraft:gold_block
in yourmy_first_menu.yml
and replace it withminecraft:diamond_block
. After you gave done that simply execute/petblocks reload
again and open the GUI/mycoolgui
.