Consumable item with durability.

Started by Crimuretta on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Consumable item with durability.

Made a custom healing injector that supposed to have bow animation and lose durability each time it's used. (1.16.5)
When it's a no-food option, there's nothing happening when RMB is pressed at all — no animation, no effect and no consumption.
If it's food option turned on, it just get's consumed without taking durability and disappears like eh.

So how do i make it intended way if it's possible at all?

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're in luck because I've…
Thu, 09/19/2024 - 03:33

You're in luck because I've been trying to do the same thing and got it to work!

Step 1.  Make sure your item has durability greater then 0 and set eating result to your item: https://imgur.com/a/nInxOxj 

Step 2. After that make your first procedure. This procedure basically stores the item durability into a global var set as player lifetime: https://imgur.com/a/c9HEUVa 

Step 3. Once that's done make your second procedure. The second one will cause the item to take damage whenever you finish using it: https://imgur.com/a/iqN7IUZ 

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
!!! I missed up the links…
Thu, 09/19/2024 - 03:41

!!! I missed up the links ignore the message above !!!

 

You're in luck because I've been trying to do the same thing and got it to work!

Step 1.  Make sure your item has durability greater then 0 and set eating result to your item: step 1 - Imgur

Step 2. After that make your first procedure. This procedure basically stores the item durability into a global var set as player lifetime: step 2 - Imgur

Step 3. Once that's done make your second procedure. The second one will cause the item to take damage whenever you finish using it: step 3 - Imgur

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're kiiiinda late, this…
Tue, 09/24/2024 - 20:52

You're kiiiinda late, this forum gives any answers so rarely i had to chat with GPT and make some custome code under it's redaction. And it worked nicely lol.

But still, thanks for your answer <3