#I need help with a new gui system im working on
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
use https://mcstacker.net to generate give command spawn eggs
but I don’t understand the question
i trimmed it down
ok
so
how would i spawn a entity with a tag and replace entitys position with a barrel
i really just need help with the barrel part
use an item frame
As I said you can use mcstacker to create a give command which spawns a marker with tags, then you can detect that marker with execute at @e[type=marker,tag=…] run setblock …
why?
If you tell us what this is for then maybe there’s a better way
cuz he/she/it just wants to place down a custom barrel
they don't actually need a entity
it would make it more simple
but the problem is
what i tend to do with this
i need it so when that barrel is set there it will automatically open the barrel
and i need the barrel invis
you can't with datapacks
the barrel invis?
that it automatically opens
Custom Gui
>>> The guide is too long for Discord, please follow [this link](https://datapackhub.gitbook.io/custom-barrel-gui/) to get to the Guide.
You have to have it on a block or a chest minecart
if you don't want it bound to a block, you need a floating chest minecart in their head
then you just need regular right click detection
Rightclick Detection
>>> There are multiple ways to detect right clicks using datapacks/commands, here is a quick rundown on each of them and their cons and pros!
You can get more detailed instructions on how to use them using their corresponding /methods
Warped Fungus on a Stick (WFOAS)/Carrot on a Stick (COAS)
This method works by using an item.used scoreboard objective which triggers when using either of the two items and then running commands as/at players with a score of 1 or higher.
Pros:
- easy to pull off
- works in any world
- doesn't require additional entities
Cons:
- wfoas attracts striders/coas pigs and rabbit
Depends:
- detects up to 5 clicks/second when holding right click
Eye of Ender (EoE)
This method works by using an advancement to detect whenever a player uses an eye of ender and then executing code as/at them.
Pros:
- doesn't require additional entities
- doesn't attract mobs
- doesn't need to run every tick
Cons:
- slows player down when holding right click
- only works in worlds without strongholds (there are ways to work around this, although these are way less performant)
Depends:
- detects up to 20 clicks/second when holding right click
- bound to the player, not a specific location
Interaction Entities
This method works by using an advancement to check whether a player interacted with an interaction entity and then executing code
Pros:
- see "depends"
- can also detect left clicks
Cons:
- requires an additional entity
Depends:
- detects up to 5 clicks/second when holding right click
- bound to a specific location, not player
- can't be interacted through
no that would then still require 2 clicks
when do you want the player to be able to open the gui?
like when they hold a specific item?
or in a specific area?
you need what?
strongholds
what do strongholds have to do with this?
Cons:
slows player down when holding right click
only works in worlds without strongholds (there are ways to work around this, although these are way less performant)
to right click detection
ah, you don't want rclick detection
most of the time
when do you want the gui to open?
not possible (*)

the only way to open a custom ui is to trick them into right clicking it
hm
you always need an actual container that they open
ok what are the available ways
and that can be a minecart or a block
then
and you open these with rclick
either click on the block or on the minecart
the minecart can be moved since its an entity
what do you actually want to put in the custom ui?
so if you want do "add a gui to an item" you really just spawn the gui in a minecart in their face when they hold the item and with rclick they interact with the minecart
that also makes it so other players and projectiles can't hit you
it doesn't help you in any way
the only downside is that it attracts stuff
you can’t open a ui with just right click detection
you need to make them legitimately right click on a container block or a chest minecart
so what is possible
if it works for a wandering trader use that instead
you want it custom right?
its a player trading
so you can trade with other players and stuff
yes
this
what ever is easier for my smooth brain
or have it in a specific block like a “trading block” or something idk
custom gui is not easy and a minecart make it more complicated
a chat based gui is quite easy
but limited to text
as the interactable elements
how would they trade there items via text?
like trade mainhand item
put item to trade in mainhand - run the chat based gui - select player to trade - wait for them to accept
or something like that
how do you then want to initiate the trade?
via command? is that fine?
it would be a /trigger <...> command
/trigger placeholdertrade
then you need to add that objective with the criteria trigger
and enable that for all players
iirc you can do that every tick for @a without major sideeffects
ye
and react to that being 1
because a /trigger without a number sets it to 1
or increases by 1? comes out to the same
how would i do this
how would i do the code cause i honestly dont know how i would do it
giving a unique id
- initiate a global score once
- any time a new player joins, set their id to the global score
- then increase the global score
u got macros right? if not this is very annoying
i dont have one nor do i know what a macro is
what version are you in?
1.20.4
k
u can use macros so all good
displaying all players, the easy way
- execute as all players
- send a tellraw to the player who ran the command with their name and a /trigger click event that triggers to their score (maybe add some offset here if needed)
then the player who ran the command can just click on them and their triggered score corresponds to the player
ok know i get it
hello?
@rain geyser
i have done it
i just need help with the macro
that prints off everybodys name in chat that is in the world/server
i did the click event
macros can run commands while replacing parts of the command
to run a macro with a scoreboard value, you do something like this
execute store result storage a: a.score int 1 run scoreboard players get @s id
function some:macro/function with storage a: a
$say THIS SHOULD BE THE TELLRAW COMMAND WITH /trigger gui_trigger_score set $(score)
this would print the say command with the score where $(score) is
you can use that to build yyour tellraw
hello?
Hello, can you tell me briefly what the discussion was about?
one sec
ok
im back
basically im trying to create a text based trading system
you trade whatever is in your mainhand
What have you already done?
They helped you here, I asked about it. what is already in the datapack?
ok
so what ive done so far
is
trade.mcfunction: ```
tellraw @a {"text": "[Server] Trade Started", "color": "#ca6eff"}
tellraw @s {"text": "[Player Selector]", "clickEvent": {"action": "run_command","value": "/function duckie:test"}}
scoreboard players set @s trade 0
playsound minecraft:block.note_block.bell player @s ~ ~ ~ 500
test.mcfunction: tellraw @s {"selector":"@a"} playsound minecraft:block.note_block.harp player @a ~ ~ ~ 500
<@&935561184806060073> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)