![Exordium](https://media.forgecdn.net/avatars/thumbnails/614/437/256/256/637998093760381250.png)
Unexpected HUD layer removal
Madis0 opened this issue ยท 9 comments
OneBar shows the bars in layers. In the simplest sense, there is
- bottom layer (black opaque)
- health layer (red opaque) and
- hunger (brown semi-transparent)
- text (white semi-transparent)
Without FasterGUI it looks like this (note the bar behind the text):
However, FasterGUI somehow omits the bottom layers, so the hunger layer is displayed as if it had no layers underneath at all:
Considering that the whole point of the mod is to show various bars in layers, I am not sure how I can resolve this. Any ideas to make it compatible with your mod?
Hm, try printing out the value used for the background. The bright red bar seems to be fine, so maybe the background color(the dark red bar) just managed to get some transparency, that under the normal blend settings doesn't become visible.
I had to enforce a blend mode for the hunger bar due to apple skin using an incorrect blend mode. I guess in the future I can provide an API that allows mod devs to fully take control over the blend mode again, assuming they know what they are doing. Could it be, that the bars contain odd transparency that became visible this way?
Could it be, that the bars contain odd transparency that became visible this way?
I'm not sure what could be "odd" about it. I'm using DrawableHelper.fill with an alpha-enabled color picker from Cloth Config's AutoConfig.
Hmm, I think you misunderstood me a bit.
The dark red segment has the correct color and transparency: -1086445789
aka BF3E2723
(hex ARGB).
However, the layer behind it should be -16777216
aka FF000000
but it is not visible at all. While debugging it still correctly went onto the fill command with the right color parameter, so I'm not sure what else to do here.
Toggling "Enabled Gui" off in the mod obviously fixes it.
Yea I did nothing to try to combat this. You have to make sure to have the correct blend mode enabled, and then it should just work.
So how do I change the blend mode? Don't see an user-facing option for it and don't know what I should do in code. Can I even do it with the DrawableHelper?
No clue about the DrawableHelper. https://github.com/tr7zw/Exordium/blob/1.19/Shared/src/main/java/dev/tr7zw/exordium/ExordiumModBase.java#L164 You probably want to set up these settings to have the correct alpha blending enabled.
Solved by adding the following to my mod:
In build.gradle
:
//...
repositories {
//...
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
//...
dependencies {
//...
modImplementation "maven.modrinth:exordium:1.0.1-1.19"
}
In main code:
import com.mojang.blaze3d.systems.RenderSystem;
import dev.tr7zw.exordium.ExordiumModBase;
//...
public void render(){
if(doesClassExist("dev.tr7zw.exordium.ExordiumModBase")) {
ExordiumModBase.correctBlendMode();
ExordiumModBase.setForceBlend(true);
}
// Mod's rendering code here
if(doesClassExist("dev.tr7zw.exordium.ExordiumModBase")) {
ExordiumModBase.setForceBlend(false);
RenderSystem.defaultBlendFunc();
}
}
}
public static boolean doesClassExist(String name) {
try {
if(Class.forName(name) != null) {
return true;
}
} catch (ClassNotFoundException e) {}
return false;
}
//...