lets talk about making a custom curios style GUI

Started by mooredesign13 on

Topic category: Advanced modding

Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
lets talk about making a custom curios style GUI

I've seen a lot of posts on this topic which is to create an inventory GUI that is not linked to an item, block or entity. But IS linked to a specific player so that it will work in multi player. But perhaps you want a custom looking GUI, or to simply not be reliant on an outside plug-in.

 

I'll share what I know so far;
Creating a GUI with slots is the easy part. Simply use the GUI wizard in Mcreator.

Opening the GUI can be done with a keypress, also easily done in Mcreator.

 

Generally most people want to either store items in the GUI, OR store items AND give item buffs to the player (similar to how baubles or curios slots work)

Here is what I tried, and in concept, it should work, but for some reason it does not.

 

Step 1> created a simple GUI with one input slot. The slot does NOT drop the item upon closing, however, this is null as the slot will clear it's contents when the GUI is closed. This is likely the reason why these are so troublesome to make as I am not sure if the slot contents change to 0 before, or after the GUI closes and IF it does, if it is updating my itemstack variable to an empty itemstack.

 

Step2> created a player persistent, itemstack type variable, I called "ring_slot_0". This marched the slot number in the GUi.

 

Step3> I created a keypress that opens the GUI. This is easy to do. simply add the key bind from the mcreator menu, and create a procedure that opens the gui when that key is pressed. remember to assign it to the key pressed option in the keybind.

 

Step4> Create a procedure that will be called whenever the contents change of slot 0 on the GUi. Assign it to that slot for the "when slot changes" trigger. This procedure will do the following:

It will get a copy of the item placed in slot 0 and then it will assign that item to the "ring_slot_0" itemstack variable that I created.

 

Step5> Create a procedure that runs on the player tick update.

This procedure will do the following:

Checks to see that the value of the "ring_slot_0" Variable is (which will be an item). Then depending on what item is assigned to the variable, Do XYZ... (in my case I am applying a potion effect to the player with a duration of 500 ticks. and having it check for the remaining ticks as well and then re-applying it if the duration is less than 220. This way, it remains on perpetually and only stops applying if the variable returns an "emptyitemstack" OR a different item, in which case, it applies a different effect and so on.

 

Lastly, I went back to my procedure that opens the GUI with a keypress which opens the GUI. after opening the GUI, it gets a copy of the variable and then places it into slot 0. This presents the second issue: When the GUI Loads, it loads with an empty slot. Now if I saved the variable properly, I could then get the variable item, and then place a copy into slot 0 for the player to see. but this does not seem to work as the variable does not appear to save once the GUI is closed.

 

SO, what have other folks tried? Has any other approach to this worked?

 

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am using a procedure to…
Tue, 12/03/2024 - 21:31

I am using a procedure to store the value of the slots to the player's nbt: