Knokko's Custom Items

Knokko's Custom Items

37.4k Downloads

Show custom tool durability bar in minecraft 1.14 and later

knokko opened this issue ยท 0 comments

commented

Currently, custom tools never have a durability bar because they are technically unbreakable. In the past, this was absolutely required because only unbreakable tools could be retextured. But if I were to use CustomModelData instead, this would no longer be required.

But, this is not as easy as it looks: when I remove the unbreakable tag, the custom tool will also lose 'natural' durability, which may conflict with its custom durability. To avoid this, I should change the 'minecraft durability' of the custom tool to ('current custom durability' / 'max custom durability') * 'max minecraft durability' whenever the durability changes. (But I should be careful when the durability gets close to 0...)

If done properly, this should give the illusion that the tool truly has a custom durability with a nice durability bar.