• check_circle Functions
  • check_circle Predicates
  • 327 views, 12 today
  • 20 downloads, 0 today
  • 2
  • 1
officialbarden's Avatar officialbarden
Level 5 : Apprentice Miner
0

About Me


Minecart 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.


Here's a usage guide 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), looking at 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 "page" in which each index is also a list of items. Example: pages[ [{Slot:1b,id:".."},{Slot:2b,id:".."}] , [{Slot:3b,id:".."}] ] Thus, is "page number" just the index of the "pages" list, like, first page is "Page number zero" and it is the first index of pages[] and so on.
  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_TO_GUI_ID) and PAGE:$(CHANGE_TO_PAGE_INDEX). 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 of the storage. 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 similar data in a different path which held the previous items data and filtering it, 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 storage 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

  • First, Create a GUI Profile

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

This will create a GUI profile and send you a tellraw message. From there, you can change the Name of the GUI and GUI-ID to whatever string you want.
  • 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 and run the following command:
/trigger bgui-addPage

You'll be shown a list of GUIs to edit. Find the GUI that you just created and click on it while looking at the chest/barrel/shulker_box simultaneously. Then the datapack will run a raycast and get the page layout from the chest youre looking at. Normally, it appends the new pages to the very last of the list of pages. To change this, you can change the SET_PAGE argument of the function to whatever integer you like. By default, it is -1 meaning first from last.
  • Edit a 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 bgui-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. Click on the desired page number. You'll be provided with a list of items in the page. Click [​CHANGE VALUES] and you'll be suggested a function file to run. Make sure to change the {SLOT:""} to the slot of the item you want to make changes to. (for example: {SLOT:"13b"}; you must include the "b") To leave a change empty or remove a value, keep it blank. 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 ... {SLOT:"13b",FUNCTION_FILE:"test:file",ITEM_MODIFIER:"test:modifier",CHANGE_TO_GUI_ID:"<either the same gui id or different gui id>",CHANGE_TO_PAGE_INDEX:"<either current page index or a different gui id's page index>",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_MODDIFIER value to the item modifier to be applied to the item.
You must set CHANGE_TO_GUI_ID 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_TO_PAGE_INDEX value to the page index of GUI-ID specified in CHANGE_TO_GUI_ID.
**YOU MUST NOT CHANGE THE LAST TWO ARGUMENTS**

Other

You must NOT re-upload the pure unmodified version of this datapack under any circumstances.
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!

  • Thanks (in-advance) for contributing (if you've contributed) to the datapack!

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.
CompatibilityMinecraft 1.20
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome