Started by
Jomst0r
on
Topic category: Help with Minecraft modding (Java Edition)
I've tried checking the forum before, but the ideas simply don't work.
I'm trying to add an Arc-Reactor slot to a GUI, that is done, it also saves to a global variable, but it does not load it into the slot with the "Open GUI" function that I have added.
I've been at this for hours not being able to figure it out, please help
I've also had trouble with the "Open GUI" trigger combined with "put this in that slot of the GUI"; I suspect that because the GUI isn't actually open yet, there's no slot to put the block in.
I was intending to try and put a delay, so it's "after opening, in X ticks, put this thing here", because the GUI should be there by then. Or, if that didn't work, circumvent the "Open GUI" trigger entirely, by having a tick event (item, block, whatever) that goes "If this GUI is open and this variable is X, put this here, then change that variable to Y", which is... not efficient, but hey.
Haven't got around to attempting these, though, so I'm not certain what'll work - but some possibilities, anyway.
I have tried with a delay, didn't really seem to work.
I don't know if that has something to do with my code that saves the item to a variable or not but eh ¯\_(ツ)_/¯
Can confirm doing it on "while GUI open" works fine for me
A have a sad suspicion that it is because you cannot save the item in a slot to a global variable when you close the GUI.
The way i found that works for me is to Create a procedure that "Saves" the item you want in the slot as a String NBT for whatever the GUI is attached to and this same procedure will also set a Logic NBT to True (IE if you have a different "String" for each item that goes into that slot and when the save procedure activates it sets the NBT to that String and logic to True to show that the GUI has a bound item). Then you use a procedure to set the NBT data of that item to "None" when the GUI is opened ONLY IF the Logic value is False. Then on GUI tick update create a procedure that IF Logic NBT is True then set Item in slot based on the String NBT data.