Topic category: Help with modding (Java Edition)
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?