Damage Item in the slot of Item GUI

Started by ChebyPattern on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Damage Item in the slot of Item GUI

The title explains it well.

I need to damage Item in the slot of Item that has GUI.

To put it simply, I have a medkit that can contain dressings, medicine(bottles) and syringes.
The dressings have durability. I already made the procedure work to check for specific slots and what
items they posses. The only thing I need to know is how to make the "deal damage" work.

I am aware that "get copy of itemstack" basically gets the copy of an item which is in the slot.
But that leaves me with question, how do I affect item's durability while it's in the slot.. directly?

If doing directly is not possible, how do I do it with the "copy" and then replace the original copy with damaged version?

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Forgot to mention. The GUI…
Fri, 04/12/2024 - 05:24

Forgot to mention. The GUI is closed while the procedure is happening.
Meaning the "Deal [*] damage to item in slot [*] of the currently open GUI of Event/Target Entity" won't work.

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It took me some time, but I…
Fri, 04/12/2024 - 07:01

It took me some time, but I managed to figure it out.
I also made an explanation for others who might have had the same issue:
Item-In-Gui-Explanation

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it works! I almost gave up…
Sun, 04/21/2024 - 08:12

it works! I almost gave up,tks