- Functions
- 1,191 views • 4 today
- 133 downloads • 0 today
- 10
- 10
- 16
Required Resource Pack
11
Want to add a UI to your datapack/world? Make an autoclicker game? (I will make one using this datapack :) )
Then this datapack is the right answer for you!
!This datapack is designed for datapack, map, and server creators who have experience with Minecraft commands!
If you want to create a UI without using commands, leave a comment here or on my profile and I’ll make another datapack for it
Read (more detailed): geral_info.md
UPDATES [1.1.2]
(Old updates are listed in geral_info.md)
- updated geral_info.md for better clarity
- Removed minecraft/tags/entity
- Optimized and easier to use (now uses storage instead of entity NBT)
- Now the item only requires custom_data={ui:1}
- Removed [OLD_METHOD] and [NEW_METHOD] from functions.md
- Updated comments
- If the player loses the UI item, the tag @p remove menu is automatically removed
- added 'ui_init.mcfunction' function (runs only once when the player first opens the UI)
- In the resource pack, all .json files were converted to a single line to save space (only the invisible minecart part)
- Optimized detection of player logout using the UI and closing it
- Added an extra safety to the change function '@p[tag=menu]'
- Portuguese content removed, English content corrected
- Better examples:
- Removed old examples (except the crafting table and player stats)
- added shop, vote system for map, rewards, and inventory
EASY VIEW
If a new player joins: - Create chest_minecart (and ID)
- Call <load function> NEW
If the player is using the [UI] item: - Teleport that specific chest_minecart
Detect changes in the UI and call: - <user functions> - And reload the UI
If the player stops using the [UI] item: - Call <stop function> - Teleport the [UI] to 0 -64 0 (so it cannot be used and stays stored)
<page (UI)> - Your custom UI
<user functions> - Detect if an item was removed - Detect if an item was added - If it is a UI decoration (no function), the page reloads automatically - Can change to another UI
<stop function> - Extra operations when that specific page is closed
NEW
<load function>
- Any additional code for first-time joining players
- Load the main <page (UI)>
Then this datapack is the right answer for you!
!This datapack is designed for datapack, map, and server creators who have experience with Minecraft commands!
If you want to create a UI without using commands, leave a comment here or on my profile and I’ll make another datapack for it
- The chest minecart (and others) are invisible and do not affect your world’s minecarts
- Comes with examples that can already be tested in your world
- The datapack is fully commented for the curious
- Will get regular updates (including bug fixes if you find any)
- multiplayer compatible
- optimized
- Always include information about modifications to previous UI projects in the updates
Read (more detailed): geral_info.md
UPDATES [1.1.2]
(Old updates are listed in geral_info.md)
- updated geral_info.md for better clarity
- Removed minecraft/tags/entity
- Optimized and easier to use (now uses storage instead of entity NBT)
- Now the item only requires custom_data={ui:1}
- Removed [OLD_METHOD] and [NEW_METHOD] from functions.md
- Updated comments
- If the player loses the UI item, the tag @p remove menu is automatically removed
- added 'ui_init.mcfunction' function (runs only once when the player first opens the UI)
- In the resource pack, all .json files were converted to a single line to save space (only the invisible minecart part)
- Optimized detection of player logout using the UI and closing it
- Added an extra safety to the change function '@p[tag=menu]'
- Portuguese content removed, English content corrected
- Better examples:
- Removed old examples (except the crafting table and player stats)
- added shop, vote system for map, rewards, and inventory
EASY VIEW
If a new player joins: - Create chest_minecart (and ID)
- Call <load function> NEW
If the player is using the [UI] item: - Teleport that specific chest_minecart
Detect changes in the UI and call: - <user functions> - And reload the UI
If the player stops using the [UI] item: - Call <stop function> - Teleport the [UI] to 0 -64 0 (so it cannot be used and stays stored)
<page (UI)> - Your custom UI
<user functions> - Detect if an item was removed - Detect if an item was added - If it is a UI decoration (no function), the page reloads automatically - Can change to another UI
<stop function> - Extra operations when that specific page is closed
NEW
<load function>
- Any additional code for first-time joining players
- Load the main <page (UI)>
| Compatibility | Minecraft 1.21 |
| Tags |
4 Update Logs
bug fix : by MASTERGHOST 03/06/2026 4:35:29 pmMarch 6 @ 9:35 pm UTC
Added a system in the "inventory" example that returns the item with 'ui:1' if the player has placed it inside.
LOAD MORE LOGS
6682011
119



Have something to say?
how to make an UI
Anyway, I wanted to discuss with you how I can make this easier to use without hurting performance, while still giving as much freedom as possible to those who understand it.
If you're not very familiar with datapacks and want something simpler, I will try in the future to create a separate version that doesn’t require editing. For example, you would just place items inside a chest and it would automatically turn into a UI (I still need to figure out exactly how I’ll implement that).
If you do know about datapacks and your intention is to edit it but you’re not sure how:
After installing, simply move this datapack into your world’s 'datapacks' folder (you can also just add it and test it first to see if you like it).
If you decide to use it:
I recommend using Visual Studio Code, which is basically a more optimized and organized text editor (you can also install extensions to help detect command errors and provide syntax highlighting).
Open the datapack folder (using Visual Studio Code or a regular text editor), then open
geral_info.mdwhich provides general information.To view the functions and learn how to edit them, go to:
data/examples/function/functions.mdThis file explains how everything works and how to modify it.You can check how the examples were made. I separated them into the "Examples" folder, each folder represents one UI.
Inside each folder, I included:
UI (named 'initial_page.mcfunction') - this contains the items that appear on the page.
A function that is called when you click, take, remove, or change something in the chest:
change.mcfunctionIn that file (example below), you can see which item was removed. For example:
execute unless ui current[{Slot:0b}] run ...This command only executes when there is no item in slot 0 of the chest - meaning the item was removedIt’s nothing more than a function, so you can put whatever you want in there.
I admit I added some advanced stuff (but it can be ignored). It’s just there to show that everything is possible.
The part below is used to change the name of the sign (by adding the player’s MONEY and XP). It’s basically meant to be a player stats sign.
But for basic things, you can still do pretty much anything.
For example, if you want to remove an item and switch to another UI, you just need to call the function you created that defines the new UI.
UI:
You might think it’s complex because it looks big:
["minecraft:custom_model_data":{floats:[1]},"minecraft:item_name":"","minecraft:custom_data":{ui_item:{}}]"minecraft:custom_model_data":{floats:[1]}it’s only there to show that you can add custom textures to your UI. (can be removed)"minecraft:item_name":""is used to prevent the name "Barrier" from being displayed."minecraft:custom_data":{ui_item:{}}is used to indicate that the item is part of the UI only (it should not be removed),My datapack detects this tag, and if the player tries to take, drop, etc., the item will be removed automatically (since it’s only decorative). If the tag is not present, it means the item is meant to be collected by the player.
Slot and id are normal chest properties:
id:"stone"the item you want to place.Slot:0bthe slot where you want to place it (it starts at 0, not 1). The 'b' simply means byte - Minecraft requires it for this value.The rest below consists of functions explained in:
data/examples/function/functions.mdFor example, this is where you can learn how to change the UI name, icon, etc.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To summarize:
(I highly recommend using Visual Studio Code)
Go to
geral_info.mdand read the section called "TO EDIT THIS DATAPACK".and at:
data/examples/function/functions.mdPAGE FUNCTION → Everything related to the UI (the items that appear in the chest).
COMPARE FUNCTION → Everything related to the comparison function. As the name suggests, it checks which item was removed or taken and decides which function to run when that happens.
CLOSE FUNCTION → This was an extra feature I added (it was requested). If the player closes the UI on a specific page, it runs a specific function (it’s not mandatory to use).
All examples are fully commented. If you have any questions, let me know, and if necessary, I can make a video (the only problem is that I can write English, but I’m not very confident speaking it)
If a new player joins: - Create chest_minecart (and ID)
- Call <load function> NEW
If the player is using the [UI] item: - Teleport that specific chest_minecart
Detect changes in the UI and call: - <user functions> - And reload the UI
If the player stops using the [UI] item: - Call <stop function> - Teleport the [UI] to 0 -64 0 (so it cannot be used and stays stored)
<page (UI)> - Your custom UI
<user functions> - Detect if an item was removed - Detect if an item was added - If it is a UI decoration (no function), the page reloads automatically - Can change to another UI
<stop function> - Extra operations when that specific page is closed
NEW
<load function>
- Any additional code for first-time joining players
- Load the main <page (UI)>
Of course, to know how to use it, check
data\examples\function\functions.mdor you can just figure it out by looking at the examples.