How can I use the same GUI in 2 different Blocks? (sharing the inventory of the Slots)

Started by YkZen on

Topic category: Help with modding (Java Edition)

Last seen on 21:53, 2. Aug 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I use the same GUI in 2 different Blocks? (sharing the inventory of the Slots)
Sun, 04/10/2022 - 07:12 (edited)

Hello! Tried to make an Furnace with 2 Blocks (Off and On) I'm working on a 1.16.5 Forge mod.

 

I have a little problem... When I want to use the same GUI in 2 different Blocks they don't sync or update at the same time.

 

I think that in the 2020.2 version of MCreator that did not happen, when putting the Items the GUI was forced to close and you had to reopen the GUI, so it prevented the items from being duplicated when closing the first GUI of the first Block and go to the GUI of the second Block.

 

In the current version 2021.3, how can I keep the same GUI updated or synchronized at the same time when updated or changed from one Block to another?

Or at least that when putting the items the GUI of the first Block is closed (in this way avoiding that the Items can be duplicated)?

Please help.

 

An image of the error or problem:

ERROR

Tutorial I used (But it doesn't work well in MCreator 2021.3 with the GUI): 

https://www.youtube.com/watch?v=bakTMAZO7O0

Here the files of the Custom Furnace (You need to convert this to MCreator 2021.3 to notice the error... Just import the files):

https://www.mediafire.com/file/yfwgl2p0jirbqom/CustomFurnaceExample_Fil…

Edited by YkZen on Sun, 04/10/2022 - 07:12
Last seen on 13:58, 21. Jan 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
when you are changing…
Sat, 05/07/2022 - 12:03

when you are changing between states close the GUI and then open it over a tick, also make procedure local variables of ItemStack and name them ItemSlot0,ItemSlot1,ItemSlot2 then save their corresponding GUI slot within it to prevent loss then close the GUI wait one tick and then set the slots that you used from the localized variable attributed with the slot. this should make a smooth transition between states.