ShayBox / Durability101

A rewrite of the original Durability101 mod
https://curseforge.com/minecraft/mc-mods/durability101
MIT License
5 stars 5 forks source link

[Suggestion] Config option to change the color of the numbers + more... #2

Open SonicX8000 opened 4 years ago

SonicX8000 commented 4 years ago

This would apply for 1.12 & up, if do-able... anyway...

Currently, the number starts from green and changes to red as durability lowers, would it be possible to enable a config option of some sorts to set a Hex Color? Like if I wanted I can change the hex color to FFFFFF which will have the number show up as a white color. 00FFFF to have the number display as a light blue color, etc.

Could also have colors appear depending on the remaining durability, like... green if at 100%, white at 50%-99%, yellow 25%-49%, orange at 10%-24%, red at 0%-9% durability.

I'm not sure if this is already in place but would it be possible to show a number for energy-based items? Such items are IC2's Nano Saber, Flux-Infused Armor from Redstone Arsenal, etc. which show as a 0 for the durability.

ShayBox commented 4 years ago

The mod is using the built-in function that calculates the color for the durability bar, I might see about copying that into my mod and allowing a config to set the gradient range.

(I'll look into adding this when I create the 1.15 version, just waiting for a stable release of forge 1.15)

I can't easily add support for other mods, this mod just reads the item durability, if the other mods aren't using that (which they should be) to keep track of durability, it would be a lot of duplicated and mod-specific code to add them, tinkers does but they multiply it by 10 which adds an extra 0 to the number.

Since this is a coremod it can't use forge's built-in mod communication, it would have to do nbt or metadata reading for every mods format.

To any mod developers out there, please keep track of tool/weapon/armor/etc durability with the actual durability instead of metadata or nbt, durability was made for this exact purpose, don't recreate it needlessly.

ShayBox commented 3 years ago

I found Minecraft uses a built-in hsv function to select a point across a gradient, I can change the start and stop points but not multiple points across the gradient, and since Forge coremods don't have a way to allow configs, it would only be configurable on Fabric and Forge 1.12

TBiscuit1 commented 10 months ago

I know it's an old issue but couldn't you use your own calculation for custom color? I did a quick snippet of the code and that would be more then doable