A code workaround for 'provided item'?

Started by SingularityV3 on

Topic category: Help with modding (Java Edition)

Last seen on 22:54, 17. Sep 2019
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A code workaround for 'provided item'?
Tue, 02/05/2019 - 01:19 (edited)

I have an item that has 10 ''uses" and when a button in a GUI is clicked the item's durability will go down. I have everything set up in a procedure, but the ''on button press" event handler does not have support for itemstacks. The GUI is bound to a block, the item goes in a slot in the GUI. The "itemstack" dependency comes not from actually moddifying the damage, but from detecting the current damage and breaking the item when it reaches -1 (because that is how Minecraft handles it, for some reason, and I want to be consistent). I suspect the problem is that the only procedure block able to detect damage is "get damage of the provided item," so is there a way to define "provided item" without mucking around in the code? If not, could someone tell me how to do the proper code manipulations? (I know JavaScript, but I am nowhere near familiar enough with Java or Minecraft's objects to know what I'm doing)

Edited by SingularityV3 on Tue, 02/05/2019 - 01:19
Last seen on 20:40, 21. Feb 2020
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have just the same problem…
Wed, 02/19/2020 - 19:17

I have just the same problem, but with crafting... I am making a custom crafting table and want an item to be able to do 5 craftings, then break. But since i can´t just get the damage of any item in the gui i have a little bit of a problem here. Any help would be nice.

Did you found a solution, @SingularityV3?

DeinAlbtraumTV

Last seen on 20:40, 21. Feb 2020
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I actually found another…
Wed, 02/19/2020 - 20:02

I actually found another workaround:

I am now using the nbt data of the item to keep track of the remaining uses.