Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Description Page Top Image

  • This is an active project!
  • 1.20.2-5+ supported! (make sure to check versions before installing!)
  • More features are being added to it regularly!
  • Make sure to follow this project to get notified about new features!

About Me

GUI Maker is a datapack mapmaking tool that allows mapmakers to create Inventory GUI in their minecraft worlds! This is a storage-based datapack which stores page layout details in appropriate storage paths and draws from them with the help of macros. This datapack is released under MIT license, meaning that if you wish to make changes, you can download its source code and modify accordingly.

For usage guide, you may refer to this video.

Features

Create Multiple Inventory GUI

This datapack allows for an easy way to create multiple GUI in the same minecraft world! It also allows for easy navigation and page-changing feature!

Multiplayer-Friendly!

The Minecart "GUI" is surrounded by interaction entity that prevents other players from opening the Minecart's Inventory without looking at it from a certain angle. Although it is not 100% possible to prevent other players from interacting with the GUI, this method prevents players from accidently interacting with it.

Performance-Efficient!

This datapack has been made to account for performance load and prevent lag spikes caused by its functions. If you feel that the datapack is not efficient enough and can be further improved, feel free to contact me or make your own version of this datapack.

How it works

In this datapack, there are certains steps that need to be followed in order to make a working minecart GUI. To follow these steps, we must first understand how this datapack works:

  1. First, a GUI profile is created. This profile has base information about the GUI, such as the name of the GUI, the GUI-ID, and the original author of the GUI. GUI Name is used to set the Minecart's Name when a GUI is summoned and the "OWNER" is the original author's username. Out of all the info, GUI-ID is the most important as in order to summon the minecart, you will have to input the GUI-ID as a macro argument, along with PAGE index.
  2. Next, A page is appended. This is done by setting up all the page layout as desired inside a chest/barrel/shulker box (of any type), standing on that block and running the /trigger function. The datapack then appends the contents of the page to a Main GUI database, where all the raw foundation of pages are stored. Each GUI has a list variable "PAGES" in which each index is a "page entry" For example PAGES[{page_name:'[{"text":"PAGE NAME"}]',page_number:<page_number>, layout: [{},{},{},...] }]
  3. Lastly, A page is edited. With this, the player can apply function files to buttons that when clicked, are ran with player's identity and location as context. Players can also set Item Modifiers which modify the item when the page is loaded/summoned. Players can also set a "CHANGE_TO_GUI_ID" value and "CHANGE_TO_PAGE_INDEX" value which, when the item is clicked, changes to page to the page layout of GUI_ID:$(change_gui) and PAGE:$(change_page). Meaning that when an item is clicked, the datapack sources the next page layout from the given GUI-ID and picks the page layout from the given page PAGE_INDEX.
  4. Extras: The item click detection works by constantly merging the GUI's page contents to one path in the marker's data NBT. If the values are the same, then the process success integer is 0, meaning that the data couldn't be merged and that there have been zero changes/clicks. When a player clicks any item. The data merging SUCCEEDS, where the new data is all the items that the player never clicked. By taking this new data and removing all old data i.e. items that were not clicked, we get the data of the item that was clicked. Then, we run all other processes accordingly. Since the merging fails when the data in the GUI and the Marker NBT simultaneously is similar, it doesn't consume any resource. However, when the player clicks an item, the data merging takes place. In this way, it doesn't overload the minecraft world.

How to Make a GUI

Here's a video tutorial.

  • First, Create a GUI Profile

    To create a GUI Profile, run the following command:
/trigger gm-createGUIprofile

This will create a GUI profile and send you a tellraw message.

  • Next, Add a page

    Next, you'll want to append pages to your GUI. So we'll setup a page layout in a chest/barrel/shulker_box, stand on the container block and run the following command:
/trigger gm-addPage

You'll be shown a list of GUIs to edit. Find the GUI that you just created and click on it while standing on the chest/barrel/shulker_box simultaneously. Then the datapack will get the page layout from the chest youre looking at. The pages are prepended (new page goes to last) and the page number increments for every new page.

  • Lastly, Edit the page

    Lastly, you'll want to edit the items in the pages to do stuff when clicked. To do this, we'll have to edit the page of the item. Run the following command:
/trigger gm-editPage

You'll be shown a list of GUIs to edit, once again. Select the GUI you want to edit. You'll then be shown the Page number you want to edit. Then a CHEST_MINECART will be summoned at your location. Open the GUI and click on the item you want to edit CONFIG for. Note, that if you click again on the item or any other item, it will run the default GUI functions as set in the config. Note that by keeping arguments blank it also removes the existing value!

This is what the command would look like when changes are made:

/function ... {function_file:"test:file",item_modifier:"test:modifier",change_gui:"<either the same gui id or different gui id>",change_page:"<either current page index or a different gui id's page index>",slot:"<slot of item, do not change>",gui_id:"<DO NOT CHANGE>",page:<DO NOT CHANGE>}
You can set FUNCTION_FILE value to the function file you want to run.
You can set ITEM_MODIFIER value to the item modifier to be applied to the item.
You must set CHANGE_GUI value to a different value if you want the GUI page to change to that GUI-ID's page when clicked.
You must set CHANGE_PAGE value to the page index of GUI-ID specified in CHANGE_GUI.
**YOU MUST NOT CHANGE THE LAST THREE ARGUMENTS**

Other

You must NOT re-upload this exact datapack under any circumstances.
You can package this datapack + your function files and upload them, as you wish.
You can make changes you want as you wish and use it/upload it as you wish.
You are allowed to use this datapack in your creations and upload this datapack with your creation combined.

Extras

This is the very first build of the datapack (version 1.0.0). There are features planned for the future, such as the ability for the GUI to accept/return item inputs. And they may work completely differently than the current version. However, do I advise you to wait for furthur updates? The future is still in the future and it might take a long time for the future to actually be included.

Thank you!

  • Thanks for downloading this datapack (if you've downloaded it)!

  • Thanks (in-advance) for notifying us about any and all bugs with the datapack!

  • Thanks for using this datapack in your creations!

  • Thanks for showing interest in this datapack project!

TO-DO list:

  • add ability to accept item input by players.
  • prevent players from losing items.
  • add more flexibility in usage.
  • make a GUI version of the GUI-making process.
  • add ability to animate(?)/time item change.

Project members

barden

Owner


Technical information

License
MIT
Project ID