Data Packs Other

GUI API 1.21.1 Datapack (Video is for 1.20.4)

  • 1.8k views • 3 today
  • save_alt 51 downloads • 0 today
Compatibility
Minecraft 1.21
Changes include
    • 2
    • 7
    Bisai
    Lvl 30Artisan Collective
    6
    Guide to Creating a Custom GUI in Minecraft with the Custom GUI API Datapack

    This guide will take you step-by-step through the process of creating a custom GUI in Minecraft using the Custom GUI API Datapack. Follow the instructions carefully to create and customize your own GUI.

    1. Creating a New GUI

    To create a new GUI, execute the following command:

    /function header:api/gui/setup/create

    2. Renaming the GUI

    To rename the newly created GUI, use the following command:


    /function header:api/gui/setup/rename


    3. Setting the GUI Type

    You can choose from five different types for your GUI. Use the corresponding commands to set the desired type:

    Chest:
    /function header:api/gui/setup/set/type/chest

    Chest Minecart:
    /function header:api/gui/setup/set/type/chest_minecart

    Ender Chest:
    /function header:api/gui/setup/set/type/ender_chest

    Hopper:
    /function header:api/gui/setup/set/type/hopper

    Hopper Minecart:
    /function header:api/gui/setup/set/type/hopper_minecart

    4. Setting the Homepage

    To set the homepage for your GUI, execute the following command while standing on a chest with another chest underneath:

    /function header:api/gui/setup/set/homepage

    The upper chest represents the layout of your GUI.
    The lower chest contains Action Items. Place these on the slots where you want an action to occur when clicked in the GUI.

    5. Defining Actions for Items

    There are two ways to execute commands when an item is clicked:

    Execute command from the GUI (run this on the Action Item):
    /data modify block -104 74 56 Items[0].components.minecraft:custom_data.Action.GUI append value "say hi"

    Execute command from the Player (run this on the Action Item):
    /data modify block -104 74 56 Items[0].components.minecraft:custom_data.Action.Player append value "say hi"
    6. Adding a New Page

    To add a new page to your GUI, use the following command:

    /function header:api/gui/setup/add/page

    7. Removing a Page

    To remove a page from your GUI, execute this command:

    /function header:api/gui/setup/remove/page

    8. Switching Between Pages

    To switch pages, set the new page value and execute the page switch:

    data modify storage database:temp api.gui.load_page set value {PAGE NAME}
    function header:api/gui/engine/go/page

    9. Going to the Homepage

    To return to the homepage of your GUI, use the following command:

    function header:api/gui/engine/go/homepage
    10. Making the GUI Functional

    To ensure your GUI functions properly, you need to execute the following function every tick for the GUI entity:


    function header:api/gui/engine/guiYou have to set the GUI ID in the Scoreboard in the Entity

    scoreboard players set (Entity) api.gui.ID 1


    By following these steps, you have now created and customized a custom GUI in Minecraft. Enjoy creating and experimenting with your own GUI!


    If you have Questions, feel free to contact me.

      Have something to say?

    Welcome