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

Submitted 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

Submitted by Klemen on Mon, 07/30/2018 - 10:24

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

Submitted by Klemen on Tue, 12/11/2018 - 10:34

Thanks, I am glad that you searched first :)

Submitted by Klemen on Wed, 01/09/2019 - 19:13

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