assistance with gui

Started by swelkinn_n on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
assistance with gui

as the title says, i need assistance with a gui i'm working on

think of it like a magical spell selection book for simplicity. it checks if a player both has an advancement and what spell id is currently selected in the gui to allow a player to select a spell

these spells are represented by items in a slot

for the most part, it works. functionally speaking, it's pretty much entirely functional since it allows the player to select the right spells based on the procedure, but the issue happened when i introduced a "locked spell" item

attached here is an image of the procedure i'm using to put the spell in the selection slot 

while again, this does functionally work in the ability to select spells and such (and works when i introduce other spells, this image only shows 1), it will always show the locked spell in the slot, regardless if the player has the achievement to unlock the spell or not. the interesting part is that even with this, when clicking the spell to put it in the gui's other slots (which is how it determines what spells the player has equipped), it picks up the right spell which is why i say it functionally works, as it in all fairness does. obviously, however, i would much rather it actually show what spell is in the selecting slot

 

i'm not sure if i explained this good enough, so if anyone needs more explanation i can give it

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not completely sure if…
Sun, 09/24/2023 - 14:33

I'm not completely sure if this will solve the problem, but I've had lots of issues personally with entity NBT tags, so I try to avoid them altogether. They are very unstable and don't save data for long periods of time. They also seem to screw up procedures in my experience.

Since this variable is being added to the player, I would recommend using a global variable for either "player_lifetime" or "player_persistant" depending on how you are setting this up.

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, what is the trigger…
Sun, 09/24/2023 - 14:34

Also, what is the trigger for this procedure?

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the nbt actually doesn't…
Sun, 09/24/2023 - 15:02

the nbt actually doesn't seem to be the issue, as all of this worked perfectly fine prior to the addition of the locked item

the trigger was attached to a "while this gui is open tick" 

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also to clarify the nbt data…
Sun, 09/24/2023 - 15:44

also to clarify the nbt data isn't being stored for a long time either, it's basically just a page counter that resets when a gui is opened

 

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmmm.... I'm not seeing…
Sun, 09/24/2023 - 16:08

Hmmm.... I'm not seeing anything else that could be problematic. My only other suggestion would be to switch the order (put the locked on on the "if" and the unlocked on the "else if")

 

This may also sound dumb, but have you tried creating a new world and tested it from scratch? Some things don't work properly if you add them onto a world that has already been created.

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
alright update: changing the…
Sun, 09/24/2023 - 16:08

alright update:

changing the advancement check to a variable check makes it work so problem solved i guess

i didn't want to make a ton of variables but it is what it is then

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Good! I'm glad you were able…
Sun, 09/24/2023 - 16:12

Good! I'm glad you were able to get it solved :)