Lack of method to get an item's durability (damage)

Published by JDLENL on Mon, 07/30/2018 - 02:06
Upvotes: 0
Issue description

There is no method available in MCreator 1.7.9 to obtain the durability of an item. Say I wanted to create an item which does something when you right click, at the cost of durability, and which destroys itself when it runs out of durability (like a tool does.) There is currently no way to do this. There are methods to set an item's durability, to remove durability, and to change an item's display name, but no method which returns the item's durability as a number.

 

I.e. The following method is impossible to do in MCreator with the Procedure system:

if(item.getDurability() > 0){
     doItemThing();
}else{
     player.removeItemFromInventory(item);
};

// or whatever, i don't actually know the internal methods used

 

Issue comments

We will implement methods to get item's properties in the future.

This feature will be added in MCreator 1.8.2. I am closing this ticket.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.