The logic of the mod should be changed to be more compatible
Foozey opened this issue ยท 4 comments
Hey there! Love the mod. But I have a suggestion that I definitely feel you should implement. You may have seen mods such as Overloaded Armor Bar and Armor Toughness Bar. Both of which work similar to your mod but for their own respective player stats.
However, there's a key difference between those mods and yours, and that's that your mod uses the vanilla assets to alter the color. This means that the mod isn't resource pack friendly. The other mods use a method of overlaying the colour directly onto the icons.png
texture sheet that is currently being used in-game. Meaning it looks and works great with resource packs.
Let me know what you think about adopting this approach, happy to help in any way I can.
I really should've documented this somewhere. I'll add it to the readme after I do a couple of things:
- Each resource file contains the heart textures for non-hardcore and hardcore game mode. Top is non-hardcore and bottom hardcore.
- Each full heart texture has its own half texture right next to it.
- Alpha values are transparency, in RGBA they go from 0 to 255.
health.png
- From left to right, each heart has its own half texture
- 1st heart is the standard icon, full white.
- 2nd heart is the poisoned state, There are slight gray areas on the same places that vanilla adds darker tones to their poisoned hearts.
- 3rd heart is the withered state. The slightly darker areas are also on the same spots as vanilla.
- The dots after that are for the tiny dot on top left of vanilla texture
- Under each heart texture there is a fully black texture that is made transparent with an alpha value of 56. This texture is what I call the shading that is also present in vanilla
- Under the shading for hardcore hearts, there's the hardcore part of the texture that is present in vanilla. This value looks different for each type of state (normal is dark, poisoned its gray, withered is white), so that is why they are in different colors. This texture is rendered with an alpha value of 178.
- And last but not least, the last red-ish texture is the ring that the heart gets when the player is withered. This is rendered without any transparency, 1:1 to the screen.
absorption.png
- From left to right:
- standard heart icon
- dot that is on top left of vanilla texture
- The usual hardcore part of absorption texture is drawn using the texture under the hardcore heart with an alpha value of 178.
- There are no poisoned or withered hearts here because vanilla doesn't have the function either.
half_heart.png
- This is only used in case that the max health of a player is under 10 hearts
- The texture with the black outline is the usual and the white outline is for when the player takes damage, gains back health...
The issue with this kind of thing is that those armor mods have a near white texture to work with. I have tried doing this way back but coloring the heart is basically impossible because the texture is red. The coloring method that they use GlStateManager#color4f
is the same method I used in the past until mojang added the new builtin coloring method IVertexBuilder#color
. It is just not possible to do this with the default texture.
There might be some dirty way to pull the texture out of icons.png
, turn it white&black and add it as a custom texture to the mod on game start, but that feels way to complicated to implement.
Thanks for responding. And yeah I thought that the near-white default texture would've definitely given them the edge with that method. Until a better solution is found, would you mind letting me know the approach you went for with the assets for the mod? I'm wanting to add support for it in my resource pack, but from looking at your assets, I can't tell what I should make white, and what should be a shade of grey. Was there a specific method to how you created the textures?