Procedure Calls from slots in GUIs cross call each other

Started by kreatorKen on Mon, 08/24/2020 - 18:00

Topic category: Help with modding (Java Edition)

Last seen on 11:22, 5. Oct 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Procedure Calls from slots in GUIs cross call each other
Mon, 08/24/2020 - 18:00

I have made a GUI with a slot (nearly for the same idea above) and have it called from a mob. I am using 2020.4. The problem is, the trigger events (likely logically??) from a slot cross call each other. I wrote a simple procedure to output to player chat which procedure trigger was called:

For simplicity I will refer to "When slot contents change" as (1); "When item taken from slot" as (2); and "When transferred from slot (shift-click)" as (3).

Here are my observations:

a) when I right-click on my mob, the "When slot contents change" (1) is automatically called ONCE, whether or not if I have a block (item) in the slot. -Why? the slot contents (as far as I would have understood it) did not change since I only opened the GUI. (they are likely dynamically re-populated, but dont have any java skills). This is not the expected behaviour, is it(?), I expect it not to be called, since I only opened the GUI and did not manually (or programmatically) change the slot contents.

b) left or right clicking on the slot (when GUI is open of course) calls (1). This occurs only ONCE per click. (seems fine, makes sense, even though I dont drag or drop out if it)

c) adding a block to the slot calls (1) TWICE! i.e. (1)(1)

d) removing a block from the slot calls (1)(2)(1)

e) shift+left or right click calls (3)(1)(1)(2)

I have a summary with screenshot images of my GUI code and the output, maybe I will add a link to the later. I was trying to access the ENBT variables (as Text Labels from the GUI) via the entity, but I cant get that to work, which accordingly is because the NBT entity variables are not sync between client and server, unlike tile entity for blocks or in items. [???] maybe?

But either way I only think one procedure should be called (triggered) per trigger type. Even if we say that (1) occurs when you add or remove something, it should not be being called twice.

Any ideas anyone?

Last seen on 07:56, 26. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
As far as I know (with my…
Mon, 08/24/2020 - 19:02

As far as I know (with my testing and two other friend's testing on the MoreCube Discord Sever), we've had issues using the GUI inventory procedure and have had to create our own procedures to populate and read the data in the slots. I'd suggest creating a possibly bug/suggestion report with the information you've provided. It'd probably be best.