Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy from other GUI #112

Open
mon0rail opened this issue Mar 10, 2022 · 2 comments
Open

copy from other GUI #112

mon0rail opened this issue Mar 10, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mon0rail
Copy link

mon0rail commented Mar 10, 2022

Hello.

Could you add copying slots from other GUI when creating a new GUI?

example code:

on load:
    create gui with id "menu" with virtual chest inventory with 3 rows named "menu":
        make gui slot 0 to dirt named "just dirt":
            player command "/say dirt"

on join:
    create gui with id "menu.%player%" named "%player%'s menu" copied from gui with id "menu":
        make gui slot 1 to skull of player

    wait 1 seconds
    open gui with id "menu.%player%" to player # dirt and player's head are displayed.
@mon0rail mon0rail added the enhancement New feature or request label Mar 10, 2022
@APickledWalrus
Copy link
Owner

This could be added, but I'm not sure how useful it would be. You could always use a function with a player argument to create the GUI.

The only thing I could really see being beneficial is performance impact maybe? But I don't think that's really an issue 🙂

@Fusezion
Copy link
Contributor

Fusezion commented Aug 19, 2022

This could be added, but I'm not sure how useful it would be. You could always use a function with a player argument to create the GUI.

The only thing I could really see being beneficial is performance impact maybe? But I don't think that's really an issue 🙂

I think something you could do instead of a copy is add a new parse tag for "template" like how "removeable" is starting from 1.3
atleast I think it's starting in 1.3 I don't recall it looking like this until that update

create [a] [new] [:template] gui [[with id[entifier]] %string%] with %inventory% [removable:(and|with) ([re]move[e]able|stealable) items] [(and|with) shape %strings%]

since I believe having a template is basically the same as this but something more people who would use and find more understandable. A fully fleshed out example of it could be something like this.

set {_shape::*} to "xxxxxxxxx","x1111111x","x1111111x", and "xxxxxxxxx"
create template gui with id "border" with chest inventory with 4 rows with shape {_shape::*}:
  format gui slot "x" with black glass pane named " "
  unformat gui slot "1"

command /use_template:
  trigger:
    create a new gui using template "border":
      set name of the gui to "My Template GUI"
      edit the gui:
        format next gui slot with lava bucket
        format gui slot 11 with water bucket

While as you stated only known good use would be performance. The other use is using it as a template for mass creation of guis such as shops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants