#making an interactive screen using interaction entities

1 messages · Page 1 of 1 (latest)

keen kelp
#

so im making an interactive minecraft screen ingame using interaction entities and I wanna achieve the effect where if you hover over a button (if your cursor is on the button) it changes "Textures" in my case just modifing the data of the display entity, and ive done that previously using this predicate: { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "type_specific": { "type": "minecraft:player", "looking_at": { "type": "minecraft:interaction", "nbt": "{Tags:[\"button1\"]}" } } } } and this tick.mcfunction: execute as @a if predicate sharps:looking_at_button1 run function sharps:looking_button1 buttttt this way it spams the command every tick and I wanna implemend this later to a server im making so im wondering if there is a more optimal way of doing the same thing because otherwise it will cause some lag to the server if I have set it up so that a command spams every tick for each button

white tree
#

The best way I think is to tag the display when it's hovered and exclude said tag from your interaction

civic juniper
#

/execute as @a[predicate=sharps:looking_at_button1] im fairly sure this is more efficient, but already this kind of thing is not that intensive in reality, depends on your scale

keen kelp
civic juniper
#

also only run as player in distance=..20 as well? then it only loops players near the screen

keen kelp
#

that wont work because the screen will be at spawn surrounded by ppl...

#

will do it anyway

civic juniper
#

well it will still work

#

people away from spawn wont be tested

keen kelp
#

yea

civic juniper
#

youll have to specify the location as the screen

#

at @e[some_selector_for_the_screen] as @a[distance=..20]

keen kelp
#

yea prolly the best alternatively