Item damage count workaround for breaking item on 0

Started by HollowHeart19 on

Topic category: Troubleshooting, bugs, and solutions

Active 6 years ago
Joined Jan 2016
Points:
726

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 18
Item damage count workaround for breaking item on 0

I've created an item with durability because of right click on block events. Once item damage count hits "0", I need a way to create an event that breaks the item once this occurs. Suggestions? and don't say tools. Tools focus left clicking. Right clicking events won't effect durability or "uses" for tools.

Active 1 year ago
Joined Aug 2013
Points:
1162

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
Check if the ItemStack…
Thu, 09/06/2018 - 05:53

Check if the ItemStack durability is less or equal to 0 and then just remove it from inventory.

Active 6 years ago
Joined Jan 2016
Points:
726

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 18
I know to do that, but the…
Sat, 09/08/2018 - 22:13

I know to do that, but the problem is, the item procedures have no way to make a comparison to check itemstack from the java blocks. Is this something I'll have to add to the events in the code for my item mentioned?

Active 1 year ago
Joined Aug 2013
Points:
1162

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
What MCreator version are…
Sat, 09/08/2018 - 22:31

What MCreator version are you using?
By the way, I really recommend you to just edit the code instead of doing it in procedures/events as the needed code should fit pretty much on one line.

Active 6 years ago
Joined Jan 2016
Points:
726

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 18
1.8.0, and even in this…
Sun, 09/09/2018 - 02:41

1.8.0, and even in this instance, I don't know what line of code to add, and where in the file

Active 1 year ago
Joined Aug 2013
Points:
1162

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
It depends on what the…
Sun, 09/09/2018 - 07:34

It depends on what the MCreator generated code looks like. You will have to edit the procedure or the block that calls the procedure.