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

Published by JDLENL on
Status
Fixed
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